1
+ <?php
2
+
3
+ namespace Arris \Toolkit ;
4
+
5
+ use Closure ;
6
+ use Foolz \SphinxQL \Drivers \ResultSetInterface ;
7
+ use Foolz \SphinxQL \Exception \ConnectionException ;
8
+ use Foolz \SphinxQL \Exception \DatabaseException ;
9
+ use Foolz \SphinxQL \Exception \SphinxQLException ;
10
+ use Foolz \SphinxQL \SphinxQL ;
11
+ use PDO ;
12
+
13
+ /**
14
+ * Interface __SphinxToolkitFoolzInterface
15
+ *
16
+ *
17
+ *
18
+ * @package Arris\Toolkit
19
+ */
20
+ interface SphinxToolkitFoolzInterface {
21
+
22
+ /**
23
+ * Инициализация статического интерфейса к методам
24
+ *
25
+ * @param string $sphinx_connection_host
26
+ * @param string $sphinx_connection_port
27
+ * @param array $options
28
+ */
29
+ public static function init (string $ sphinx_connection_host , string $ sphinx_connection_port , $ options = []);
30
+
31
+ /**
32
+ * Создает коннекшен для множественных обновлений (в крон-скриптах, к примеру, вызывается после init() )
33
+ */
34
+ public static function initConnection ();
35
+
36
+ /**
37
+ * Создает инстанс SphinxQL (для однократного обновления)
38
+ *
39
+ * @return SphinxQL
40
+ */
41
+ public static function createInstance ();
42
+
43
+ /**
44
+ * Обновляет (UPDATE) реалтайм-индекс по набору данных
45
+ * с созданием коннекшена "сейчас"
46
+ *
47
+ * @param string $index_name
48
+ * @param array $updateset
49
+ * @return ResultSetInterface|null
50
+ *
51
+ * @throws DatabaseException
52
+ * @throws ConnectionException
53
+ * @throws SphinxQLException
54
+ */
55
+ public static function rt_UpdateIndex (string $ index_name , array $ updateset );
56
+
57
+ /**
58
+ * Замещает (REPLACE) реалтайм-индекс по набору данных
59
+ * с созданием коннекшена "сейчас"
60
+ *
61
+ * @param string $index_name
62
+ * @param array $updateset
63
+ * @return ResultSetInterface|null
64
+ *
65
+ * @throws DatabaseException
66
+ * @throws ConnectionException
67
+ * @throws SphinxQLException
68
+ */
69
+ public static function rt_ReplaceIndex (string $ index_name , array $ updateset );
70
+
71
+ /**
72
+ * Удаляет строку реалтайм-индекса
73
+ * с созданием коннекшена "сейчас"
74
+ *
75
+ * @param string $index_name -- индекс
76
+ * @param string $field -- поле для поиска индекса
77
+ * @param null $field_value -- значение для поиска индекса
78
+ * @return ResultSetInterface|null
79
+ *
80
+ * @throws DatabaseException
81
+ * @throws ConnectionException
82
+ * @throws SphinxQLException
83
+ */
84
+ public static function rt_DeleteIndex (string $ index_name , string $ field , $ field_value = null );
85
+
86
+ /**
87
+ * @param PDO $pdo_connection
88
+ * @param string $sql_source_table
89
+ * @param string $sphinx_index
90
+ * @param Closure $make_updateset_method
91
+ * @param string $condition
92
+ * @return int
93
+ * @throws DatabaseException
94
+ * @throws ConnectionException
95
+ * @throws SphinxQLException
96
+ */
97
+ public static function rt_RebuildAbstractIndex (PDO $ pdo_connection , string $ sql_source_table , string $ sphinx_index , Closure $ make_updateset_method , string $ condition = '' );
98
+
99
+ /**
100
+ * Получает инстанс (для множественных обновлений)
101
+ *
102
+ * @return SphinxQL
103
+ */
104
+ public static function getInstance ();
105
+ }
0 commit comments