Преглед на файлове

Merge branch 'master' of gitlab.a-level.com.ua:monstrocode/alevel_project

Helium преди 6 години
родител
ревизия
2db99086d9
променени са 4 файла, в които са добавени 139 реда и са изтрити 2 реда
  1. 1 1
      config/sphinx.php
  2. 2 0
      database/seeds/ItemsTableSeeder.php
  3. 8 1
      database/seeds/PicturesTableSeeder.php
  4. 128 0
      storage/sphinx/sphinx-awlex-local.conf

+ 1 - 1
config/sphinx.php

@@ -3,7 +3,7 @@
 declare(strict_types=1);
 
 return [
-    'conf' => base_path('\\storage\\sphinx\\etc\\sphinx-awlex.conf'),
+    'conf' => base_path('\\storage\\sphinx\\sphinx-awlex-local.conf'),
     'indexer' => base_path('\\sphinx-3.0.2\\bin\\indexer.exe'),
     'searchd' => base_path('\\sphinx-3.0.2\\bin\\searchd.exe'),
 ];

Файловите разлики са ограничени, защото са твърде много
+ 2 - 0
database/seeds/ItemsTableSeeder.php


+ 8 - 1
database/seeds/PicturesTableSeeder.php

@@ -27,7 +27,14 @@ class PicturesTableSeeder extends Seeder
         ['items/item_7/BHwIfe5zHwf47EVpE15Nz6nHEG8q2pgDT6J6cT8K.jpeg', '7', 'holodos-saumsung[1].jpg', 'jpg', '466028'],
         ['items/item_7/K1dLwLEZOgM9SgNFQacHUdYFa0Mf4nptpQkEUAd4.jpeg', '7', 'holodos-saumsung[2].jpg', 'jpg', '466028'],
         ['items/item_7/xhnHmVSNMHzzq0ibYluJRXnpFrzf2uqK99Ej1sI6.jpeg', '7', 'holodos-saumsung[3].jpg', 'jpg', '466028'],
-        ['items/item_8/lN5nQKCc9tpJBw5LTMF0LluuEvbZNTJQGGInobpa.jpeg', '8', 'shapka.jpg', 'jpg', '466028']
+        ['items/item_8/lN5nQKCc9tpJBw5LTMF0LluuEvbZNTJQGGInobpa.jpeg', '8', 'shapka.jpg', 'jpg', '466028'],
+
+        ['items/item_8/lN5nQKCc9tpJBw5LTMF0LluuEvbZNTJQGGInobpa.jpeg', '9', 'SobachkaPavlova.jpg', 'jpg', '466028'],
+        ['items/item_8/lN5nQKCc9tpJBw5LTMF0LluuEvbZNTJQGGInobpa.jpeg', '9', 'SobachkaPavlova[1].jpg', 'jpg', '466028'],
+
+        ['items/item_8/lN5nQKCc9tpJBw5LTMF0LluuEvbZNTJQGGInobpa.jpeg', '11', 'Samsug32SmartTV.jpg', 'jpg', '466028'],
+        ['items/item_8/lN5nQKCc9tpJBw5LTMF0LluuEvbZNTJQGGInobpa.jpeg', '11', 'Samsug32SmartTV[1].jpg', 'jpg', '466028'],
+        ['items/item_8/lN5nQKCc9tpJBw5LTMF0LluuEvbZNTJQGGInobpa.jpeg', '11', 'Samsug32SmartTV[2].jpg', 'jpg', '466028'],
     ];
 
     protected $columnNames = ['path', 'item_id', 'real_name', 'mime_type', 'size'];

+ 128 - 0
storage/sphinx/sphinx-awlex-local.conf

@@ -0,0 +1,128 @@
+#
+# Minimal Sphinx configuration sample (clean, simple, functional)
+#
+
+source awlex-db
+{
+	type			    = mysql
+
+	sql_host		    = localhost
+	sql_user		    = root
+	sql_pass		    =
+	sql_db			    = awlex
+	sql_port		    = 3306	# optional, default is 3306
+
+	sql_query_pre	    = SET NAMES utf8
+}
+
+#--------------- more detailed query ---------------------------------------
+#---------------------------------------------------------------------------
+source src_items : awlex-db
+{
+	sql_query		    = \
+		SELECT \
+		    i.id, \
+		    i.caption, \
+		    i.description, \
+		    i.category_id, \
+		    cat.title AS category, \
+		    i.subcategory_id, \
+		    subcat.title AS subcategory, \
+		    pic.path AS pictures, \
+		    i.created_at \
+		FROM items AS i \
+        JOIN categories AS cat ON cat.id = i.category_id \
+        JOIN subcategories AS subcat ON subcat.id = i.subcategory_id \
+        LEFT JOIN \
+            (SELECT item_id, GROUP_CONCAT(path SEPARATOR ", ") AS path FROM pictures GROUP BY item_id) as pic \
+        ON pic.item_id = i.id \
+        GROUP BY i.id;
+
+	sql_field_string	= caption
+	sql_field_string	= description
+	sql_attr_uint	    = category_id
+    sql_field_string	= category
+	sql_attr_uint	    = subcategory_id
+	sql_field_string	= subcategory
+	sql_field_string	= pictures
+	sql_attr_timestamp	= created_at
+
+}
+
+index items
+{
+	source			    = src_items
+	path			    = storage/sphinx/data/items/items_index
+	#morphology          = stem_ru
+    morphology          = lemmatize_ru_all, stem_en
+	min_word_len        = 3
+	min_infix_len       = 2
+	ignore_chars        = U+AD
+    blend_chars         = +, &, U+23
+    blend_mode          = trim_tail, skip_pure
+    charset_table       = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+0430..U+044F, U+401->U+0435, U+451->U+0435
+}
+
+index items_rt
+{
+	type			    = rt
+	rt_mem_limit	    = 128M
+	path			    = storage/sphinx/data/items/items_rt
+	rt_field		    = caption
+	rt_field		    = description
+	rt_attr_uint	    = subcategory_id
+}
+
+#--------------- less bud not worse ----------------------------------------
+#---------------------------------------------------------------------------
+source src_items_light : awlex-db
+{
+    sql_query		    = SELECT * FROM items
+	sql_field_string	= caption
+	sql_field_string	= description
+	sql_attr_uint	    = subcategory_id
+}
+
+index items_light : items
+{
+    source			    = src_items_light
+    path			    = storage/sphinx/data/items_light/items_light_index
+}
+
+index items_light_rt
+{
+	type			    = rt
+	rt_mem_limit	    = 128M
+	path			    = storage/sphinx/data/items_light/items_light_rt
+	rt_field		    = caption
+	rt_field		    = description
+	rt_attr_uint	    = subcategory_id
+}
+
+#---------------------------------------------------------------------------
+
+common {
+    lemmatizer_base = sphinx-3.0.2/dict
+}
+
+indexer
+{
+	mem_limit		    = 128M
+    lemmatizer_cache    = 256M # cache it all
+}
+
+searchd
+{
+	listen			    = 9312
+	listen			    = 9306:mysql41
+	log			        = storage/sphinx/log/searchd.log
+	query_log		    = storage/sphinx/log/query.log
+	read_timeout	    = 5
+	max_children	    = 20
+	pid_file		    = storage/sphinx/log/searchd.pid
+	seamless_rotate	    = 1
+	preopen_indexes	    = 1
+	unlink_old		    = 1
+	workers			    = threads # for RT to work
+	binlog_path		    = storage/sphinx/data/binlog
+}