Version Notes
supporting more complex shop structures
- Added support for structures where store views map to languages in different search indexes within one website.
- Improved handling of empty deltas and permission problems when creating ZIPs.
Includes all earlier changes as described at:
https://github.com/boxalino/plugin-magento/releases
Download this release
Release Info
Developer | Szymon Nosal |
Extension | boxalino_plugin |
Version | 2.8.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.0.0 to 2.8.0
- app/code/local/Boxalino/CemSearch/Block/Autocomplete.php +131 -36
- app/code/local/Boxalino/CemSearch/Block/Cart/Crosssell.php +1 -1
- app/code/local/Boxalino/CemSearch/Block/Facets.php +319 -0
- app/code/local/Boxalino/CemSearch/Block/Head.php +0 -37
- app/code/local/Boxalino/CemSearch/Block/Product/List.php +49 -0
- app/code/local/Boxalino/CemSearch/Block/Product/List/Recommendation.php +120 -0
- app/code/local/Boxalino/CemSearch/Block/Product/List/Related.php +1 -10
- app/code/local/Boxalino/CemSearch/Block/Product/List/Upsell.php +1 -1
- app/code/local/Boxalino/CemSearch/Block/Script.php +29 -0
- app/code/local/Boxalino/CemSearch/CatalogSearch/Helper/Data.php +27 -0
- app/code/local/Boxalino/CemSearch/Helper/Data.php +97 -52
- app/code/local/Boxalino/CemSearch/Helper/P13n/Adapter.php +647 -29
- app/code/local/Boxalino/CemSearch/Helper/P13n/Client.php +0 -229
- app/code/local/Boxalino/CemSearch/Helper/P13n/Recommendation.php +33 -7
- app/code/local/Boxalino/CemSearch/Helper/P13n/Sort.php +1 -1
- app/code/local/Boxalino/CemSearch/Lib/P13nService.php +967 -632
- app/code/local/Boxalino/CemSearch/Lib/Types.php +5301 -4294
- app/code/local/Boxalino/CemSearch/Lib/vendor/Thrift/HttpP13n.php +8 -1
- app/code/local/Boxalino/CemSearch/Lib/vendor/Thrift/Protocol/TCompactProtocol.php +2 -1
- app/code/local/Boxalino/CemSearch/Model/Advanced.php +1 -1
- app/code/local/Boxalino/CemSearch/Model/Category.php +46 -0
- app/code/local/Boxalino/CemSearch/Model/Logger.php +44 -4
- app/code/local/Boxalino/CemSearch/Model/Observer.php +1 -1
- app/code/local/Boxalino/CemSearch/Model/Resource/Advanced.php +1 -1
- app/code/local/Boxalino/CemSearch/Model/Resource/Advanced/Collection.php +3 -3
- app/code/local/Boxalino/CemSearch/Model/Resource/Fulltext.php +185 -61
- app/code/local/Boxalino/CemSearch/controllers/AdvancedController.php +5 -4
- app/code/local/Boxalino/CemSearch/etc/config.xml +55 -1
- app/code/local/Boxalino/CemSearch/etc/system.xml +292 -5
- app/code/local/Boxalino/Exporter/Helper/Data.php +41 -19
- app/code/local/Boxalino/Exporter/Model/Mysql4/Indexer.php +413 -199
- app/code/local/Boxalino/Exporter/etc/config.xml +4 -0
- app/code/local/Boxalino/Exporter/etc/system.xml +37 -1
- app/design/frontend/base/default/layout/boxalino.xml +44 -12
- app/design/frontend/base/default/template/boxalino/catalogsearch/form.mini.phtml +16 -16
- app/design/frontend/base/default/template/boxalino/catalogsearch/relaxation_products.phtml +196 -0
- app/design/frontend/base/default/template/boxalino/catalogsearch/result.phtml +36 -0
- app/design/frontend/base/default/template/boxalino/head.phtml +0 -4
- app/design/frontend/base/default/template/boxalino/left_filters.phtml +17 -0
- app/design/frontend/base/default/template/boxalino/relaxation_suggestion.phtml +17 -0
- app/design/frontend/base/default/template/boxalino/script.phtml +33 -0
- app/design/frontend/base/default/template/boxalino/top_filters.phtml +12 -0
- app/etc/modules/Boxalino_CemSearch.xml +6 -6
- app/locale/de_DE/Boxalino.csv +4 -0
- app/locale/en_US/Boxalino.csv +4 -0
- app/locale/fr_FR/Boxalino.csv +4 -0
- package.xml +15 -9
- skin/frontend/base/default/css/boxalinoCemSearch.css +82 -48
- skin/frontend/base/default/js/boxalinoAutocomplete.js +92 -53
- skin/frontend/base/default/js/jquery-noConflict.js +1 -1
app/code/local/Boxalino/CemSearch/Block/Autocomplete.php
CHANGED
@@ -34,12 +34,13 @@ class Boxalino_CemSearch_Block_Autocomplete extends Mage_CatalogSearch_Block_Aut
|
|
34 |
{
|
35 |
protected $_suggestData = null;
|
36 |
protected $_suggestDataProducts = null;
|
37 |
-
|
|
|
38 |
|
39 |
protected function _toHtml()
|
40 |
{
|
41 |
|
42 |
-
if (Mage::getStoreConfig('Boxalino_General/general/enabled'
|
43 |
return null;
|
44 |
}
|
45 |
|
@@ -51,64 +52,137 @@ class Boxalino_CemSearch_Block_Autocomplete extends Mage_CatalogSearch_Block_Aut
|
|
51 |
|
52 |
$suggestData = $this->getSuggestData();
|
53 |
if (!($count = count($suggestData))) {
|
54 |
-
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
$count--;
|
|
|
|
|
|
|
58 |
|
59 |
-
$html = '<ul><li style="display:none"></li>';
|
60 |
foreach ($suggestData as $index => $item) {
|
61 |
if ($index == 0) {
|
62 |
$item['row_class'] .= ' first';
|
|
|
|
|
|
|
63 |
}
|
64 |
|
65 |
if ($index == $count) {
|
66 |
$item['row_class'] .= ' last';
|
67 |
}
|
|
|
|
|
|
|
|
|
68 |
|
69 |
-
$
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
-
$html .= '</ul
|
73 |
-
|
74 |
-
$
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
-
$html .= '<li data-word="' . $key . '" class="product-autocomplete ' . $class . '" title="' . $this->escapeHtml($product->getName()) . '">';
|
83 |
-
$html .= '<a href="' . $product->getProductUrl() . '" ><table><tr><td>';
|
84 |
-
$html .= '<img src="' . $product->getThumbnailUrl() . '" alt="' . $product->getName() . '" />';
|
85 |
-
$html .= '</td><td>';
|
86 |
-
$html .= '<span>' . $product->getName() . '</span>';
|
87 |
-
$html .= '</td></tr></table></a>';
|
88 |
-
$html .= '</li>';
|
89 |
}
|
90 |
-
|
91 |
}
|
92 |
|
93 |
$html .= '</ul>';
|
94 |
|
95 |
return $html;
|
|
|
96 |
}
|
97 |
|
98 |
-
|
99 |
{
|
100 |
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
return parent::getSuggestData();
|
103 |
}
|
104 |
|
105 |
if (!$this->_suggestData) {
|
106 |
$query = $this->helper('catalogsearch')->getQueryText();
|
107 |
-
$counter = 0;
|
108 |
-
$data = array();
|
109 |
-
|
110 |
-
$storeConfig = Mage::getStoreConfig('Boxalino_General/general');
|
111 |
|
|
|
|
|
112 |
$p13nConfig = new Boxalino_CemSearch_Helper_P13n_Config(
|
113 |
$storeConfig['host'],
|
114 |
Mage::helper('Boxalino_CemSearch')->getAccount(),
|
@@ -118,17 +192,31 @@ class Boxalino_CemSearch_Block_Autocomplete extends Mage_CatalogSearch_Block_Aut
|
|
118 |
);
|
119 |
$p13n = new Boxalino_CemSearch_Helper_P13n_Adapter($p13nConfig);
|
120 |
|
121 |
-
$generalConfig = Mage::getStoreConfig('Boxalino_General/search');
|
122 |
-
|
123 |
if ($query) {
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
$collection = $p13n->getAutocompleteEntities();
|
|
|
126 |
} else {
|
127 |
$collection = array();
|
128 |
}
|
129 |
|
|
|
|
|
130 |
foreach ($collection as $item) {
|
131 |
-
|
132 |
if ($item['hits'] <= 0) {
|
133 |
continue;
|
134 |
}
|
@@ -136,8 +224,10 @@ class Boxalino_CemSearch_Block_Autocomplete extends Mage_CatalogSearch_Block_Aut
|
|
136 |
$_data = array(
|
137 |
'id' => substr(md5($item['text']), 0, 10),
|
138 |
'title' => $item['text'],
|
|
|
139 |
'row_class' => (++$counter) % 2 ? 'odd' : 'even',
|
140 |
-
'num_of_results' => $item['hits']
|
|
|
141 |
);
|
142 |
|
143 |
if ($item['text'] == $query) {
|
@@ -146,12 +236,17 @@ class Boxalino_CemSearch_Block_Autocomplete extends Mage_CatalogSearch_Block_Aut
|
|
146 |
$data[] = $_data;
|
147 |
}
|
148 |
}
|
|
|
149 |
$this->_suggestData = $data;
|
150 |
-
$
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
return $this->_suggestData;
|
153 |
}
|
154 |
/*
|
155 |
*
|
156 |
-
|
157 |
}
|
34 |
{
|
35 |
protected $_suggestData = null;
|
36 |
protected $_suggestDataProducts = null;
|
37 |
+
protected $_order = array();
|
38 |
+
protected $_first = null;
|
39 |
|
40 |
protected function _toHtml()
|
41 |
{
|
42 |
|
43 |
+
if (Mage::getStoreConfig('Boxalino_General/general/enabled') == '0') {
|
44 |
return null;
|
45 |
}
|
46 |
|
52 |
|
53 |
$suggestData = $this->getSuggestData();
|
54 |
if (!($count = count($suggestData))) {
|
55 |
+
$html .= '<ul class="queries"><li>' . $this->helper('catalogsearch')->getQueryText() . '</li></ul>';
|
56 |
+
if (count($this->_suggestDataProducts)) {
|
57 |
+
$html .= $this->prepareDataProducts();
|
58 |
+
}
|
59 |
+
return $html;
|
60 |
}
|
61 |
|
62 |
$count--;
|
63 |
+
$catalogSearchHelper = Mage::helper('catalogsearch');
|
64 |
+
$autocompleteConfig = Mage::getStoreConfig('Boxalino_General/autocomplete_extra');
|
65 |
+
$resultUrl = $catalogSearchHelper->getResultUrl();
|
66 |
|
67 |
+
$html = '<ul class="queries"><li style="display:none"></li>';
|
68 |
foreach ($suggestData as $index => $item) {
|
69 |
if ($index == 0) {
|
70 |
$item['row_class'] .= ' first';
|
71 |
+
if (empty($this->_first)) {
|
72 |
+
$this->_first = $item['id'];
|
73 |
+
}
|
74 |
}
|
75 |
|
76 |
if ($index == $count) {
|
77 |
$item['row_class'] .= ' last';
|
78 |
}
|
79 |
+
$all = false;
|
80 |
+
if ($autocompleteConfig['enabled_for_all'] == '1') {
|
81 |
+
$all = true;
|
82 |
+
}
|
83 |
|
84 |
+
if ($autocompleteConfig['enabled'] && count($item['facets']) > 0 && (($all == false && $index == 0) || ($all && $index >= 0))) {
|
85 |
+
$html .= '<li data-word="' . $item['id'] . '" title="' . $this->escapeHtml($item['title']) . '" class="' . $item['row_class'] . '">'
|
86 |
+
. '<span class="query-title">' . $item['html'] . '</span><span class="amount">(' . $item['num_of_results'] . ')</span></li>';
|
87 |
+
|
88 |
+
$c = 0;
|
89 |
+
foreach ($item['facets'] as $facet) {
|
90 |
+
if ($c++ >= $autocompleteConfig['items']) {
|
91 |
+
break;
|
92 |
+
}
|
93 |
+
$dataWord = ($autocompleteConfig['products'] == '1') ? ' data-word="' . $facet['id'] . '"' : '';
|
94 |
+
$html .= '<a class="facet"' . $dataWord . ' title="' . $this->escapeHtml($item['title']) . '&bx_categories[0]=' . urlencode($facet['href']) . '" href="' . $resultUrl . '?q=' . $this->escapeHtml($item['title']) . '&bx_categories[0]=' . urlencode($facet['href']) . '"><li' . $dataWord . ' class="facet ' . $item['row_class'] . '" title="' . $this->escapeHtml($facet['title']) . '" ><span class="query-title">' . $this->escapeHtml($facet['title']) . '</span><span class="amount">(' . $facet['hits'] . ')</span></li></a>';
|
95 |
+
}
|
96 |
+
} else {
|
97 |
+
$html .= '<li data-word="' . $item['id'] . '" title="' . $this->escapeHtml($item['title']) . '" class="' . $item['row_class'] . '">'
|
98 |
+
. '<span class="query-title">' . $item['html'] . '</span><span class="amount">(' . $item['num_of_results'] . ')</span></li>';
|
99 |
+
}
|
100 |
}
|
101 |
+
$html .= '</ul>';
|
102 |
+
|
103 |
+
$html .= $this->prepareDataProducts();
|
104 |
+
|
105 |
+
return $html;
|
106 |
+
}
|
107 |
+
|
108 |
+
public function prepareDataProducts()
|
109 |
+
{
|
110 |
+
$html = '<ul class="products">';
|
111 |
+
|
112 |
+
foreach ($this->_suggestDataProducts as $prods) {
|
113 |
+
|
114 |
+
foreach ($prods as $prod) {
|
115 |
+
|
116 |
+
if (Mage::getStoreConfig('Boxalino_General/autocomplete_html/enabled') == '1') {
|
117 |
+
|
118 |
+
$product = Mage::getModel('catalog/product')->load($prod['id']);
|
119 |
+
if ($prod['hash'] == $this->_first || empty($this->_first)) {
|
120 |
+
$html .= '<li data-word="' . $prod['hash'] . '" class="product-autocomplete" title="' . $this->escapeHtml($product->getName()) . '">';
|
121 |
+
} else{
|
122 |
+
$html .= '<li style="display:none" data-word="' . $prod['hash'] . '" class="product-autocomplete" title="' . $this->escapeHtml($product->getName()) . '">';
|
123 |
+
}
|
124 |
+
$html .= '<a href="' . $product->getProductUrl() . '" >';
|
125 |
+
$html .= '<div class="product-image"><img src="' . $product->getThumbnailUrl() . '" alt="' . $product->getName() . '" /></div>';
|
126 |
+
$html .= '<div class="product-title"><span>' . $product->getName() . '</span></div>';
|
127 |
+
$html .= '</a>';
|
128 |
+
$html .= '</li>';
|
129 |
+
} else {
|
130 |
+
$html .= $this->prepareProductView($prod);
|
131 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
+
|
134 |
}
|
135 |
|
136 |
$html .= '</ul>';
|
137 |
|
138 |
return $html;
|
139 |
+
|
140 |
}
|
141 |
|
142 |
+
private function prepareProductView($product)
|
143 |
{
|
144 |
|
145 |
+
$html = '';
|
146 |
+
|
147 |
+
if ($product['hash'] == $this->_first || empty($this->_first)) {
|
148 |
+
$html .= '<li style="display:block" data-word="' . $product['hash'] . '" class="product-autocomplete" title="' . $this->escapeHtml($product['title']) . '">';
|
149 |
+
} else{
|
150 |
+
$html .= '<li style="display:none" data-word="' . $product['hash'] . '" class="product-autocomplete" title="' . $this->escapeHtml($product['title']) . '">';
|
151 |
+
}
|
152 |
+
|
153 |
+
$html .= '<a href="' . $product['url'] . '" >';
|
154 |
+
unset($product['url']);
|
155 |
+
unset($product['hash']);
|
156 |
+
unset($product[Mage::getStoreConfig('Boxalino_General/search/entity_id')]);
|
157 |
+
|
158 |
+
foreach($this->_order as $f) {
|
159 |
+
if ($f == 'image') {
|
160 |
+
$html .= '<div class="product-' . $f . '"><img src="' . $product[$f] . '" alt="' . $product['title'] . '" style="max-height:75px; max-width:75px;" /></div>';
|
161 |
+
} elseif (isset($product[$f])) {
|
162 |
+
$html .= '<div class="product-' . $f . '"><span>' . $product[$f] . '</span></div>';
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
$html .= '</a>';
|
167 |
+
$html .= '</li>';
|
168 |
+
|
169 |
+
return $html;
|
170 |
+
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
public function getSuggestData()
|
175 |
+
{
|
176 |
+
$storeConfig = Mage::getStoreConfig('Boxalino_General/general');
|
177 |
+
if ($storeConfig['enabled'] == '0') {
|
178 |
return parent::getSuggestData();
|
179 |
}
|
180 |
|
181 |
if (!$this->_suggestData) {
|
182 |
$query = $this->helper('catalogsearch')->getQueryText();
|
|
|
|
|
|
|
|
|
183 |
|
184 |
+
$htmlConfig = Mage::getStoreConfig('Boxalino_General/autocomplete_html');
|
185 |
+
$generalConfig = Mage::getStoreConfig('Boxalino_General/search');
|
186 |
$p13nConfig = new Boxalino_CemSearch_Helper_P13n_Config(
|
187 |
$storeConfig['host'],
|
188 |
Mage::helper('Boxalino_CemSearch')->getAccount(),
|
192 |
);
|
193 |
$p13n = new Boxalino_CemSearch_Helper_P13n_Adapter($p13nConfig);
|
194 |
|
|
|
|
|
195 |
if ($query) {
|
196 |
+
if ($htmlConfig['enabled'] == '1') {
|
197 |
+
$fields = array($generalConfig['entity_id'], 'title', 'score');
|
198 |
+
} else{
|
199 |
+
$fields = array($generalConfig['entity_id']);
|
200 |
+
$map = array($generalConfig['entity_id'] => $generalConfig['entity_id']);
|
201 |
+
$fi = explode(',', $htmlConfig['items']);
|
202 |
+
foreach($fi as $f) {
|
203 |
+
list($attribute, $fieldname) = explode(':', $f);
|
204 |
+
$fields[] = $fieldname;
|
205 |
+
$map[$fieldname] = $attribute;
|
206 |
+
$this->_order[] = $attribute;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
$p13n->autocomplete($query, $generalConfig['autocomplete_limit'], $generalConfig['autocomplete_products_limit'], $fields);
|
211 |
$collection = $p13n->getAutocompleteEntities();
|
212 |
+
$this->_first = $p13n->getPrefixSearchHash();
|
213 |
} else {
|
214 |
$collection = array();
|
215 |
}
|
216 |
|
217 |
+
$counter = 0;
|
218 |
+
$data = array();
|
219 |
foreach ($collection as $item) {
|
|
|
220 |
if ($item['hits'] <= 0) {
|
221 |
continue;
|
222 |
}
|
224 |
$_data = array(
|
225 |
'id' => substr(md5($item['text']), 0, 10),
|
226 |
'title' => $item['text'],
|
227 |
+
'html' => $item['html'],
|
228 |
'row_class' => (++$counter) % 2 ? 'odd' : 'even',
|
229 |
+
'num_of_results' => $item['hits'],
|
230 |
+
'facets' => $item['facets']
|
231 |
);
|
232 |
|
233 |
if ($item['text'] == $query) {
|
236 |
$data[] = $_data;
|
237 |
}
|
238 |
}
|
239 |
+
|
240 |
$this->_suggestData = $data;
|
241 |
+
if ($htmlConfig['enabled'] == '1') {
|
242 |
+
$this->_suggestDataProducts = $p13n->getAutocompleteProducts($data[0]['facets']);
|
243 |
+
} else {
|
244 |
+
$this->_suggestDataProducts = $p13n->getAutocompleteProducts($data[0]['facets'], $map, $fields);
|
245 |
+
}
|
246 |
}
|
247 |
return $this->_suggestData;
|
248 |
}
|
249 |
/*
|
250 |
*
|
251 |
+
*/
|
252 |
}
|
app/code/local/Boxalino/CemSearch/Block/Cart/Crosssell.php
CHANGED
@@ -22,7 +22,7 @@ class Boxalino_CemSearch_Block_Cart_Crosssell extends Mage_Checkout_Block_Cart_C
|
|
22 |
public function getItems()
|
23 |
{
|
24 |
|
25 |
-
if (Mage::getStoreConfig('Boxalino_General/general/enabled'
|
26 |
return parent::getItems();
|
27 |
}
|
28 |
$name = Mage::getStoreConfig('Boxalino_Recommendation/cart/widget');
|
22 |
public function getItems()
|
23 |
{
|
24 |
|
25 |
+
if (Mage::getStoreConfig('Boxalino_General/general/enabled') == 0) {
|
26 |
return parent::getItems();
|
27 |
}
|
28 |
$name = Mage::getStoreConfig('Boxalino_Recommendation/cart/widget');
|
app/code/local/Boxalino/CemSearch/Block/Facets.php
ADDED
@@ -0,0 +1,319 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Boxalino_CemSearch_Block_Facets extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
/** @var array */
|
6 |
+
private $_allFilters = array();
|
7 |
+
|
8 |
+
/** @var array */
|
9 |
+
public $maxLevel = array();
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
$this->_allFilters = Mage::helper('Boxalino_CemSearch')->getSearchAdapter()->getFacetsData();
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Gets the current URL without filters
|
18 |
+
*
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
public function getResetUrl()
|
22 |
+
{
|
23 |
+
/** @var $helper Mage_Core_Helper_Url */
|
24 |
+
$helper = Mage::helper('core/url');
|
25 |
+
|
26 |
+
// get current url
|
27 |
+
$url = $helper->getCurrentUrl();
|
28 |
+
|
29 |
+
// parse url
|
30 |
+
$parsedUrl = parse_url($url);
|
31 |
+
|
32 |
+
// build url
|
33 |
+
$url = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $parsedUrl['path'];
|
34 |
+
|
35 |
+
// get query parameters
|
36 |
+
if (isset($parsedUrl['query'])) {
|
37 |
+
parse_str($parsedUrl['query'], $q);
|
38 |
+
|
39 |
+
// remove bx filters
|
40 |
+
foreach ($q as $k => $v) {
|
41 |
+
if (strpos($k, 'bx_') === 0) {
|
42 |
+
unset($q[$k]);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
// append query string
|
47 |
+
if ($q) {
|
48 |
+
$url .= '?' . http_build_query($q);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
// return url
|
53 |
+
return $url;
|
54 |
+
}
|
55 |
+
|
56 |
+
public function getTopFilters()
|
57 |
+
{
|
58 |
+
$filters = array();
|
59 |
+
$topFilters = explode(',', Mage::getStoreConfig('Boxalino_General/filter/top_filters'));
|
60 |
+
$titles = explode(',', Mage::getStoreConfig('Boxalino_General/filter/top_filters_title'));
|
61 |
+
$i = 0;
|
62 |
+
$allFilters = $this->_allFilters;
|
63 |
+
foreach ($topFilters as $filter) {
|
64 |
+
if (isset($allFilters[$filter])) {
|
65 |
+
foreach ($allFilters[$filter] as $key => $values) {
|
66 |
+
$yes = strtolower($values['stringValue']) == 'yes'?true:false;
|
67 |
+
if ($values['stringValue'] == 1 || $yes) {
|
68 |
+
$filters[$filter] = $allFilters[$filter][$key];
|
69 |
+
$filters[$filter]['title'] = $titles[$i];
|
70 |
+
$filters[$filter]['url'] = $this->getTopFilterUrl($filter, $yes?$values['stringValue']:'1', $allFilters[$filter][$key]['selected']);
|
71 |
+
$filters[$filter]['selected'] = $allFilters[$filter][$key]['selected'];
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
$i++;
|
76 |
+
}
|
77 |
+
return $filters;
|
78 |
+
}
|
79 |
+
|
80 |
+
private function getTopFilterUrl($name, $value, $selected)
|
81 |
+
{
|
82 |
+
$multioption = Mage::getStoreConfig('Boxalino_General/filter/top_filters_multioption');
|
83 |
+
$currentUrl = urldecode(Mage::helper('core/url')->getCurrentUrl());
|
84 |
+
if (strpos($currentUrl, '?') === FALSE) {
|
85 |
+
$currentUrl .= '?';
|
86 |
+
}
|
87 |
+
if ($multioption == true) {
|
88 |
+
if ($selected === false) {
|
89 |
+
$url = $currentUrl . '&bx_' . $name . '[0]' . '=' . $value;
|
90 |
+
} else {
|
91 |
+
$url = str_replace('&bx_' . $name . '[0]' . '=' . $value, '', $currentUrl);
|
92 |
+
}
|
93 |
+
} else {
|
94 |
+
$topFilters = explode(',', Mage::getStoreConfig('Boxalino_General/filter/top_filters'));
|
95 |
+
if ($selected === false) {
|
96 |
+
foreach ($topFilters as $filter) {
|
97 |
+
$currentUrl = str_replace('&bx_' . $filter . '[0]' . '=' . $value, '', $currentUrl);
|
98 |
+
}
|
99 |
+
$url = $currentUrl . '&bx_' . $name . '[0]' . '=' . urlencode($value);
|
100 |
+
} else {
|
101 |
+
$url = str_replace('&bx_' . $name . '[0]' . '=' . urlencode($value), '', $currentUrl);
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
return $url;
|
106 |
+
}
|
107 |
+
|
108 |
+
public function getLeftFilters()
|
109 |
+
{
|
110 |
+
$filters = array();
|
111 |
+
$leftFilters = explode(',', Mage::getStoreConfig('Boxalino_General/filter/left_filters_normal'));
|
112 |
+
$leftFiltersTitles = explode(',', Mage::getStoreConfig('Boxalino_General/filter/left_filters_normal_title'));
|
113 |
+
$i = 0;
|
114 |
+
$allFilters = $this->_allFilters;
|
115 |
+
foreach ($leftFilters as $filterString) {
|
116 |
+
$position = 0;
|
117 |
+
$filter = explode(':', $filterString);
|
118 |
+
$filters[$filter[0]] = array('title' => $leftFiltersTitles[$i], 'values' => array());
|
119 |
+
if (isset($allFilters[$filter[0]])) {
|
120 |
+
if ($filter[1] == 'hierarchical') {
|
121 |
+
$filters[$filter[0]]['values'] = $this->returnTree($filter[0]);
|
122 |
+
} else {
|
123 |
+
foreach ($allFilters[$filter[0]] as $key => $values) {
|
124 |
+
$filters[$filter[0]]['values'][] = $this->returnImportantValues($values, $filter[1], $filter[0], $position);
|
125 |
+
$position++;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
+
if (count($filters[$filter[0]]['values']) == 0) {
|
130 |
+
unset($filters[$filter[0]]);
|
131 |
+
}
|
132 |
+
$i++;
|
133 |
+
}
|
134 |
+
return $filters;
|
135 |
+
}
|
136 |
+
|
137 |
+
private function returnTree($filter)
|
138 |
+
{
|
139 |
+
$results = array();
|
140 |
+
$parents = $this->returnHierarchy($filter);
|
141 |
+
$level = 0;
|
142 |
+
if ($parents['display']['level'] == 2) {
|
143 |
+
$results = $parents['values'][$parents['display']['level']];
|
144 |
+
return $results;
|
145 |
+
} else {
|
146 |
+
$highestChild = array();
|
147 |
+
$level = $parents['display']['level'];
|
148 |
+
$parentId = 0;
|
149 |
+
if (isset($parents['values'][$level])) {
|
150 |
+
$highestLevelCount = count($parents['values'][$level]);
|
151 |
+
foreach ($parents['values'][$level] as $value) {
|
152 |
+
$parentId = $parents['display']['parentId'];
|
153 |
+
if ($value['parentId'] == $parentId) {
|
154 |
+
if ($highestLevelCount == 1) {
|
155 |
+
$value['selected'] = true;
|
156 |
+
}
|
157 |
+
$value['level'] = $level;
|
158 |
+
$highestChild[] = $value;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
} else {
|
162 |
+
$level = $level - 1;
|
163 |
+
foreach ($parents['values'][$level] as $value) {
|
164 |
+
if ($value['selected'] == true) {
|
165 |
+
$parentId = $value['parentId'];
|
166 |
+
$value['level'] = $level;
|
167 |
+
$highestChild[] = $value;
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
foreach ($parents['values'][$level] as $value) {
|
172 |
+
if ($parentId == $value['parentId'] && $value['selected'] == false) {
|
173 |
+
$value['level'] = $level;
|
174 |
+
$highestChild[] = $value;
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
for ($i = $level - 1; $i >= 2; $i--) {
|
180 |
+
$parents['values'][$i][$parentId]['selected'] = true;
|
181 |
+
$parents['values'][$i][$parentId]['level'] = $i;
|
182 |
+
$results[] = $parents['values'][$i][$parentId];
|
183 |
+
$parentId = $parents['values'][$i][$parentId]['parentId'];
|
184 |
+
}
|
185 |
+
$results = array_reverse($results);
|
186 |
+
|
187 |
+
|
188 |
+
}
|
189 |
+
$results = array_merge($results, $highestChild);
|
190 |
+
$this->setMaxLevel($filter, $level);
|
191 |
+
return $results;
|
192 |
+
}
|
193 |
+
|
194 |
+
private function returnHierarchy($filter)
|
195 |
+
{
|
196 |
+
$whatToDisplay = array('level' => 2, 'parentId' => '');
|
197 |
+
$parents = array();
|
198 |
+
$values = $this->_allFilters[$filter];
|
199 |
+
|
200 |
+
$amount = count($values);
|
201 |
+
for ($i = 0; $i < $amount; $i++) {
|
202 |
+
$parentLevel = count($values[$i]['hierarchy']);
|
203 |
+
for ($j = $i + 1; $j < $amount; $j++) {
|
204 |
+
if ($parentLevel < count($values[$j]['hierarchy'])) {
|
205 |
+
$level = count($values[$j]['hierarchy']);
|
206 |
+
$childId = $values[$j]['hierarchyId'];
|
207 |
+
$parents[$level][$childId] = array(
|
208 |
+
'stringValue' => end($values[$j]['hierarchy']),
|
209 |
+
'hitCount' => $values[$j]['hitCount'],
|
210 |
+
'parentId' => $values[$i]['hierarchyId'],
|
211 |
+
'url' => $this->getFilterUrl($filter, $values[$j]['stringValue'], $values[$j]['selected'], false, 0),
|
212 |
+
'selected' => $values[$j]['selected']
|
213 |
+
);
|
214 |
+
if ($values[$j]['selected'] === true) {
|
215 |
+
$whatToDisplay = array('level' => $level + 1, 'parentId' => $values[$j]['hierarchyId']);
|
216 |
+
}
|
217 |
+
continue;
|
218 |
+
}
|
219 |
+
if (count($values[$i]['hierarchy']) == count($values[$j]['hierarchy'])) {
|
220 |
+
break;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
}
|
224 |
+
return array('values' => $parents, 'display' => $whatToDisplay);
|
225 |
+
}
|
226 |
+
|
227 |
+
private function getFilterUrl($name, $value, $selected, $ranged = false, $position = 0, $hierarchical = null)
|
228 |
+
{
|
229 |
+
$multioption = Mage::getStoreConfig('Boxalino_General/filter/left_filters_multioption');
|
230 |
+
$currentUrl = urldecode(Mage::helper('core/url')->getCurrentUrl());
|
231 |
+
if (strpos($currentUrl, '?') === FALSE) {
|
232 |
+
$currentUrl .= '?';
|
233 |
+
}
|
234 |
+
if (!$ranged) {
|
235 |
+
if ($multioption == true && $hierarchical == null) {
|
236 |
+
if ($selected === false) {
|
237 |
+
$url = $currentUrl . '&bx_' . $name . '[' . $position . ']' . '=' . urlencode($value);
|
238 |
+
} else {
|
239 |
+
$url = str_replace('&bx_' . $name . '[' . $position . ']' . '=' . urlencode($value), '', $currentUrl);
|
240 |
+
}
|
241 |
+
} else {
|
242 |
+
$position = 0;
|
243 |
+
if ($selected === false) {
|
244 |
+
if (isset($_REQUEST['bx_' . $name])) {
|
245 |
+
foreach ($_REQUEST['bx_' . $name] as $val) {
|
246 |
+
$currentUrl = str_replace('&bx_' . $name . '[' . $position . ']' . '=' . urlencode($val), '', $currentUrl);
|
247 |
+
}
|
248 |
+
}
|
249 |
+
$url = $currentUrl . '&bx_' . $name . '[' . $position . ']' . '=' . urlencode($value);
|
250 |
+
} else {
|
251 |
+
$url = str_replace('&bx_' . $name . '[' . $position . ']' . '=' . urlencode($value), '', $currentUrl);
|
252 |
+
}
|
253 |
+
}
|
254 |
+
} else {
|
255 |
+
if ($selected === false) {
|
256 |
+
$url = $currentUrl . '&bx_' . $name . '[' . $position . ']' . '=' . $value['from'] . '-' . $value['to'];
|
257 |
+
} else {
|
258 |
+
$url = str_replace('&bx_' . $name . '[' . $position . ']' . '=' . $value['from'] . '-' . $value['to'], '', $currentUrl);
|
259 |
+
}
|
260 |
+
}
|
261 |
+
return $url;
|
262 |
+
}
|
263 |
+
|
264 |
+
private function returnImportantValues($values, $option, $filter, $position)
|
265 |
+
{
|
266 |
+
$data = array();
|
267 |
+
if ($option == 'ranged') {
|
268 |
+
$data['stringValue'] = array('min' => $values['rangeFromInclusive'], 'max' => $values['rangeToExclusive']);
|
269 |
+
$data['url'] = $this->getFilterUrl($filter, array('from' => $values['rangeFromInclusive'], 'to' => $values['rangeToExclusive']), $values['selected'], true, $position);
|
270 |
+
} else {
|
271 |
+
$data['url'] = $this->getFilterUrl($filter, $values['stringValue'], $values['selected'], false, $position);
|
272 |
+
$data['stringValue'] = $values['stringValue'];
|
273 |
+
}
|
274 |
+
$data['hitCount'] = $values['hitCount'];
|
275 |
+
$data['selected'] = $values['selected'];
|
276 |
+
return $data;
|
277 |
+
}
|
278 |
+
|
279 |
+
public function removeFilterFromUrl($url, $filter, $vals)
|
280 |
+
{
|
281 |
+
if (isset($_REQUEST['bx_' . $filter])) {
|
282 |
+
foreach ($vals as $val) {
|
283 |
+
$key = array_search($val, $_REQUEST['bx_' . $filter]);
|
284 |
+
if ($key !== false) {
|
285 |
+
$filterKey = 'bx_' . $filter . '[' . $key . ']';
|
286 |
+
|
287 |
+
// remove filter from url
|
288 |
+
$url = str_replace($filterKey . '=' . $vals[$key], '', $url);
|
289 |
+
$url = str_replace(urlencode($filterKey) . '=' . urlencode($vals[$key]), '', $url);
|
290 |
+
|
291 |
+
// remove resulting duplicate ampersands
|
292 |
+
$url = trim(str_replace(array('?&', '&&'), array('?', '&'), $url), ' ?&');
|
293 |
+
}
|
294 |
+
}
|
295 |
+
}
|
296 |
+
return $url;
|
297 |
+
}
|
298 |
+
|
299 |
+
public function getMinMaxValues($values)
|
300 |
+
{
|
301 |
+
$first = $values[0];
|
302 |
+
$last = end($values);
|
303 |
+
return array('min' => round(floor($first['stringValue']['min']), -2), 'max' => round(ceil($last['stringValue']['max'])), 1);
|
304 |
+
}
|
305 |
+
|
306 |
+
private function setMaxLevel($filter, $level)
|
307 |
+
{
|
308 |
+
$this->maxLevel[$filter] = $level;
|
309 |
+
}
|
310 |
+
|
311 |
+
public function getMaxLevel($filter)
|
312 |
+
{
|
313 |
+
if (isset($this->maxLevel[$filter])) {
|
314 |
+
return $this->maxLevel[$filter];
|
315 |
+
}
|
316 |
+
|
317 |
+
return 0;
|
318 |
+
}
|
319 |
+
}
|
app/code/local/Boxalino/CemSearch/Block/Head.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Boxalino_CemSearch_Block_Head extends Boxalino_CemSearch_Block_Abstract
|
4 |
-
{
|
5 |
-
public function printScripts()
|
6 |
-
{
|
7 |
-
$enabled = Mage::getStoreConfig('Boxalino_General/tracker/enabled');
|
8 |
-
if ($enabled == 1) {
|
9 |
-
$session = Mage::getSingleton('Boxalino_CemSearch_Model_Session');
|
10 |
-
$scripts = $session->getScripts(false);
|
11 |
-
Mage::helper('Boxalino_CemSearch')->scriptBegin();
|
12 |
-
|
13 |
-
foreach ($scripts as $script) {
|
14 |
-
echo $script;
|
15 |
-
}
|
16 |
-
$session->clearScripts();
|
17 |
-
|
18 |
-
echo Mage::helper('Boxalino_CemSearch')->reportPageView();
|
19 |
-
|
20 |
-
$route = Mage::app()->getFrontController()->getRequest()->getRouteName();
|
21 |
-
$controller = Mage::app()->getFrontController()->getRequest()->getControllerName();
|
22 |
-
if ($route == 'catalogsearch' && $controller == 'result') {
|
23 |
-
echo Mage::helper('Boxalino_CemSearch')->reportSearch($_GET['q'], Mage::helper('Boxalino_CemSearch')->getFiltersValues($_GET));
|
24 |
-
}
|
25 |
-
|
26 |
-
|
27 |
-
Mage::helper('Boxalino_CemSearch')->scriptEnd();
|
28 |
-
} else {
|
29 |
-
return '';
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
public function addExternalJS($args)
|
34 |
-
{
|
35 |
-
echo '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>';
|
36 |
-
}
|
37 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Boxalino/CemSearch/Block/Product/List.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Boxalino_CemSearch_Block_Product_List extends Mage_Catalog_Block_Product_List
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Retrieve loaded category collection
|
7 |
+
*
|
8 |
+
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
9 |
+
*/
|
10 |
+
protected function _getProductCollection()
|
11 |
+
{
|
12 |
+
if (Mage::getStoreConfig('Boxalino_General/general/enabled') == 0) {
|
13 |
+
return parent::_getProductCollection();
|
14 |
+
}
|
15 |
+
|
16 |
+
// make sure to only use products which are in the current category
|
17 |
+
if ($category = Mage::registry('current_category')) {
|
18 |
+
if (!$category->getIsAnchor()) {
|
19 |
+
return parent::_getProductCollection();
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
if (is_null($this->_productCollection)) {
|
24 |
+
$entity_ids = Mage::helper('Boxalino_CemSearch')->getSearchAdapter()->getEntitiesIds();
|
25 |
+
|
26 |
+
$this->_productCollection = Mage::getResourceModel('catalog/product_collection');
|
27 |
+
|
28 |
+
// Added check if there are any entity ids, otherwise force empty result
|
29 |
+
if (count($entity_ids) == 0) {
|
30 |
+
$entity_ids = array(0);
|
31 |
+
}
|
32 |
+
$this->_productCollection->addFieldToFilter('entity_id', $entity_ids)
|
33 |
+
->addAttributeToSelect('*');
|
34 |
+
|
35 |
+
// enforce boxalino ranking
|
36 |
+
$this->_productCollection->getSelect()->order(new Zend_Db_Expr('FIELD(e.entity_id,' . implode(',', $entity_ids).')'));
|
37 |
+
|
38 |
+
if (Mage::helper('catalog')->isModuleEnabled('Mage_Checkout')) {
|
39 |
+
Mage::getResourceSingleton('checkout/cart')->addExcludeProductFilter($this->_productCollection,
|
40 |
+
Mage::getSingleton('checkout/session')->getQuoteId()
|
41 |
+
);
|
42 |
+
$this->_addProductAttributesAndPrices($this->_productCollection);
|
43 |
+
}
|
44 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_productCollection);
|
45 |
+
}
|
46 |
+
|
47 |
+
return $this->_productCollection;
|
48 |
+
}
|
49 |
+
}
|
app/code/local/Boxalino/CemSearch/Block/Product/List/Recommendation.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by: Simon Rupf <simon.rupf@boxalino.com>
|
4 |
+
* Created at: 15.04.2015 15:52
|
5 |
+
*/
|
6 |
+
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Catalog product related items block
|
10 |
+
*
|
11 |
+
* @category Boxalino
|
12 |
+
* @package Boxalino_CemSearch
|
13 |
+
* @author Simon Rupf <simon.rupf@boxalino.com>
|
14 |
+
*/
|
15 |
+
class Boxalino_CemSearch_Block_Product_List_Recommendation extends Mage_Catalog_Block_Product_Abstract
|
16 |
+
{
|
17 |
+
protected $_itemCollection;
|
18 |
+
protected $_recommendationName = '';
|
19 |
+
protected $_recommendationAmount = 3;
|
20 |
+
protected $_recommendationContext = array();
|
21 |
+
protected $_recommendationParameterValues = array();
|
22 |
+
|
23 |
+
public function configure($name, $amount = 3, $context = array(), $parameterValues = array())
|
24 |
+
{
|
25 |
+
$this->_recommendationName = $name;
|
26 |
+
$this->_recommendationAmount = $amount;
|
27 |
+
$this->_recommendationContext = $context;
|
28 |
+
$this->_recommendationParameterValues = $parameterValues;
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function _prepareData()
|
32 |
+
{
|
33 |
+
if (
|
34 |
+
Mage::getStoreConfig('Boxalino_General/general/enabled') == 0 ||
|
35 |
+
Mage::getStoreConfig('Boxalino_Recommendation/related/status', 0) == 0
|
36 |
+
) {
|
37 |
+
return parent::_prepareData();
|
38 |
+
}
|
39 |
+
|
40 |
+
if (isset($this->_recommendationContext['id'])) {
|
41 |
+
$_REQUEST['productId'] = $this->_recommendationContext['id'];
|
42 |
+
} elseif (count($this->_recommendationContext)) {
|
43 |
+
$_REQUEST['p13nRequestContext'] = $this->_recommendationContext;
|
44 |
+
foreach($_REQUEST['p13nRequestContext'] as $k => $v) {
|
45 |
+
if($v == '') {
|
46 |
+
switch($k) {
|
47 |
+
case 'id':
|
48 |
+
$_REQUEST['p13nRequestContext'][$k] = Mage::registry('product')->getId();
|
49 |
+
break;
|
50 |
+
case 'category':
|
51 |
+
$_REQUEST['p13nRequestContext'][$k] = Mage::registry('current_category');
|
52 |
+
break;
|
53 |
+
default:
|
54 |
+
if(isset($this->$_recommendationParameterValues[$k])) {
|
55 |
+
$_REQUEST['p13nRequestContext'][$k] = $this->_recommendationParameterValues[$k];
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
$p13nRecommendation = Boxalino_CemSearch_Helper_P13n_Recommendation::Instance();
|
63 |
+
|
64 |
+
$response = $p13nRecommendation->getRecommendation(
|
65 |
+
'free', $this->_recommendationName, $this->_recommendationAmount
|
66 |
+
);
|
67 |
+
$entityIds = array();
|
68 |
+
|
69 |
+
if ($response === null) {
|
70 |
+
$this->_itemCollection = new Varien_Data_Collection();
|
71 |
+
return $this;
|
72 |
+
}
|
73 |
+
|
74 |
+
foreach ($response as $item) {
|
75 |
+
$entityIds[] = $item[Mage::getStoreConfig('Boxalino_General/search/entity_id')];
|
76 |
+
}
|
77 |
+
|
78 |
+
$this->_itemCollection = Mage::getResourceModel('catalog/product_collection')
|
79 |
+
->addFieldToFilter('entity_id', $entityIds)
|
80 |
+
->addAttributeToSelect('*');
|
81 |
+
|
82 |
+
if (Mage::helper('catalog')->isModuleEnabled('Mage_Checkout')) {
|
83 |
+
Mage::getResourceSingleton('checkout/cart')->addExcludeProductFilter(
|
84 |
+
$this->_itemCollection,
|
85 |
+
Mage::getSingleton('checkout/session')->getQuoteId()
|
86 |
+
);
|
87 |
+
$this->_addProductAttributesAndPrices($this->_itemCollection);
|
88 |
+
}
|
89 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
|
90 |
+
|
91 |
+
$this->_itemCollection->load();
|
92 |
+
|
93 |
+
foreach ($this->_itemCollection as $product) {
|
94 |
+
$product->setDoNotUseCategoryId(true);
|
95 |
+
}
|
96 |
+
|
97 |
+
return $this;
|
98 |
+
}
|
99 |
+
|
100 |
+
protected function _beforeToHtml()
|
101 |
+
{
|
102 |
+
$this->_prepareData();
|
103 |
+
return parent::_beforeToHtml();
|
104 |
+
}
|
105 |
+
|
106 |
+
public function getItems()
|
107 |
+
{
|
108 |
+
return $this->_itemCollection;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Get tags array for saving cache
|
113 |
+
*
|
114 |
+
* @return array
|
115 |
+
*/
|
116 |
+
public function getCacheTags()
|
117 |
+
{
|
118 |
+
return array_merge(parent::getCacheTags(), $this->getItemsTags($this->getItems()));
|
119 |
+
}
|
120 |
+
}
|
app/code/local/Boxalino/CemSearch/Block/Product/List/Related.php
CHANGED
@@ -6,19 +6,10 @@
|
|
6 |
*/
|
7 |
class Boxalino_CemSearch_Block_Product_List_Related extends Mage_Catalog_Block_Product_List_Related
|
8 |
{
|
9 |
-
/**
|
10 |
-
* Default MAP renderer type
|
11 |
-
*
|
12 |
-
* @var string
|
13 |
-
*/
|
14 |
-
protected $_mapRenderer = 'msrp_noform';
|
15 |
-
|
16 |
-
protected $_itemCollection;
|
17 |
-
|
18 |
protected function _prepareData()
|
19 |
{
|
20 |
|
21 |
-
if (Mage::getStoreConfig('Boxalino_General/general/enabled'
|
22 |
return parent::_prepareData();
|
23 |
}
|
24 |
$name = Mage::getStoreConfig('Boxalino_Recommendation/related/widget');
|
6 |
*/
|
7 |
class Boxalino_CemSearch_Block_Product_List_Related extends Mage_Catalog_Block_Product_List_Related
|
8 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
protected function _prepareData()
|
10 |
{
|
11 |
|
12 |
+
if (Mage::getStoreConfig('Boxalino_General/general/enabled') == 0 || Mage::getStoreConfig('Boxalino_Recommendation/related/status', 0) == 0) {
|
13 |
return parent::_prepareData();
|
14 |
}
|
15 |
$name = Mage::getStoreConfig('Boxalino_Recommendation/related/widget');
|
app/code/local/Boxalino/CemSearch/Block/Product/List/Upsell.php
CHANGED
@@ -18,7 +18,7 @@ class Boxalino_CemSearch_Block_Product_List_Upsell extends Mage_Catalog_Block_Pr
|
|
18 |
protected function _prepareData()
|
19 |
{
|
20 |
|
21 |
-
if (Mage::getStoreConfig('Boxalino_General/general/enabled'
|
22 |
return parent::_prepareData();
|
23 |
}
|
24 |
$name = Mage::getStoreConfig('Boxalino_Recommendation/upsell/widget');
|
18 |
protected function _prepareData()
|
19 |
{
|
20 |
|
21 |
+
if (Mage::getStoreConfig('Boxalino_General/general/enabled') == 0 || Mage::getStoreConfig('Boxalino_Recommendation/upsell/status', 0) == 0) {
|
22 |
return parent::_prepareData();
|
23 |
}
|
24 |
$name = Mage::getStoreConfig('Boxalino_Recommendation/upsell/widget');
|
app/code/local/Boxalino/CemSearch/Block/Script.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Boxalino_CemSearch_Block_Script extends Boxalino_CemSearch_Block_Abstract
|
4 |
+
{
|
5 |
+
public function isEnabled()
|
6 |
+
{
|
7 |
+
return (bool)Mage::getStoreConfig('Boxalino_General/tracker/enabled');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getScripts()
|
11 |
+
{
|
12 |
+
$html = '';
|
13 |
+
$session = Mage::getSingleton('Boxalino_CemSearch_Model_Session');
|
14 |
+
$scripts = $session->getScripts(false);
|
15 |
+
|
16 |
+
foreach ($scripts as $script) {
|
17 |
+
$html .= $script;
|
18 |
+
}
|
19 |
+
$session->clearScripts();
|
20 |
+
|
21 |
+
return $html;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function isSearch()
|
25 |
+
{
|
26 |
+
$current = $this->getRequest()->getRouteName() . '/' . $this->getRequest()->getControllerName();
|
27 |
+
return $current == 'catalogsearch/result';
|
28 |
+
}
|
29 |
+
}
|
app/code/local/Boxalino/CemSearch/CatalogSearch/Helper/Data.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Boxalino_CemSearch_CatalogSearch_Helper_Data extends Mage_CatalogSearch_Helper_Data
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_urlForSearch;
|
7 |
+
|
8 |
+
public function setUrlForSearch($queryText)
|
9 |
+
{
|
10 |
+
$this->_urlForSearch = $queryText;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getUrlForSearch()
|
14 |
+
{
|
15 |
+
|
16 |
+
if (strlen($this->_urlForSearch) == 0) {
|
17 |
+
return $this->getEscapedQueryText();
|
18 |
+
}
|
19 |
+
|
20 |
+
return $this->_urlForSearch;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function setQueryText($text)
|
24 |
+
{
|
25 |
+
$this->_queryText = $text;
|
26 |
+
}
|
27 |
+
}
|
app/code/local/Boxalino/CemSearch/Helper/Data.php
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
<?php
|
|
|
2 |
class Boxalino_CemSearch_Helper_Data extends Mage_Core_Helper_Data
|
3 |
{
|
|
|
|
|
4 |
|
5 |
public function __construct()
|
6 |
{
|
@@ -10,7 +13,7 @@ class Boxalino_CemSearch_Helper_Data extends Mage_Core_Helper_Data
|
|
10 |
|
11 |
public static function __loadClass($name)
|
12 |
{
|
13 |
-
if(strpos($name, 'Thrift\\') !== false){
|
14 |
try {
|
15 |
include_once(Mage::getModuleDir('', 'Boxalino_CemSearch') . '/Lib/vendor/' . str_replace('\\', '/', $name) . '.php');
|
16 |
} catch (Exception $e) {
|
@@ -70,20 +73,9 @@ class Boxalino_CemSearch_Helper_Data extends Mage_Core_Helper_Data
|
|
70 |
return ($trackSales == 1);
|
71 |
}
|
72 |
|
73 |
-
public function reportPageView()
|
74 |
-
{
|
75 |
-
if ($this->isAnalyticsEnabled()) {
|
76 |
-
$script = "_bxq.push(['trackPageView']);" . PHP_EOL;
|
77 |
-
return $script;
|
78 |
-
} else {
|
79 |
-
return '';
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
public function isAnalyticsEnabled()
|
84 |
{
|
85 |
-
|
86 |
-
return ($trackSales == 1);
|
87 |
}
|
88 |
|
89 |
public function reportSearch($term, $filters = null)
|
@@ -137,7 +129,6 @@ class Boxalino_CemSearch_Helper_Data extends Mage_Core_Helper_Data
|
|
137 |
}
|
138 |
}
|
139 |
|
140 |
-
|
141 |
/**
|
142 |
* @param $products array example:
|
143 |
* <code>
|
@@ -190,63 +181,38 @@ class Boxalino_CemSearch_Helper_Data extends Mage_Core_Helper_Data
|
|
190 |
return $account;
|
191 |
}
|
192 |
|
193 |
-
public function scriptBegin()
|
194 |
-
{
|
195 |
-
$account = Mage::getStoreConfig('Boxalino_General/general/di_account');
|
196 |
-
|
197 |
-
$script = '<script type="text/javascript">' . PHP_EOL;
|
198 |
-
$script .= 'var _bxq = _bxq || [];' . PHP_EOL;
|
199 |
-
$script .= "_bxq.push(['setAccount', '" . $account . "']);" . PHP_EOL;
|
200 |
-
|
201 |
-
echo $script;
|
202 |
-
}
|
203 |
-
|
204 |
-
public function scriptEnd()
|
205 |
-
{
|
206 |
-
$script = "(function(){
|
207 |
-
var s = document.createElement('script');
|
208 |
-
s.async = 1;
|
209 |
-
s.src = '//cdn.bx-cloud.com/frontend/rc/js/ba.min.js';
|
210 |
-
document.getElementsByTagName('head')[0].appendChild(s);
|
211 |
-
})();" . PHP_EOL;
|
212 |
-
|
213 |
-
$script .= '</script>' . PHP_EOL;
|
214 |
-
|
215 |
-
echo $script;
|
216 |
-
}
|
217 |
-
|
218 |
public function getFiltersValues($params)
|
219 |
{
|
220 |
$filters = new stdClass();
|
221 |
-
if(isset($params['cat'])) {
|
222 |
$filters->filter_hc_category = '';
|
223 |
$category = Mage::getModel('catalog/category')->load($params['cat']);
|
224 |
$categories = explode('/', $category->getPath());
|
225 |
foreach ($categories as $cat) {
|
226 |
$name = $category = Mage::getModel('catalog/category')->load($cat)->getName();
|
227 |
-
if(strpos($name, '/') !== false) {
|
228 |
$name = str_replace('/', '\/', $name);
|
229 |
}
|
230 |
-
$filters->filter_hc_category .= '/'
|
231 |
|
232 |
}
|
233 |
unset($params['cat']);
|
234 |
}
|
235 |
|
236 |
-
if(isset($params['price'])) {
|
237 |
$prices = explode('-', $params['price']);
|
238 |
-
if(!empty($prices[0])) {
|
239 |
$filters->filter_from_incl_price = $prices[0];
|
240 |
}
|
241 |
-
if(!empty($prices[1])) {
|
242 |
$filters->filter_to_incl_price = $prices[1];
|
243 |
}
|
244 |
unset($params['price']);
|
245 |
}
|
246 |
-
if(isset($params)) {
|
247 |
foreach ($params as $param => $values) {
|
248 |
$getAttribute = Mage::getModel('catalog/product')->getResource()->getAttribute($param);
|
249 |
-
if($getAttribute !== false) {
|
250 |
$values = html_entity_decode($values);
|
251 |
preg_match_all('!\d+!', $values, $matches);
|
252 |
if (is_array($matches[0])) {
|
@@ -269,7 +235,6 @@ class Boxalino_CemSearch_Helper_Data extends Mage_Core_Helper_Data
|
|
269 |
*/
|
270 |
public function sanitizeFieldName($text)
|
271 |
{
|
272 |
-
|
273 |
$maxLength = 50;
|
274 |
$delimiter = "_";
|
275 |
|
@@ -280,8 +245,7 @@ class Boxalino_CemSearch_Helper_Data extends Mage_Core_Helper_Data
|
|
280 |
$text = trim($text, $delimiter);
|
281 |
|
282 |
// transliterate
|
283 |
-
if (function_exists('iconv'))
|
284 |
-
{
|
285 |
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
|
286 |
}
|
287 |
|
@@ -291,8 +255,7 @@ class Boxalino_CemSearch_Helper_Data extends Mage_Core_Helper_Data
|
|
291 |
// remove unwanted characters
|
292 |
$text = preg_replace('~[^_\w]+~', '', $text);
|
293 |
|
294 |
-
if (empty($text))
|
295 |
-
{
|
296 |
return null;
|
297 |
}
|
298 |
|
@@ -303,4 +266,86 @@ class Boxalino_CemSearch_Helper_Data extends Mage_Core_Helper_Data
|
|
303 |
return $text;
|
304 |
}
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
}
|
1 |
<?php
|
2 |
+
|
3 |
class Boxalino_CemSearch_Helper_Data extends Mage_Core_Helper_Data
|
4 |
{
|
5 |
+
private $additionalFields = null;
|
6 |
+
private $searchAdapter = null;
|
7 |
|
8 |
public function __construct()
|
9 |
{
|
13 |
|
14 |
public static function __loadClass($name)
|
15 |
{
|
16 |
+
if (strpos($name, 'Thrift\\') !== false) {
|
17 |
try {
|
18 |
include_once(Mage::getModuleDir('', 'Boxalino_CemSearch') . '/Lib/vendor/' . str_replace('\\', '/', $name) . '.php');
|
19 |
} catch (Exception $e) {
|
73 |
return ($trackSales == 1);
|
74 |
}
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
public function isAnalyticsEnabled()
|
77 |
{
|
78 |
+
return (bool)Mage::getStoreConfig('Boxalino_General/tracker/analytics');
|
|
|
79 |
}
|
80 |
|
81 |
public function reportSearch($term, $filters = null)
|
129 |
}
|
130 |
}
|
131 |
|
|
|
132 |
/**
|
133 |
* @param $products array example:
|
134 |
* <code>
|
181 |
return $account;
|
182 |
}
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
public function getFiltersValues($params)
|
185 |
{
|
186 |
$filters = new stdClass();
|
187 |
+
if (isset($params['cat'])) {
|
188 |
$filters->filter_hc_category = '';
|
189 |
$category = Mage::getModel('catalog/category')->load($params['cat']);
|
190 |
$categories = explode('/', $category->getPath());
|
191 |
foreach ($categories as $cat) {
|
192 |
$name = $category = Mage::getModel('catalog/category')->load($cat)->getName();
|
193 |
+
if (strpos($name, '/') !== false) {
|
194 |
$name = str_replace('/', '\/', $name);
|
195 |
}
|
196 |
+
$filters->filter_hc_category .= '/' . $name;
|
197 |
|
198 |
}
|
199 |
unset($params['cat']);
|
200 |
}
|
201 |
|
202 |
+
if (isset($params['price'])) {
|
203 |
$prices = explode('-', $params['price']);
|
204 |
+
if (!empty($prices[0])) {
|
205 |
$filters->filter_from_incl_price = $prices[0];
|
206 |
}
|
207 |
+
if (!empty($prices[1])) {
|
208 |
$filters->filter_to_incl_price = $prices[1];
|
209 |
}
|
210 |
unset($params['price']);
|
211 |
}
|
212 |
+
if (isset($params)) {
|
213 |
foreach ($params as $param => $values) {
|
214 |
$getAttribute = Mage::getModel('catalog/product')->getResource()->getAttribute($param);
|
215 |
+
if ($getAttribute !== false) {
|
216 |
$values = html_entity_decode($values);
|
217 |
preg_match_all('!\d+!', $values, $matches);
|
218 |
if (is_array($matches[0])) {
|
235 |
*/
|
236 |
public function sanitizeFieldName($text)
|
237 |
{
|
|
|
238 |
$maxLength = 50;
|
239 |
$delimiter = "_";
|
240 |
|
245 |
$text = trim($text, $delimiter);
|
246 |
|
247 |
// transliterate
|
248 |
+
if (function_exists('iconv')) {
|
|
|
249 |
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
|
250 |
}
|
251 |
|
255 |
// remove unwanted characters
|
256 |
$text = preg_replace('~[^_\w]+~', '', $text);
|
257 |
|
258 |
+
if (empty($text)) {
|
|
|
259 |
return null;
|
260 |
}
|
261 |
|
266 |
return $text;
|
267 |
}
|
268 |
|
269 |
+
public function getAdditionalFieldsFromP13n()
|
270 |
+
{
|
271 |
+
if ($this->additionalFields == null) {
|
272 |
+
$this->additionalFields = explode(',', Mage::getStoreConfig('Boxalino_General/general/additional_fields'));
|
273 |
+
}
|
274 |
+
return !empty($this->additionalFields) ? $this->additionalFields : array();
|
275 |
+
}
|
276 |
+
|
277 |
+
public function getSearchAdapter()
|
278 |
+
{
|
279 |
+
|
280 |
+
if ($this->searchAdapter === null) {
|
281 |
+
$storeConfig = Mage::getStoreConfig('Boxalino_General/general');
|
282 |
+
|
283 |
+
$p13nConfig = new Boxalino_CemSearch_Helper_P13n_Config(
|
284 |
+
$storeConfig['host'],
|
285 |
+
Mage::helper('Boxalino_CemSearch')->getAccount(),
|
286 |
+
$storeConfig['p13n_username'],
|
287 |
+
$storeConfig['p13n_password'],
|
288 |
+
$storeConfig['domain']
|
289 |
+
);
|
290 |
+
$p13nSort = new Boxalino_CemSearch_Helper_P13n_Sort();
|
291 |
+
|
292 |
+
$field = '';
|
293 |
+
$dir = '';
|
294 |
+
if(isset($_REQUEST['order'])){
|
295 |
+
if($_REQUEST['order'] == 'name'){
|
296 |
+
$field = 'title';
|
297 |
+
} elseif($_REQUEST['order'] == 'price'){
|
298 |
+
$field = 'discountedPrice';
|
299 |
+
}
|
300 |
+
}
|
301 |
+
if(isset($_REQUEST['dir'])){
|
302 |
+
$dir = $_REQUEST['dir']=='asc'?false:true;
|
303 |
+
} else{
|
304 |
+
$dir = false;
|
305 |
+
}
|
306 |
+
|
307 |
+
if($field !== '' && $dir !== ''){
|
308 |
+
$p13nSort->push($field, $dir);
|
309 |
+
}
|
310 |
+
|
311 |
+
$this->searchAdapter = new Boxalino_CemSearch_Helper_P13n_Adapter($p13nConfig);
|
312 |
+
|
313 |
+
/* @var $category Mage_Catalog_Model_Category */
|
314 |
+
$category = Mage::registry('current_category');
|
315 |
+
if (!empty($category)) {
|
316 |
+
$categoryPath = $category->getId();
|
317 |
+
$categoryNames = array('Default Category');
|
318 |
+
foreach ($category->getParentCategories() as $parentCategory) {
|
319 |
+
$categoryNames[] = $parentCategory->getName();
|
320 |
+
}
|
321 |
+
foreach ($categoryNames as $categoryName) {
|
322 |
+
$categoryPath .= '/' . $categoryName;
|
323 |
+
}
|
324 |
+
$_REQUEST['bx_categories'][0] = $categoryPath;
|
325 |
+
}
|
326 |
+
|
327 |
+
$generalConfig = Mage::getStoreConfig('Boxalino_General/search');
|
328 |
+
|
329 |
+
$this->searchAdapter->setupInquiry(
|
330 |
+
$generalConfig['quick_search'],
|
331 |
+
Mage::helper('catalogsearch')->getQueryText(),
|
332 |
+
substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2),
|
333 |
+
array($generalConfig['entity_id'], 'categories'),
|
334 |
+
$p13nSort, 0,
|
335 |
+
($generalConfig['quick_search_limit'] == 0 ? 1000 : $generalConfig['quick_search_limit'])
|
336 |
+
);
|
337 |
+
|
338 |
+
if (isset($_GET['cat'])) {
|
339 |
+
$this->searchAdapter->addFilterCategory($_GET['cat']);
|
340 |
+
}
|
341 |
+
$this->searchAdapter->search();
|
342 |
+
$this->searchAdapter->prepareAdditionalDataFromP13n();
|
343 |
+
}
|
344 |
+
return $this->searchAdapter;
|
345 |
+
}
|
346 |
+
|
347 |
+
public function resetSearchAdapter()
|
348 |
+
{
|
349 |
+
$this->searchAdapter = null;
|
350 |
+
}
|
351 |
}
|
app/code/local/Boxalino/CemSearch/Helper/P13n/Adapter.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* User: Michal Sordyl
|
4 |
* Mail: michal.sordyl@codete.co
|
5 |
* Date: 28.05.14
|
6 |
*/
|
7 |
-
|
8 |
class Boxalino_CemSearch_Helper_P13n_Adapter
|
9 |
{
|
10 |
private $config = null;
|
@@ -12,11 +12,12 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
12 |
private $autocompleteRequest = null;
|
13 |
private $choiceRequest = null;
|
14 |
private $autocompleteResponse = null;
|
15 |
-
private $choiceResponse = null;
|
16 |
private $returnFields = null;
|
17 |
private $inquiry = null;
|
18 |
private $searchQuery = null;
|
19 |
private $filters = array();
|
|
|
20 |
const VISITOR_COOKIE_TIME = 31536000;
|
21 |
|
22 |
public function __construct(Boxalino_CemSearch_Helper_P13n_Config $config)
|
@@ -27,6 +28,14 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
27 |
$this->createChoiceRequest();
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
private function configureP13n()
|
31 |
{
|
32 |
$this->p13n->setHost($this->config->getHost());
|
@@ -36,6 +45,7 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
36 |
private function createChoiceRequest()
|
37 |
{
|
38 |
$this->choiceRequest = $this->p13n->getChoiceRequest($this->config->getAccount(), $this->config->getDomain());
|
|
|
39 |
}
|
40 |
|
41 |
public function __destruct()
|
@@ -55,6 +65,7 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
55 |
public function setupInquiry($choiceId, $search, $language, $returnFields, $sort, $offset = 0, $hitCount = 10)
|
56 |
{
|
57 |
$this->inquiry = $this->createInquiry();
|
|
|
58 |
$this->returnFields = $returnFields;
|
59 |
$this->createAndSetUpSearchQuery($search, $language, $returnFields, $offset, $hitCount);
|
60 |
$this->setUpSorting($sort);
|
@@ -63,6 +74,16 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
63 |
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
private function createInquiry()
|
67 |
{
|
68 |
$inquiry = new \com\boxalino\p13n\api\thrift\ChoiceInquiry();
|
@@ -78,6 +99,10 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
78 |
$this->searchQuery->returnFields = $returnFields;
|
79 |
$this->searchQuery->offset = $offset;
|
80 |
$this->searchQuery->hitCount = $hitCount;
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
private function setUpSorting(Boxalino_CemSearch_Helper_P13n_Sort $sorting)
|
@@ -133,12 +158,13 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
133 |
/**
|
134 |
* @param $categoryId
|
135 |
*/
|
136 |
-
public function addFilterCategory($categoryId)
|
|
|
137 |
|
138 |
-
if (isset($categoryId) && $categoryId > 0){
|
139 |
$category = Mage::getModel('catalog/category')->load($categoryId);
|
140 |
|
141 |
-
if($category != null){
|
142 |
$filter = new \com\boxalino\p13n\api\thrift\Filter();
|
143 |
|
144 |
$filter->fieldName = 'categories';
|
@@ -237,11 +263,14 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
237 |
$this->filters[] = $filter;
|
238 |
}
|
239 |
|
240 |
-
public function autocomplete($text, $limit, $products_limit = 0)
|
241 |
{
|
242 |
-
$
|
243 |
-
$fields
|
|
|
|
|
244 |
$this->autocompleteRequest = $this->getAutocompleteRequest($this->config->getAccount(), $this->config->getDomain());
|
|
|
245 |
|
246 |
$searchQuery = new \com\boxalino\p13n\api\thrift\SimpleSearchQuery();
|
247 |
$searchQuery->indexId = $this->config->getAccount();
|
@@ -250,45 +279,249 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
250 |
$searchQuery->offset = 0;
|
251 |
$searchQuery->hitCount = $products_limit;
|
252 |
$searchQuery->queryText = $text;
|
|
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
$autocompleteQuery = new \com\boxalino\p13n\api\thrift\AutocompleteQuery();
|
255 |
$autocompleteQuery->indexId = $this->config->getAccount();
|
256 |
$autocompleteQuery->language = substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2);
|
257 |
$autocompleteQuery->queryText = $text;
|
258 |
$autocompleteQuery->suggestionsHitCount = $limit;
|
|
|
|
|
|
|
259 |
|
260 |
-
$this->autocompleteRequest->choiceId = $
|
261 |
$this->autocompleteRequest->autocompleteQuery = $autocompleteQuery;
|
262 |
-
$this->autocompleteRequest->searchChoiceId = $
|
263 |
$this->autocompleteRequest->searchQuery = $searchQuery;
|
|
|
|
|
|
|
|
|
|
|
264 |
$this->autocompleteResponse = $this->p13n->autocomplete($this->autocompleteRequest);
|
265 |
|
|
|
|
|
266 |
}
|
267 |
|
268 |
public function getAutocompleteEntities()
|
269 |
{
|
270 |
$suggestions = array();
|
|
|
271 |
|
272 |
foreach ($this->autocompleteResponse->hits as $hit) {
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
}
|
275 |
return $suggestions;
|
276 |
}
|
277 |
|
278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
$products = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
|
|
|
|
|
|
282 |
foreach ($this->autocompleteResponse->hits as $hit) {
|
|
|
|
|
|
|
|
|
283 |
$id = substr(md5($hit->suggestion), 0, 10);
|
284 |
-
$products[$id] =
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
}
|
291 |
}
|
|
|
292 |
return $products;
|
293 |
}
|
294 |
|
@@ -297,42 +530,176 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
297 |
if (!empty($this->filters)) {
|
298 |
$this->searchQuery->filters = $this->filters;
|
299 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
$this->inquiry->simpleSearchQuery = $this->searchQuery;
|
|
|
|
|
|
|
|
|
|
|
301 |
$this->choiceRequest->inquiries = array($this->inquiry);
|
302 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
}
|
304 |
|
305 |
public function getEntitiesIds()
|
306 |
{
|
307 |
$result = array();
|
308 |
-
|
|
|
309 |
/** @var \com\boxalino\p13n\api\thrift\SearchResult $searchResult */
|
310 |
$searchResult = $variant->searchResult;
|
311 |
foreach ($searchResult->hits as $item) {
|
312 |
$result[] = $item->values[Mage::getStoreConfig('Boxalino_General/search/entity_id')][0];
|
313 |
}
|
314 |
}
|
|
|
315 |
return $result;
|
316 |
}
|
317 |
|
318 |
-
public function
|
319 |
{
|
320 |
$result = array();
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
foreach ($
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
}
|
327 |
}
|
328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
}
|
330 |
|
331 |
public function printData()
|
332 |
{
|
333 |
$results = array();
|
334 |
/** @var \com\boxalino\p13n\api\thrift\Variant $variant */
|
335 |
-
foreach (
|
336 |
/** @var \com\boxalino\p13n\api\thrift\SearchResult $searchResult */
|
337 |
$searchResult = $variant->searchResult;
|
338 |
foreach ($searchResult->hits as $item) {
|
@@ -418,4 +785,255 @@ class Boxalino_CemSearch_Helper_P13n_Adapter
|
|
418 |
return $request;
|
419 |
}
|
420 |
|
421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* User: Michal Sordyl
|
5 |
* Mail: michal.sordyl@codete.co
|
6 |
* Date: 28.05.14
|
7 |
*/
|
|
|
8 |
class Boxalino_CemSearch_Helper_P13n_Adapter
|
9 |
{
|
10 |
private $config = null;
|
12 |
private $autocompleteRequest = null;
|
13 |
private $choiceRequest = null;
|
14 |
private $autocompleteResponse = null;
|
15 |
+
static private $choiceResponse = null;
|
16 |
private $returnFields = null;
|
17 |
private $inquiry = null;
|
18 |
private $searchQuery = null;
|
19 |
private $filters = array();
|
20 |
+
private $selectedFacets = array();
|
21 |
const VISITOR_COOKIE_TIME = 31536000;
|
22 |
|
23 |
public function __construct(Boxalino_CemSearch_Helper_P13n_Config $config)
|
28 |
$this->createChoiceRequest();
|
29 |
}
|
30 |
|
31 |
+
private function getChoiceResponse()
|
32 |
+
{
|
33 |
+
if (empty(self::$choiceResponse)) {
|
34 |
+
$this->search();
|
35 |
+
}
|
36 |
+
return self::$choiceResponse;
|
37 |
+
}
|
38 |
+
|
39 |
private function configureP13n()
|
40 |
{
|
41 |
$this->p13n->setHost($this->config->getHost());
|
45 |
private function createChoiceRequest()
|
46 |
{
|
47 |
$this->choiceRequest = $this->p13n->getChoiceRequest($this->config->getAccount(), $this->config->getDomain());
|
48 |
+
$this->choiceRequest = $this->p13n->addRequestContext($this->choiceRequest);
|
49 |
}
|
50 |
|
51 |
public function __destruct()
|
65 |
public function setupInquiry($choiceId, $search, $language, $returnFields, $sort, $offset = 0, $hitCount = 10)
|
66 |
{
|
67 |
$this->inquiry = $this->createInquiry();
|
68 |
+
$returnFields = array_merge($returnFields, Mage::helper('Boxalino_CemSearch')->getAdditionalFieldsFromP13n());
|
69 |
$this->returnFields = $returnFields;
|
70 |
$this->createAndSetUpSearchQuery($search, $language, $returnFields, $offset, $hitCount);
|
71 |
$this->setUpSorting($sort);
|
74 |
|
75 |
}
|
76 |
|
77 |
+
public function setWithRelaxation($value)
|
78 |
+
{
|
79 |
+
$this->inquiry->withRelaxation = $value;
|
80 |
+
}
|
81 |
+
|
82 |
+
public function getChoiceRelaxation()
|
83 |
+
{
|
84 |
+
return self::$choiceResponse->variants[0]->searchRelaxation;
|
85 |
+
}
|
86 |
+
|
87 |
private function createInquiry()
|
88 |
{
|
89 |
$inquiry = new \com\boxalino\p13n\api\thrift\ChoiceInquiry();
|
99 |
$this->searchQuery->returnFields = $returnFields;
|
100 |
$this->searchQuery->offset = $offset;
|
101 |
$this->searchQuery->hitCount = $hitCount;
|
102 |
+
$this->searchQuery->facetRequests = $this->prepareFacets();
|
103 |
+
|
104 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('query', $search);
|
105 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('facets', $this->searchQuery->facetRequests);
|
106 |
}
|
107 |
|
108 |
private function setUpSorting(Boxalino_CemSearch_Helper_P13n_Sort $sorting)
|
158 |
/**
|
159 |
* @param $categoryId
|
160 |
*/
|
161 |
+
public function addFilterCategory($categoryId)
|
162 |
+
{
|
163 |
|
164 |
+
if (isset($categoryId) && $categoryId > 0) {
|
165 |
$category = Mage::getModel('catalog/category')->load($categoryId);
|
166 |
|
167 |
+
if ($category != null) {
|
168 |
$filter = new \com\boxalino\p13n\api\thrift\Filter();
|
169 |
|
170 |
$filter->fieldName = 'categories';
|
263 |
$this->filters[] = $filter;
|
264 |
}
|
265 |
|
266 |
+
public function autocomplete($text, $limit, $products_limit = 0, $fields = null)
|
267 |
{
|
268 |
+
$searchConfig = Mage::getStoreConfig('Boxalino_General/search');
|
269 |
+
if ($fields == null) {
|
270 |
+
array($searchConfig['entity_id'], 'title', 'score');
|
271 |
+
}
|
272 |
$this->autocompleteRequest = $this->getAutocompleteRequest($this->config->getAccount(), $this->config->getDomain());
|
273 |
+
$this->autocompleteRequest = $this->p13n->addRequestContext($this->autocompleteRequest);
|
274 |
|
275 |
$searchQuery = new \com\boxalino\p13n\api\thrift\SimpleSearchQuery();
|
276 |
$searchQuery->indexId = $this->config->getAccount();
|
279 |
$searchQuery->offset = 0;
|
280 |
$searchQuery->hitCount = $products_limit;
|
281 |
$searchQuery->queryText = $text;
|
282 |
+
$searchQuery->facetRequests = array();
|
283 |
|
284 |
+
$config = Mage::getStoreConfig('Boxalino_General/autocomplete_extra');
|
285 |
+
if ($config['enabled']) {
|
286 |
+
$facet = new \com\boxalino\p13n\api\thrift\FacetRequest();
|
287 |
+
$facet->fieldName = 'categories';
|
288 |
+
$facet->numerical = false;
|
289 |
+
$facet->range = false;
|
290 |
+
$searchQuery->facetRequests[] = $facet;
|
291 |
+
}
|
292 |
+
|
293 |
+
if ($this->filterByVisibleProducts()) {
|
294 |
+
$searchQuery->filters[] = $this->filterByVisibleProducts();
|
295 |
+
}
|
296 |
+
if ($this->filterByStatusProducts()) {
|
297 |
+
$searchQuery->filters[] = $this->filterByStatusProducts();
|
298 |
+
}
|
299 |
$autocompleteQuery = new \com\boxalino\p13n\api\thrift\AutocompleteQuery();
|
300 |
$autocompleteQuery->indexId = $this->config->getAccount();
|
301 |
$autocompleteQuery->language = substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2);
|
302 |
$autocompleteQuery->queryText = $text;
|
303 |
$autocompleteQuery->suggestionsHitCount = $limit;
|
304 |
+
$autocompleteQuery->highlight = true;
|
305 |
+
$autocompleteQuery->highlightPre = '<em>';
|
306 |
+
$autocompleteQuery->highlightPost = '</em>';
|
307 |
|
308 |
+
$this->autocompleteRequest->choiceId = $searchConfig['autocomplete'];
|
309 |
$this->autocompleteRequest->autocompleteQuery = $autocompleteQuery;
|
310 |
+
$this->autocompleteRequest->searchChoiceId = $searchConfig['quick_search'];
|
311 |
$this->autocompleteRequest->searchQuery = $searchQuery;
|
312 |
+
|
313 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('autocomplete_Query', $text);
|
314 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('autocomplete_Request', $this->autocompleteRequest);
|
315 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('autocomplete_Request_serialized', serialize($this->autocompleteRequest));
|
316 |
+
|
317 |
$this->autocompleteResponse = $this->p13n->autocomplete($this->autocompleteRequest);
|
318 |
|
319 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('autocomplete_Response', $this->autocompleteResponse, 1);
|
320 |
+
|
321 |
}
|
322 |
|
323 |
public function getAutocompleteEntities()
|
324 |
{
|
325 |
$suggestions = array();
|
326 |
+
$config = Mage::getStoreConfig('Boxalino_General/autocomplete_extra');
|
327 |
|
328 |
foreach ($this->autocompleteResponse->hits as $hit) {
|
329 |
+
|
330 |
+
$tmp = array('text' => $hit->suggestion, 'html' => (strlen($hit->highlighted) ? $hit->highlighted : $hit->suggestion), 'hits' => $hit->searchResult->totalHitCount);
|
331 |
+
$facets = array();
|
332 |
+
|
333 |
+
if ($config['enabled']) {
|
334 |
+
$tmp['facets'] = array_slice($this->getFacetLeafs($hit->searchResult->facetResponses[0]->values, $hit, $config), 0, Mage::getStoreConfig('Boxalino_General/autocomplete_extra/items'));
|
335 |
+
}
|
336 |
+
|
337 |
+
$suggestions[] = $tmp;
|
338 |
}
|
339 |
return $suggestions;
|
340 |
}
|
341 |
|
342 |
+
protected function getFacetDepth($facet)
|
343 |
+
{
|
344 |
+
|
345 |
+
return substr_count($facet->stringValue, '/');
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
protected function getFacetLeafs($facets, $hit, $config)
|
350 |
+
{
|
351 |
+
$tmp = array();
|
352 |
+
|
353 |
+
foreach ($facets as $facet) {
|
354 |
+
|
355 |
+
foreach ($facet->hierarchy as $h) {
|
356 |
+
if (array_key_exists($h, $tmp)) {
|
357 |
+
unset($tmp[$h]);
|
358 |
+
}
|
359 |
+
}
|
360 |
+
|
361 |
+
$tmp[end($facet->hierarchy)] = array(
|
362 |
+
'title' => end($facet->hierarchy),
|
363 |
+
'hits' => $facet->hitCount,
|
364 |
+
'href' => $facet->stringValue,
|
365 |
+
'id' => substr(md5($hit->suggestion . '_' . $facet->stringValue), 0, 10)
|
366 |
+
);
|
367 |
+
}
|
368 |
+
|
369 |
+
if ($config['sort']) {
|
370 |
+
usort($tmp, array($this, 'cmpFacets'));
|
371 |
+
}
|
372 |
+
|
373 |
+
return $tmp;
|
374 |
+
}
|
375 |
+
|
376 |
+
private function cmpFacets($a, $b)
|
377 |
+
{
|
378 |
+
if ($a['hits'] == $b['hits']) {
|
379 |
+
return 0;
|
380 |
+
}
|
381 |
+
return ($a['hits'] > $b['hits']) ? -1 : 1;
|
382 |
+
}
|
383 |
+
|
384 |
+
private function filterByVisibleProducts()
|
385 |
+
{
|
386 |
+
$filter = new \com\boxalino\p13n\api\thrift\Filter();
|
387 |
+
$filter->fieldName = 'products_visibility';
|
388 |
+
$filter->negative = true;
|
389 |
+
$filter->stringValues = array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
|
390 |
+
return $filter;
|
391 |
+
}
|
392 |
+
|
393 |
+
private function filterByStatusProducts()
|
394 |
+
{
|
395 |
+
$filter = new \com\boxalino\p13n\api\thrift\Filter();
|
396 |
+
$filter->fieldName = 'products_status';
|
397 |
+
$filter->stringValues = array(Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
398 |
+
return $filter;
|
399 |
+
}
|
400 |
+
|
401 |
+
private function extractItemsFromHits($hits, $hash, $entity_id, $map)
|
402 |
+
{
|
403 |
+
$items = array();
|
404 |
+
foreach ($hits as $item) {
|
405 |
+
$tmp = array();
|
406 |
+
$tmp['hash'] = $hash;
|
407 |
+
foreach ($item->values as $key => $value) {
|
408 |
+
if (array_key_exists($key, $map)) {
|
409 |
+
if (is_array($value)) {
|
410 |
+
$tmp[$map[$key]] = array_shift($value);
|
411 |
+
} else {
|
412 |
+
$tmp[$map[$key]] = $value;
|
413 |
+
}
|
414 |
+
}
|
415 |
+
}
|
416 |
+
$items[] = $tmp;
|
417 |
+
}
|
418 |
+
return $items;
|
419 |
+
}
|
420 |
+
|
421 |
+
public function getPrefixSearchHash() {
|
422 |
+
if ($this->autocompleteResponse->prefixSearchResult->totalHitCount > 0) {
|
423 |
+
return substr(md5($this->autocompleteResponse->prefixSearchResult->queryText), 0, 10);
|
424 |
+
} else {
|
425 |
+
return null;
|
426 |
+
}
|
427 |
+
}
|
428 |
+
|
429 |
+
public function getAutocompleteProducts($facets, $map = null, $fields = null)
|
430 |
{
|
431 |
+
$fs = array();
|
432 |
+
foreach($facets as $f) {
|
433 |
+
$fs[] = $f['id'];
|
434 |
+
}
|
435 |
+
|
436 |
+
$generalConfig = Mage::getStoreConfig('Boxalino_General/search');
|
437 |
+
$extraConfig = Mage::getStoreConfig('Boxalino_General/autocomplete_extra');
|
438 |
+
$entity_id = $generalConfig['entity_id'];
|
439 |
+
|
440 |
+
if (!is_array($map)) {
|
441 |
+
$map = array($entity_id => $entity_id);
|
442 |
+
}
|
443 |
+
|
444 |
+
if (!is_array($fields)) {
|
445 |
+
$fields = array($entity_id);
|
446 |
+
}
|
447 |
+
|
448 |
+
// prefix search result
|
449 |
$products = array();
|
450 |
+
$id = substr(md5($this->autocompleteResponse->prefixSearchResult->queryText), 0, 10);
|
451 |
+
$products[$id] = $this->extractItemsFromHits($this->autocompleteResponse->prefixSearchResult->hits, $id, $entity_id, $map);
|
452 |
+
|
453 |
+
// facets
|
454 |
+
if ($extraConfig['products'] == '1') {
|
455 |
+
$storeConfig = Mage::getStoreConfig('Boxalino_General/general');
|
456 |
+
$p13nConfig = new Boxalino_CemSearch_Helper_P13n_Config(
|
457 |
+
$storeConfig['host'],
|
458 |
+
Mage::helper('Boxalino_CemSearch')->getAccount(),
|
459 |
+
$storeConfig['p13n_username'],
|
460 |
+
$storeConfig['p13n_password'],
|
461 |
+
$storeConfig['domain']
|
462 |
+
);
|
463 |
+
$p13nSort = new Boxalino_CemSearch_Helper_P13n_Sort();
|
464 |
+
}
|
465 |
|
466 |
+
$lang = substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2);
|
467 |
+
$i = 0;
|
468 |
+
$iMax = $generalConfig['autocomplete_limit'];
|
469 |
foreach ($this->autocompleteResponse->hits as $hit) {
|
470 |
+
if ($i++ >= $iMax) {
|
471 |
+
break;
|
472 |
+
}
|
473 |
+
|
474 |
$id = substr(md5($hit->suggestion), 0, 10);
|
475 |
+
$products[$id] = $this->extractItemsFromHits($hit->searchResult->hits, $id, $entity_id, $map);
|
476 |
+
|
477 |
+
if ($extraConfig['products'] == '1' && ($i == 1 || $extraConfig['enabled_for_all'] == '0')) {
|
478 |
+
$j = 0;
|
479 |
+
$jMax = $extraConfig['items'];
|
480 |
+
foreach ($hit->searchResult->facetResponses[0]->values as $f) {
|
481 |
+
if ($j++ >= $jMax) {
|
482 |
+
break;
|
483 |
+
}
|
484 |
+
|
485 |
+
$id = substr(md5($hit->suggestion . '_' . $f->stringValue), 0, 10);
|
486 |
+
|
487 |
+
if (!in_array($id, $fs)) {
|
488 |
+
if ($j >= $jMax) {
|
489 |
+
break;
|
490 |
+
}
|
491 |
+
continue;
|
492 |
+
}
|
493 |
+
|
494 |
+
$p13n = new Boxalino_CemSearch_Helper_P13n_Adapter($p13nConfig);
|
495 |
+
$p13n->setupInquiry(
|
496 |
+
$generalConfig['quick_search'],
|
497 |
+
$this->autocompleteResponse->prefixSearchResult->queryText,
|
498 |
+
$lang,
|
499 |
+
$fields,
|
500 |
+
$p13nSort,
|
501 |
+
0, 4
|
502 |
+
);
|
503 |
+
$p13n->setWithRelaxation(false);
|
504 |
+
|
505 |
+
$tmp = new \com\boxalino\p13n\api\thrift\FacetValue();
|
506 |
+
$tmp->stringValue = $f->stringValue;
|
507 |
+
|
508 |
+
$facet = new \com\boxalino\p13n\api\thrift\FacetRequest();
|
509 |
+
$facet->fieldName = 'categories';
|
510 |
+
$facet->numerical = false;
|
511 |
+
$facet->range = false;
|
512 |
+
$facet->selectedValues = array($tmp);
|
513 |
+
|
514 |
+
$p13n->searchQuery->facetRequests[] = $facet;
|
515 |
+
$p13n->search();
|
516 |
+
$response = $p13n->getChoiceResponse();
|
517 |
+
|
518 |
+
if (isset($response->variants[0]) && isset($response->variants[0]->searchResult->hits)) {
|
519 |
+
$products[$id] = $this->extractItemsFromHits($response->variants[0]->searchResult->hits, $id, $entity_id, $map);
|
520 |
+
}
|
521 |
+
}
|
522 |
}
|
523 |
}
|
524 |
+
|
525 |
return $products;
|
526 |
}
|
527 |
|
530 |
if (!empty($this->filters)) {
|
531 |
$this->searchQuery->filters = $this->filters;
|
532 |
}
|
533 |
+
if ($this->filterByVisibleProducts()) {
|
534 |
+
$this->searchQuery->filters[] = $this->filterByVisibleProducts();
|
535 |
+
}
|
536 |
+
if ($this->filterByStatusProducts()) {
|
537 |
+
$this->searchQuery->filters[] = $this->filterByStatusProducts();
|
538 |
+
}
|
539 |
$this->inquiry->simpleSearchQuery = $this->searchQuery;
|
540 |
+
|
541 |
+
if (Mage::getStoreConfig('Boxalino_General/search_relaxation/enabled') == 1) {
|
542 |
+
$this->inquiry->withRelaxation = 1;
|
543 |
+
}
|
544 |
+
|
545 |
$this->choiceRequest->inquiries = array($this->inquiry);
|
546 |
+
|
547 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('choice_Request', $this->choiceRequest);
|
548 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('choice_Request_serialized', serialize($this->choiceRequest));
|
549 |
+
|
550 |
+
self::$choiceResponse = $this->p13n->choose($this->choiceRequest);
|
551 |
+
|
552 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('choice_Response', self::$choiceResponse, 1);
|
553 |
+
}
|
554 |
+
|
555 |
+
private function prepareFacets()
|
556 |
+
{
|
557 |
+
$facets = array();
|
558 |
+
$normalFilters = '';
|
559 |
+
$topFilters = '';
|
560 |
+
$enableLeftFilters = Mage::getStoreConfig('Boxalino_General/filter/left_filters_enable');
|
561 |
+
$enableTopFilters = Mage::getStoreConfig('Boxalino_General/filter/top_filters_enable');
|
562 |
+
|
563 |
+
if ($enableLeftFilters == 1) {
|
564 |
+
$normalFilters = explode(',', Mage::getStoreConfig('Boxalino_General/filter/left_filters_normal'));
|
565 |
+
}
|
566 |
+
if ($enableTopFilters == 1) {
|
567 |
+
$topFilters = explode(',', Mage::getStoreConfig('Boxalino_General/filter/top_filters'));
|
568 |
+
}
|
569 |
+
if (!empty($normalFilters)) {
|
570 |
+
foreach ($normalFilters as $filterString) {
|
571 |
+
$filter = explode(':', $filterString);
|
572 |
+
if ($filter[0] != '') {
|
573 |
+
$facet = new \com\boxalino\p13n\api\thrift\FacetRequest();
|
574 |
+
$facet->fieldName = $filter[0];
|
575 |
+
$facet->numerical = $filter[1] == 'ranged' ? true : $filter[1] == 'numerical' ? true : false;
|
576 |
+
$facet->range = $filter[1] == 'ranged' ? true : false;
|
577 |
+
$facet->selectedValues = $this->facetSelectedValue($filter[0], $filter[1]);
|
578 |
+
$facet->sortOrder = isset($filter[2]) && $filter[2] == 1 ? 1 : 2;
|
579 |
+
$facets[] = $facet;
|
580 |
+
}
|
581 |
+
}
|
582 |
+
}
|
583 |
+
if ($topFilters) {
|
584 |
+
foreach ($topFilters as $filter) {
|
585 |
+
if ($filter != '') {
|
586 |
+
$facet = new \com\boxalino\p13n\api\thrift\FacetRequest();
|
587 |
+
$facet->fieldName = $filter;
|
588 |
+
$facet->numerical = false;
|
589 |
+
$facet->range = false;
|
590 |
+
$facet->selectedValues = $this->facetSelectedValue($filter, 'standard');
|
591 |
+
$facets[] = $facet;
|
592 |
+
}
|
593 |
+
}
|
594 |
+
}
|
595 |
+
return $facets;
|
596 |
+
}
|
597 |
+
|
598 |
+
private function facetSelectedValue($name, $option)
|
599 |
+
{
|
600 |
+
if (empty($this->selectedFacets)) {
|
601 |
+
foreach ($_REQUEST as $key => $values) {
|
602 |
+
if (strpos($key, 'bx_') !== false) {
|
603 |
+
$fieldName = substr($key, 3);
|
604 |
+
$values = !is_array($values)?array($values):$values;
|
605 |
+
foreach ($values as $value) {
|
606 |
+
$this->selectedFacets[$fieldName][] = $value;
|
607 |
+
}
|
608 |
+
}
|
609 |
+
}
|
610 |
+
}
|
611 |
+
$selectedFacets = array();
|
612 |
+
if (isset($this->selectedFacets[$name])) {
|
613 |
+
foreach ($this->selectedFacets[$name] as $value) {
|
614 |
+
$selectedFacet = new \com\boxalino\p13n\api\thrift\FacetValue();
|
615 |
+
if ($option == 'ranged') {
|
616 |
+
$rangedValue = explode('-', $value);
|
617 |
+
if ($rangedValue[0] != '*') {
|
618 |
+
$selectedFacet->rangeFromInclusive = $rangedValue[0];
|
619 |
+
}
|
620 |
+
if ($rangedValue[1] != '*') {
|
621 |
+
$selectedFacet->rangeToExclusive = $rangedValue[1];
|
622 |
+
}
|
623 |
+
} else {
|
624 |
+
$selectedFacet->stringValue = $value;
|
625 |
+
}
|
626 |
+
$selectedFacets[] = $selectedFacet;
|
627 |
+
|
628 |
+
}
|
629 |
+
return $selectedFacets;
|
630 |
+
}
|
631 |
+
return;
|
632 |
}
|
633 |
|
634 |
public function getEntitiesIds()
|
635 |
{
|
636 |
$result = array();
|
637 |
+
$response = $this->getChoiceResponse();
|
638 |
+
foreach ($response->variants as $variant) {
|
639 |
/** @var \com\boxalino\p13n\api\thrift\SearchResult $searchResult */
|
640 |
$searchResult = $variant->searchResult;
|
641 |
foreach ($searchResult->hits as $item) {
|
642 |
$result[] = $item->values[Mage::getStoreConfig('Boxalino_General/search/entity_id')][0];
|
643 |
}
|
644 |
}
|
645 |
+
|
646 |
return $result;
|
647 |
}
|
648 |
|
649 |
+
public function prepareAdditionalDataFromP13n()
|
650 |
{
|
651 |
$result = array();
|
652 |
+
$response = self::getChoiceResponse();
|
653 |
+
$additionalFields = Mage::helper('Boxalino_CemSearch')->getAdditionalFieldsFromP13n();
|
654 |
+
if (!empty($response->variants)) {
|
655 |
+
foreach ($response->variants as $variant) {
|
656 |
+
/** @var \com\boxalino\p13n\api\thrift\SearchResult $searchResult */
|
657 |
+
$searchResult = $variant->searchResult;
|
658 |
+
foreach ($searchResult->hits as $item) {
|
659 |
+
foreach ($additionalFields as $field) {
|
660 |
+
if (isset($item->values[$field])) {
|
661 |
+
if (!empty($item->values[$field])) {
|
662 |
+
$result[$item->values['id'][0]][$field] = $item->values[$field];
|
663 |
+
}
|
664 |
+
}
|
665 |
+
}
|
666 |
+
}
|
667 |
}
|
668 |
}
|
669 |
+
Mage::getModel('core/session')->setData('boxalino_additional_data', $result);
|
670 |
+
}
|
671 |
+
|
672 |
+
public function getFacetsData()
|
673 |
+
{
|
674 |
+
$preparedFacets = array();
|
675 |
+
$response = self::getChoiceResponse();
|
676 |
+
foreach ($response->variants as $variant) {
|
677 |
+
$facets = $variant->searchResult->facetResponses;
|
678 |
+
foreach ($facets as $facet) {
|
679 |
+
if (!empty($facet->values)) {
|
680 |
+
$filter[$facet->fieldName] = array();
|
681 |
+
foreach ($facet->values as $value) {
|
682 |
+
$param['stringValue'] = $value->stringValue;
|
683 |
+
$param['hitCount'] = $value->hitCount;
|
684 |
+
$param['rangeFromInclusive'] = $value->rangeFromInclusive;
|
685 |
+
$param['rangeToExclusive'] = $value->rangeToExclusive;
|
686 |
+
$param['hierarchyId'] = $value->hierarchyId;
|
687 |
+
$param['hierarchy'] = $value->hierarchy;
|
688 |
+
$param['selected'] = $value->selected;
|
689 |
+
$filter[$facet->fieldName][] = $param;
|
690 |
+
}
|
691 |
+
$preparedFacets = $filter;
|
692 |
+
}
|
693 |
+
}
|
694 |
+
}
|
695 |
+
return $preparedFacets;
|
696 |
}
|
697 |
|
698 |
public function printData()
|
699 |
{
|
700 |
$results = array();
|
701 |
/** @var \com\boxalino\p13n\api\thrift\Variant $variant */
|
702 |
+
foreach (self::$choiceResponse->variants as $variant) {
|
703 |
/** @var \com\boxalino\p13n\api\thrift\SearchResult $searchResult */
|
704 |
$searchResult = $variant->searchResult;
|
705 |
foreach ($searchResult->hits as $item) {
|
785 |
return $request;
|
786 |
}
|
787 |
|
788 |
+
|
789 |
+
/*
|
790 |
+
* Recommendations
|
791 |
+
*/
|
792 |
+
protected $p13nServerHost = 'cdn.bx-cloud.com';
|
793 |
+
protected $p13nServerPort = 443;
|
794 |
+
protected $productIdFieldName;
|
795 |
+
protected $account;
|
796 |
+
protected $password;
|
797 |
+
protected $language;
|
798 |
+
protected $isDevelopment = false;
|
799 |
+
|
800 |
+
/**
|
801 |
+
* @param string $name
|
802 |
+
* @param array $returnFields
|
803 |
+
* @param int|null $minimumRecommendations
|
804 |
+
* @param int|null $maximumRecommendations
|
805 |
+
* @param string|null $scenario
|
806 |
+
* @return array
|
807 |
+
*/
|
808 |
+
public function getPersonalRecommendations(array $widgets, array $returnFields, $widgetType)
|
809 |
+
{
|
810 |
+
$variantNames = array();
|
811 |
+
$choiceRequest = $this->createRecommendationChoiceRequest();
|
812 |
+
foreach ($widgets as $widget) {
|
813 |
+
$name = $widget['name'];
|
814 |
+
$variantNames[] = $name;
|
815 |
+
$minimumRecommendations = (float)$widget['min_recs'];
|
816 |
+
$maximumRecommendations = (float)$widget['max_recs'];
|
817 |
+
if ($maximumRecommendations === null) {
|
818 |
+
$maximumRecommendations = 5;
|
819 |
+
}
|
820 |
+
|
821 |
+
$inquiry = $this->createRecommendationChoiceInquiry($name);
|
822 |
+
|
823 |
+
$searchQuery = $this->createRecommendationSearchQuery($returnFields);
|
824 |
+
$searchQuery->offset = 0;
|
825 |
+
$searchQuery->hitCount = $maximumRecommendations;
|
826 |
+
|
827 |
+
$inquiry->simpleSearchQuery = $searchQuery;
|
828 |
+
$inquiry->minHitCount = $minimumRecommendations;
|
829 |
+
if ($widgetType === 'basket' && $_REQUEST['basketContent']) {
|
830 |
+
$basketContent = json_decode($_REQUEST['basketContent'], true);
|
831 |
+
if ($basketContent !== false && count($basketContent)) {
|
832 |
+
$contextItems = array();
|
833 |
+
|
834 |
+
// Sort basket content by price
|
835 |
+
usort($basketContent, function ($a, $b) {
|
836 |
+
if ($a['price'] > $b['price']) {
|
837 |
+
return -1;
|
838 |
+
} elseif ($b['price'] > $a['price']) {
|
839 |
+
return 1;
|
840 |
+
}
|
841 |
+
return 0;
|
842 |
+
});
|
843 |
+
|
844 |
+
$basketItem = array_shift($basketContent);
|
845 |
+
|
846 |
+
$contextItem = new \com\boxalino\p13n\api\thrift\ContextItem();
|
847 |
+
$contextItem->indexId = $this->account;
|
848 |
+
$contextItem->fieldName = $this->productIdFieldName;
|
849 |
+
$contextItem->contextItemId = $basketItem['id'];
|
850 |
+
$contextItem->role = 'mainProduct';
|
851 |
+
|
852 |
+
$contextItems[] = $contextItem;
|
853 |
+
|
854 |
+
foreach ($basketContent as $basketItem) {
|
855 |
+
$contextItem = new \com\boxalino\p13n\api\thrift\ContextItem();
|
856 |
+
$contextItem->indexId = $this->account;
|
857 |
+
$contextItem->fieldName = $this->productIdFieldName;
|
858 |
+
$contextItem->contextItemId = $basketItem['id'];
|
859 |
+
$contextItem->role = 'subProduct';
|
860 |
+
|
861 |
+
$contextItems[] = $contextItem;
|
862 |
+
}
|
863 |
+
$inquiry->contextItems = $contextItems;
|
864 |
+
}
|
865 |
+
} elseif ($widgetType === 'product' && !empty($_REQUEST['productId'])) {
|
866 |
+
$productId = $_REQUEST['productId'];
|
867 |
+
$contextItem = new \com\boxalino\p13n\api\thrift\ContextItem();
|
868 |
+
$contextItem->indexId = $this->account;
|
869 |
+
$contextItem->fieldName = $this->productIdFieldName;
|
870 |
+
$contextItem->contextItemId = $productId;
|
871 |
+
$contextItem->role = 'mainProduct';
|
872 |
+
$inquiry->contextItems = array($contextItem);
|
873 |
+
}
|
874 |
+
if ($this->filterByVisibleProducts()) {
|
875 |
+
$inquiry->simpleSearchQuery->filters[] = $this->filterByVisibleProducts();
|
876 |
+
}
|
877 |
+
if ($this->filterByStatusProducts()) {
|
878 |
+
$inquiry->simpleSearchQuery->filters[] = $this->filterByStatusProducts();
|
879 |
+
}
|
880 |
+
$choiceRequest->inquiries[] = $inquiry;
|
881 |
+
}
|
882 |
+
$choiceRequest = $this->p13n->addRequestContext($choiceRequest);
|
883 |
+
|
884 |
+
if (isset($_REQUEST['productId'])) {
|
885 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('recommendation_product_id', $_REQUEST['productId']);
|
886 |
+
} elseif (isset($_REQUEST['basketContent'])) {
|
887 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('recommendation_basket_content', $_REQUEST['basketContent']);
|
888 |
+
}
|
889 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('recommendation_Request', $choiceRequest);
|
890 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('recommendation_Request_serialized', serialize($choiceRequest));
|
891 |
+
|
892 |
+
$choiceResponse = $this->p13n->choose($choiceRequest);
|
893 |
+
|
894 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('recommendation_Response', $choiceResponse, 1);
|
895 |
+
$results = array();
|
896 |
+
/** @var \com\boxalino\p13n\api\thrift\Variant $variant */
|
897 |
+
foreach ($choiceResponse->variants as $variantId => $variant) {
|
898 |
+
$name = $variantNames[$variantId];
|
899 |
+
foreach ($variant->searchResult->hits as $item) {
|
900 |
+
$result = array();
|
901 |
+
foreach ($item->values as $key => $value) {
|
902 |
+
if (is_array($value) && count($value) == 1) {
|
903 |
+
$result[$key] = array_shift($value);
|
904 |
+
} else {
|
905 |
+
$result[$key] = $value;
|
906 |
+
}
|
907 |
+
}
|
908 |
+
if (!isset($result['name']) && isset($result['title'])) {
|
909 |
+
$result['name'] = $result['title'];
|
910 |
+
}
|
911 |
+
|
912 |
+
$result['_rule'] = $name . ':' . $variant->scenarioId . ':' . $variant->variantId;
|
913 |
+
$result['_choice'] = $name;
|
914 |
+
$result['_scenario'] = $variant->scenarioId;
|
915 |
+
$result['_variant'] = $variant->variantId;
|
916 |
+
$results[$name][] = $result;
|
917 |
+
}
|
918 |
+
}
|
919 |
+
return $results;
|
920 |
+
}
|
921 |
+
|
922 |
+
/**
|
923 |
+
* @param string $account
|
924 |
+
* @param array $authData
|
925 |
+
* @param string $language
|
926 |
+
* @param bool $isDevelopment
|
927 |
+
* @param int $entityIdFieldName
|
928 |
+
*/
|
929 |
+
public function createRecommendation($account, $authData, $language, $entityIdFieldName, $isDevelopment = false)
|
930 |
+
{
|
931 |
+
|
932 |
+
$this->productIdFieldName = $entityIdFieldName;
|
933 |
+
|
934 |
+
$this->account = $account;
|
935 |
+
$this->language = $language;
|
936 |
+
$this->isDevelopment = $isDevelopment;
|
937 |
+
// Created here first to load necessary files
|
938 |
+
$this->p13n = $this->createP13n($authData);
|
939 |
+
}
|
940 |
+
|
941 |
+
/**
|
942 |
+
* @return P13n
|
943 |
+
*/
|
944 |
+
private function createP13n($authData)
|
945 |
+
{
|
946 |
+
$p13n = new HttpP13n();
|
947 |
+
$p13n->setHost($this->p13nServerHost);
|
948 |
+
$p13n->setAuthorization($authData['username'], $authData['password']);
|
949 |
+
return $p13n;
|
950 |
+
}
|
951 |
+
|
952 |
+
/**
|
953 |
+
* @return \com\boxalino\p13n\api\thrift\ChoiceRequest
|
954 |
+
*/
|
955 |
+
protected function createRecommendationChoiceRequest()
|
956 |
+
{
|
957 |
+
$choiceRequest = new \com\boxalino\p13n\api\thrift\ChoiceRequest();
|
958 |
+
$choiceRequest->profileId = $this->getVisitorId();
|
959 |
+
|
960 |
+
$userRecord = new \com\boxalino\p13n\api\thrift\UserRecord();
|
961 |
+
$userRecord->username = $this->account;
|
962 |
+
|
963 |
+
$choiceRequest->userRecord = $userRecord;
|
964 |
+
|
965 |
+
return $choiceRequest;
|
966 |
+
}
|
967 |
+
|
968 |
+
/**
|
969 |
+
* @return string
|
970 |
+
*/
|
971 |
+
protected function getVisitorId()
|
972 |
+
{
|
973 |
+
$profileid = null;
|
974 |
+
if (empty($_COOKIE['cemv'])) {
|
975 |
+
$profileid = '';
|
976 |
+
if (function_exists('openssl_random_pseudo_bytes')) {
|
977 |
+
$profileid = bin2hex(openssl_random_pseudo_bytes(16));
|
978 |
+
}
|
979 |
+
if (empty($profileid)) {
|
980 |
+
$profileid = uniqid('', true);
|
981 |
+
}
|
982 |
+
} else {
|
983 |
+
$profileid = $_COOKIE['cemv'];
|
984 |
+
}
|
985 |
+
|
986 |
+
return $profileid;
|
987 |
+
}
|
988 |
+
|
989 |
+
/**
|
990 |
+
* @param string $name Choice name
|
991 |
+
* @param string|null $scope Choice scope (null for default)
|
992 |
+
* @return \com\boxalino\p13n\api\thrift\ChoiceInquiry
|
993 |
+
*/
|
994 |
+
protected function createRecommendationChoiceInquiry($name, $scope = null)
|
995 |
+
{
|
996 |
+
$inquiry = new \com\boxalino\p13n\api\thrift\ChoiceInquiry();
|
997 |
+
$inquiry->choiceId = $name;
|
998 |
+
if ($scope !== null) {
|
999 |
+
$inquiry->scope = $scope;
|
1000 |
+
}
|
1001 |
+
return $inquiry;
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
/**
|
1005 |
+
* @param array $returnFields
|
1006 |
+
* @param string|null $query
|
1007 |
+
* @return \com\boxalino\p13n\api\thrift\SimpleSearchQuery
|
1008 |
+
*/
|
1009 |
+
protected function createRecommendationSearchQuery(array $returnFields, $query = null)
|
1010 |
+
{
|
1011 |
+
$searchQuery = new \com\boxalino\p13n\api\thrift\SimpleSearchQuery();
|
1012 |
+
$searchQuery->indexId = $this->account;
|
1013 |
+
if ($query !== null) {
|
1014 |
+
$searchQuery->queryText = $query;
|
1015 |
+
}
|
1016 |
+
$searchQuery->language = $this->language;
|
1017 |
+
$searchQuery->returnFields = $returnFields;
|
1018 |
+
|
1019 |
+
return $searchQuery;
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
/**
|
1023 |
+
* @return string
|
1024 |
+
*/
|
1025 |
+
protected function getBigDataHost()
|
1026 |
+
{
|
1027 |
+
$hostname = gethostname();
|
1028 |
+
if (preg_match('#^c[0-9]+n([0-9]+)$#', $hostname, $match)) {
|
1029 |
+
return 'bd' . $match[1] . '.bx-cloud.com';
|
1030 |
+
}
|
1031 |
+
return $this->p13nServerHost;
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
public function getSearchQuery()
|
1035 |
+
{
|
1036 |
+
return $this->searchQuery;
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
}
|
app/code/local/Boxalino/CemSearch/Helper/P13n/Client.php
DELETED
@@ -1,229 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Boxalino_CemSearch_Helper_P13n_Client
|
4 |
-
{
|
5 |
-
protected $p13nServerHost = 'cdn.bx-cloud.com';
|
6 |
-
protected $p13nServerPort = 443;
|
7 |
-
protected $productIdFieldName;
|
8 |
-
protected $account;
|
9 |
-
protected $password;
|
10 |
-
protected $language;
|
11 |
-
protected $isDevelopment = false;
|
12 |
-
protected $p13n;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @param string $account
|
16 |
-
* @param array $authData
|
17 |
-
* @param string $language
|
18 |
-
* @param bool $isDevelopment
|
19 |
-
* @param int $entityIdFieldName
|
20 |
-
*/
|
21 |
-
public function __construct($account, $authData, $language, $entityIdFieldName, $isDevelopment = false)
|
22 |
-
{
|
23 |
-
|
24 |
-
$this->productIdFieldName = $entityIdFieldName;
|
25 |
-
|
26 |
-
$this->account = $account;
|
27 |
-
$this->language = $language;
|
28 |
-
$this->isDevelopment = $isDevelopment;
|
29 |
-
// Created here first to load necessary files
|
30 |
-
$this->p13n = $this->createP13n($authData);
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @return P13n
|
35 |
-
*/
|
36 |
-
private function createP13n($authData)
|
37 |
-
{
|
38 |
-
$p13n = new HttpP13n();
|
39 |
-
$p13n->setHost($this->p13nServerHost);
|
40 |
-
$p13n->setAuthorization($authData['username'], $authData['password']);
|
41 |
-
return $p13n;
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @param string $name
|
46 |
-
* @param array $returnFields
|
47 |
-
* @param int|null $minimumRecommendations
|
48 |
-
* @param int|null $maximumRecommendations
|
49 |
-
* @param string|null $scenario
|
50 |
-
* @return array
|
51 |
-
*/
|
52 |
-
public function getPersonalRecommendations(array $widgets, array $returnFields, $widgetType)
|
53 |
-
{
|
54 |
-
$variantNames = array();
|
55 |
-
$choiceRequest = $this->createChoiceRequest();
|
56 |
-
foreach($widgets as $widget) {
|
57 |
-
$name = $widget['name'];
|
58 |
-
$variantNames[] = $name;
|
59 |
-
$minimumRecommendations = (float) $widget['min_recs'];
|
60 |
-
$maximumRecommendations = (float) $widget['max_recs'];
|
61 |
-
if ($maximumRecommendations === null) {
|
62 |
-
$maximumRecommendations = 5;
|
63 |
-
}
|
64 |
-
|
65 |
-
$inquiry = $this->createChoiceInquiry($name);
|
66 |
-
|
67 |
-
$searchQuery = $this->createSearchQuery($returnFields);
|
68 |
-
$searchQuery->offset = 0;
|
69 |
-
$searchQuery->hitCount = $maximumRecommendations;
|
70 |
-
|
71 |
-
$inquiry->simpleSearchQuery = $searchQuery;
|
72 |
-
$inquiry->minHitCount = $minimumRecommendations;
|
73 |
-
if ($widgetType === 'basket' && $_REQUEST['basketContent']) {
|
74 |
-
$basketContent = json_decode($_REQUEST['basketContent'], true);
|
75 |
-
if ($basketContent !== false && count($basketContent)) {
|
76 |
-
$contextItems = array();
|
77 |
-
|
78 |
-
// Sort basket content by price
|
79 |
-
usort($basketContent, function ($a, $b) {
|
80 |
-
if ($a['price'] > $b['price']) {
|
81 |
-
return -1;
|
82 |
-
} elseif ($b['price'] > $a['price']) {
|
83 |
-
return 1;
|
84 |
-
}
|
85 |
-
return 0;
|
86 |
-
});
|
87 |
-
|
88 |
-
$basketItem = array_shift($basketContent);
|
89 |
-
|
90 |
-
$contextItem = new \com\boxalino\p13n\api\thrift\ContextItem();
|
91 |
-
$contextItem->indexId = $this->account;
|
92 |
-
$contextItem->fieldName = $this->productIdFieldName;
|
93 |
-
$contextItem->contextItemId = $basketItem['id'];
|
94 |
-
$contextItem->role = 'mainProduct';
|
95 |
-
|
96 |
-
$contextItems[] = $contextItem;
|
97 |
-
|
98 |
-
foreach ($basketContent as $basketItem) {
|
99 |
-
$contextItem = new \com\boxalino\p13n\api\thrift\ContextItem();
|
100 |
-
$contextItem->indexId = $this->account;
|
101 |
-
$contextItem->fieldName = $this->productIdFieldName;
|
102 |
-
$contextItem->contextItemId = $basketItem['id'];
|
103 |
-
$contextItem->role = 'subProduct';
|
104 |
-
|
105 |
-
$contextItems[] = $contextItem;
|
106 |
-
}
|
107 |
-
$inquiry->contextItems = $contextItems;
|
108 |
-
}
|
109 |
-
} elseif ($widgetType === 'product' && !empty($_REQUEST['productId'])) {
|
110 |
-
$productId = $_REQUEST['productId'];
|
111 |
-
$contextItem = new \com\boxalino\p13n\api\thrift\ContextItem();
|
112 |
-
$contextItem->indexId = $this->account;
|
113 |
-
$contextItem->fieldName = $this->productIdFieldName;
|
114 |
-
$contextItem->contextItemId = $productId;
|
115 |
-
$contextItem->role = 'mainProduct';
|
116 |
-
$inquiry->contextItems = array($contextItem);
|
117 |
-
}
|
118 |
-
$choiceRequest->inquiries[] = $inquiry;
|
119 |
-
}
|
120 |
-
$choiceResponse = $this->p13n->choose($choiceRequest);
|
121 |
-
$results = array();
|
122 |
-
/** @var \com\boxalino\p13n\api\thrift\Variant $variant */
|
123 |
-
foreach ($choiceResponse->variants as $variantId => $variant) {
|
124 |
-
$name = $variantNames[$variantId];
|
125 |
-
foreach ($variant->searchResult->hits as $item) {
|
126 |
-
$result = array();
|
127 |
-
foreach ($item->values as $key => $value) {
|
128 |
-
if (is_array($value) && count($value) == 1) {
|
129 |
-
$result[$key] = array_shift($value);
|
130 |
-
} else {
|
131 |
-
$result[$key] = $value;
|
132 |
-
}
|
133 |
-
}
|
134 |
-
if (!isset($result['name']) && isset($result['title'])) {
|
135 |
-
$result['name'] = $result['title'];
|
136 |
-
}
|
137 |
-
|
138 |
-
$result['_rule'] = $name . ':' . $variant->scenarioId . ':' . $variant->variantId;
|
139 |
-
$result['_choice'] = $name;
|
140 |
-
$result['_scenario'] = $variant->scenarioId;
|
141 |
-
$result['_variant'] = $variant->variantId;
|
142 |
-
$results[$name][] = $result;
|
143 |
-
}
|
144 |
-
}
|
145 |
-
return $results;
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* @return \com\boxalino\p13n\api\thrift\ChoiceRequest
|
150 |
-
*/
|
151 |
-
protected function createChoiceRequest()
|
152 |
-
{
|
153 |
-
$choiceRequest = new \com\boxalino\p13n\api\thrift\ChoiceRequest();
|
154 |
-
$choiceRequest->profileId = $this->getVisitorId();
|
155 |
-
|
156 |
-
$userRecord = new \com\boxalino\p13n\api\thrift\UserRecord();
|
157 |
-
$userRecord->username = $this->account;
|
158 |
-
|
159 |
-
$choiceRequest->userRecord = $userRecord;
|
160 |
-
|
161 |
-
return $choiceRequest;
|
162 |
-
}
|
163 |
-
|
164 |
-
/**
|
165 |
-
* @return string
|
166 |
-
*/
|
167 |
-
protected function getVisitorId()
|
168 |
-
{
|
169 |
-
$profileid = null;
|
170 |
-
if (empty($_COOKIE['cemv'])) {
|
171 |
-
$profileid = '';
|
172 |
-
if (function_exists('openssl_random_pseudo_bytes')) {
|
173 |
-
$profileid = bin2hex(openssl_random_pseudo_bytes(16));
|
174 |
-
}
|
175 |
-
if (empty($profileid)) {
|
176 |
-
$profileid = uniqid('', true);
|
177 |
-
}
|
178 |
-
} else {
|
179 |
-
$profileid = $_COOKIE['cemv'];
|
180 |
-
}
|
181 |
-
|
182 |
-
return $profileid;
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* @param string $name Choice name
|
187 |
-
* @param string|null $scope Choice scope (null for default)
|
188 |
-
* @return \com\boxalino\p13n\api\thrift\ChoiceInquiry
|
189 |
-
*/
|
190 |
-
protected function createChoiceInquiry($name, $scope = null)
|
191 |
-
{
|
192 |
-
$inquiry = new \com\boxalino\p13n\api\thrift\ChoiceInquiry();
|
193 |
-
$inquiry->choiceId = $name;
|
194 |
-
if ($scope !== null) {
|
195 |
-
$inquiry->scope = $scope;
|
196 |
-
}
|
197 |
-
return $inquiry;
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* @param array $returnFields
|
202 |
-
* @param string|null $query
|
203 |
-
* @return \com\boxalino\p13n\api\thrift\SimpleSearchQuery
|
204 |
-
*/
|
205 |
-
protected function createSearchQuery(array $returnFields, $query = null)
|
206 |
-
{
|
207 |
-
$searchQuery = new \com\boxalino\p13n\api\thrift\SimpleSearchQuery();
|
208 |
-
$searchQuery->indexId = $this->account;
|
209 |
-
if ($query !== null) {
|
210 |
-
$searchQuery->queryText = $query;
|
211 |
-
}
|
212 |
-
$searchQuery->language = $this->language;
|
213 |
-
$searchQuery->returnFields = $returnFields;
|
214 |
-
|
215 |
-
return $searchQuery;
|
216 |
-
}
|
217 |
-
|
218 |
-
/**
|
219 |
-
* @return string
|
220 |
-
*/
|
221 |
-
protected function getBigDataHost()
|
222 |
-
{
|
223 |
-
$hostname = gethostname();
|
224 |
-
if (preg_match('#^c[0-9]+n([0-9]+)$#', $hostname, $match)) {
|
225 |
-
return 'bd' . $match[1] . '.bx-cloud.com';
|
226 |
-
}
|
227 |
-
return $this->p13nServerHost;
|
228 |
-
}
|
229 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Boxalino/CemSearch/Helper/P13n/Recommendation.php
CHANGED
@@ -18,10 +18,17 @@ class Boxalino_CemSearch_Helper_P13n_Recommendation
|
|
18 |
return $inst;
|
19 |
}
|
20 |
|
21 |
-
public function getRecommendation($widgetType, $widgetName)
|
22 |
{
|
23 |
-
if(empty($this->results)) {
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
if (empty($widgets)) {
|
26 |
return null;
|
27 |
}
|
@@ -36,9 +43,27 @@ class Boxalino_CemSearch_Helper_P13n_Recommendation
|
|
36 |
if (isset($entity_id) && $entity_id !== '') {
|
37 |
$entityIdFieldName = $entity_id;
|
38 |
}
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
$this->results = $p13nClient->getPersonalRecommendations($widgets, $returnFields, $widgetType);
|
41 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
return $this->results[$widgetName];
|
43 |
}
|
44 |
|
@@ -46,13 +71,14 @@ class Boxalino_CemSearch_Helper_P13n_Recommendation
|
|
46 |
{
|
47 |
$widgets = array();
|
48 |
$recommendations = Mage::getStoreConfig('Boxalino_Recommendation');
|
49 |
-
foreach($recommendations as $recommendation) {
|
50 |
-
if(
|
51 |
(!empty($recommendation['min']) || $recommendation['min'] >= 0) &&
|
52 |
(!empty($recommendation['max']) || $recommendation['max'] >= 0) &&
|
53 |
!empty($recommendation['scenario']) &&
|
54 |
($recommendation['min'] <= $recommendation['max']) &&
|
55 |
-
$recommendation['status'] == true
|
|
|
56 |
if ($recommendation['scenario'] == $widgetType) {
|
57 |
$widgets[] = array('name' => $recommendation['widget'], 'min_recs' => $recommendation['min'], 'max_recs' => $recommendation['max']);
|
58 |
}
|
18 |
return $inst;
|
19 |
}
|
20 |
|
21 |
+
public function getRecommendation($widgetType, $widgetName, $amount = 3)
|
22 |
{
|
23 |
+
if (empty($this->results)) {
|
24 |
+
if ($widgetType == '') {
|
25 |
+
$widgets = array(array(
|
26 |
+
'name' => $widgetName, 'min_recs' => 0, 'max_recs' => $amount
|
27 |
+
));
|
28 |
+
$widgetType = 'product';
|
29 |
+
} else {
|
30 |
+
$widgets = $this->prepareWidgets($widgetType);
|
31 |
+
}
|
32 |
if (empty($widgets)) {
|
33 |
return null;
|
34 |
}
|
43 |
if (isset($entity_id) && $entity_id !== '') {
|
44 |
$entityIdFieldName = $entity_id;
|
45 |
}
|
46 |
+
|
47 |
+
$storeConfig = Mage::getStoreConfig('Boxalino_General/general');
|
48 |
+
|
49 |
+
$p13nConfig = new Boxalino_CemSearch_Helper_P13n_Config(
|
50 |
+
$storeConfig['host'],
|
51 |
+
Mage::helper('Boxalino_CemSearch')->getAccount(),
|
52 |
+
$storeConfig['p13n_username'],
|
53 |
+
$storeConfig['p13n_password'],
|
54 |
+
$storeConfig['domain']
|
55 |
+
);
|
56 |
+
|
57 |
+
$p13nClient = new Boxalino_CemSearch_Helper_P13n_Adapter($p13nConfig);
|
58 |
+
$p13nClient->createRecommendation($account, $authData, $language, $entityIdFieldName, true);
|
59 |
$this->results = $p13nClient->getPersonalRecommendations($widgets, $returnFields, $widgetType);
|
60 |
}
|
61 |
+
|
62 |
+
// Added check in order to avoid PHP notice
|
63 |
+
if (!array_key_exists($widgetName, $this->results)) {
|
64 |
+
return null;
|
65 |
+
}
|
66 |
+
|
67 |
return $this->results[$widgetName];
|
68 |
}
|
69 |
|
71 |
{
|
72 |
$widgets = array();
|
73 |
$recommendations = Mage::getStoreConfig('Boxalino_Recommendation');
|
74 |
+
foreach ($recommendations as $recommendation) {
|
75 |
+
if (
|
76 |
(!empty($recommendation['min']) || $recommendation['min'] >= 0) &&
|
77 |
(!empty($recommendation['max']) || $recommendation['max'] >= 0) &&
|
78 |
!empty($recommendation['scenario']) &&
|
79 |
($recommendation['min'] <= $recommendation['max']) &&
|
80 |
+
$recommendation['status'] == true
|
81 |
+
) {
|
82 |
if ($recommendation['scenario'] == $widgetType) {
|
83 |
$widgets[] = array('name' => $recommendation['widget'], 'min_recs' => $recommendation['min'], 'max_recs' => $recommendation['max']);
|
84 |
}
|
app/code/local/Boxalino/CemSearch/Helper/P13n/Sort.php
CHANGED
@@ -20,7 +20,7 @@ class Boxalino_CemSearch_Helper_P13n_Sort
|
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
-
* @param $field name od field to sort by
|
24 |
* @param $reverse true for ASC, false for DESC
|
25 |
*/
|
26 |
public function push($field, $reverse)
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
+
* @param $field name od field to sort by (i.e. discountedPrice / title)
|
24 |
* @param $reverse true for ASC, false for DESC
|
25 |
*/
|
26 |
public function push($field, $reverse)
|
app/code/local/Boxalino/CemSearch/Lib/P13nService.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
namespace com\boxalino\p13n\api\thrift;
|
3 |
/**
|
4 |
-
* Autogenerated by Thrift Compiler (0.9.
|
5 |
*
|
6 |
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
7 |
* @generated
|
@@ -12,717 +12,1052 @@ use Thrift\Type\TMessageType;
|
|
12 |
use Thrift\Exception\TException;
|
13 |
use Thrift\Exception\TProtocolException;
|
14 |
use Thrift\Protocol\TProtocol;
|
|
|
15 |
use Thrift\Exception\TApplicationException;
|
16 |
|
17 |
|
18 |
interface P13nServiceIf {
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
|
24 |
class P13nServiceClient implements \com\boxalino\p13n\api\thrift\P13nServiceIf {
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
36 |
{
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
42 |
{
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
if ($bin_accel)
|
47 |
-
{
|
48 |
-
thrift_protocol_write_binary($this->output_, 'choose', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
|
49 |
-
}
|
50 |
-
else
|
51 |
-
{
|
52 |
-
$this->output_->writeMessageBegin('choose', TMessageType::CALL, $this->seqid_);
|
53 |
-
$args->write($this->output_);
|
54 |
-
$this->output_->writeMessageEnd();
|
55 |
-
$this->output_->getTransport()->flush();
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
public function recv_choose()
|
60 |
{
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
$this->input_->readMessageEnd();
|
74 |
-
throw $x;
|
75 |
-
}
|
76 |
-
$result = new \com\boxalino\p13n\api\thrift\P13nService_choose_result();
|
77 |
-
$result->read($this->input_);
|
78 |
-
$this->input_->readMessageEnd();
|
79 |
-
}
|
80 |
-
if ($result->success !== null) {
|
81 |
-
return $result->success;
|
82 |
-
}
|
83 |
-
if ($result->p13nServiceException !== null) {
|
84 |
-
throw $result->p13nServiceException;
|
85 |
-
}
|
86 |
-
throw new \Exception("choose failed: unknown result");
|
87 |
-
}
|
88 |
-
|
89 |
-
public function batchChoose(\com\boxalino\p13n\api\thrift\BatchChoiceRequest $batchChoiceRequest)
|
90 |
{
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
|
|
|
|
94 |
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
{
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
if ($bin_accel)
|
101 |
-
{
|
102 |
-
thrift_protocol_write_binary($this->output_, 'batchChoose', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
|
103 |
-
}
|
104 |
-
else
|
105 |
-
{
|
106 |
-
$this->output_->writeMessageBegin('batchChoose', TMessageType::CALL, $this->seqid_);
|
107 |
-
$args->write($this->output_);
|
108 |
-
$this->output_->writeMessageEnd();
|
109 |
-
$this->output_->getTransport()->flush();
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
public function recv_batchChoose()
|
114 |
{
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
$this->input_->readMessageEnd();
|
128 |
-
throw $x;
|
129 |
-
}
|
130 |
-
$result = new \com\boxalino\p13n\api\thrift\P13nService_batchChoose_result();
|
131 |
-
$result->read($this->input_);
|
132 |
-
$this->input_->readMessageEnd();
|
133 |
-
}
|
134 |
-
if ($result->success !== null) {
|
135 |
-
return $result->success;
|
136 |
-
}
|
137 |
-
if ($result->p13nServiceException !== null) {
|
138 |
-
throw $result->p13nServiceException;
|
139 |
-
}
|
140 |
-
throw new \Exception("batchChoose failed: unknown result");
|
141 |
-
}
|
142 |
-
|
143 |
-
public function autocomplete(\com\boxalino\p13n\api\thrift\AutocompleteRequest $request)
|
144 |
{
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
{
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
$this->output_->getTransport()->flush();
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
public function recv_autocomplete()
|
168 |
{
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
return $result->success;
|
190 |
-
}
|
191 |
-
if ($result->p13nServiceException !== null) {
|
192 |
-
throw $result->p13nServiceException;
|
193 |
-
}
|
194 |
-
throw new \Exception("autocomplete failed: unknown result");
|
195 |
}
|
|
|
|
|
196 |
|
197 |
}
|
198 |
|
199 |
// HELPER FUNCTIONS AND STRUCTURES
|
200 |
|
201 |
class P13nService_choose_args {
|
202 |
-
|
203 |
|
204 |
-
|
|
|
|
|
|
|
205 |
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
}
|
216 |
-
if (is_array($vals)) {
|
217 |
-
if (isset($vals['choiceRequest'])) {
|
218 |
-
$this->choiceRequest = $vals['choiceRequest'];
|
219 |
-
}
|
220 |
-
}
|
221 |
}
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
225 |
}
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
{
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
if ($this->choiceRequest !== null) {
|
264 |
-
if (!is_object($this->choiceRequest)) {
|
265 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
266 |
-
}
|
267 |
-
$xfer += $output->writeFieldBegin('choiceRequest', TType::STRUCT, -1);
|
268 |
-
$xfer += $this->choiceRequest->write($output);
|
269 |
-
$xfer += $output->writeFieldEnd();
|
270 |
-
}
|
271 |
-
$xfer += $output->writeFieldStop();
|
272 |
-
$xfer += $output->writeStructEnd();
|
273 |
-
return $xfer;
|
274 |
}
|
|
|
|
|
|
|
|
|
275 |
|
276 |
}
|
277 |
|
278 |
class P13nService_choose_result {
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
{
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
if ($this->success !== null) {
|
358 |
-
if (!is_object($this->success)) {
|
359 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
360 |
-
}
|
361 |
-
$xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
|
362 |
-
$xfer += $this->success->write($output);
|
363 |
-
$xfer += $output->writeFieldEnd();
|
364 |
-
}
|
365 |
-
if ($this->p13nServiceException !== null) {
|
366 |
-
$xfer += $output->writeFieldBegin('p13nServiceException', TType::STRUCT, 1);
|
367 |
-
$xfer += $this->p13nServiceException->write($output);
|
368 |
-
$xfer += $output->writeFieldEnd();
|
369 |
-
}
|
370 |
-
$xfer += $output->writeFieldStop();
|
371 |
-
$xfer += $output->writeStructEnd();
|
372 |
-
return $xfer;
|
373 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
375 |
}
|
376 |
|
377 |
class P13nService_batchChoose_args {
|
378 |
-
|
379 |
|
380 |
-
|
|
|
|
|
|
|
381 |
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
}
|
392 |
-
if (is_array($vals)) {
|
393 |
-
if (isset($vals['batchChoiceRequest'])) {
|
394 |
-
$this->batchChoiceRequest = $vals['batchChoiceRequest'];
|
395 |
-
}
|
396 |
-
}
|
397 |
}
|
398 |
-
|
399 |
-
|
400 |
-
|
|
|
401 |
}
|
|
|
|
|
|
|
|
|
|
|
402 |
|
403 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
{
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
}
|
425 |
-
break;
|
426 |
-
default:
|
427 |
-
$xfer += $input->skip($ftype);
|
428 |
-
break;
|
429 |
-
}
|
430 |
-
$xfer += $input->readFieldEnd();
|
431 |
-
}
|
432 |
-
$xfer += $input->readStructEnd();
|
433 |
-
return $xfer;
|
434 |
-
}
|
435 |
-
|
436 |
-
public function write($output) {
|
437 |
-
$xfer = 0;
|
438 |
-
$xfer += $output->writeStructBegin('P13nService_batchChoose_args');
|
439 |
-
if ($this->batchChoiceRequest !== null) {
|
440 |
-
if (!is_object($this->batchChoiceRequest)) {
|
441 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
442 |
-
}
|
443 |
-
$xfer += $output->writeFieldBegin('batchChoiceRequest', TType::STRUCT, -1);
|
444 |
-
$xfer += $this->batchChoiceRequest->write($output);
|
445 |
-
$xfer += $output->writeFieldEnd();
|
446 |
-
}
|
447 |
-
$xfer += $output->writeFieldStop();
|
448 |
-
$xfer += $output->writeStructEnd();
|
449 |
-
return $xfer;
|
450 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
|
452 |
}
|
453 |
|
454 |
class P13nService_batchChoose_result {
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
{
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
$xfer += $this->success->write($output);
|
539 |
-
$xfer += $output->writeFieldEnd();
|
540 |
-
}
|
541 |
-
if ($this->p13nServiceException !== null) {
|
542 |
-
$xfer += $output->writeFieldBegin('p13nServiceException', TType::STRUCT, 1);
|
543 |
-
$xfer += $this->p13nServiceException->write($output);
|
544 |
-
$xfer += $output->writeFieldEnd();
|
545 |
-
}
|
546 |
-
$xfer += $output->writeFieldStop();
|
547 |
-
$xfer += $output->writeStructEnd();
|
548 |
-
return $xfer;
|
549 |
}
|
|
|
|
|
|
|
|
|
550 |
|
551 |
}
|
552 |
|
553 |
class P13nService_autocomplete_args {
|
554 |
-
|
555 |
|
556 |
-
|
|
|
|
|
|
|
557 |
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
}
|
568 |
-
if (is_array($vals)) {
|
569 |
-
if (isset($vals['request'])) {
|
570 |
-
$this->request = $vals['request'];
|
571 |
-
}
|
572 |
-
}
|
573 |
}
|
574 |
-
|
575 |
-
|
576 |
-
|
|
|
577 |
}
|
|
|
578 |
|
579 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
{
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
if ($this->request !== null) {
|
616 |
-
if (!is_object($this->request)) {
|
617 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
618 |
-
}
|
619 |
-
$xfer += $output->writeFieldBegin('request', TType::STRUCT, -1);
|
620 |
-
$xfer += $this->request->write($output);
|
621 |
-
$xfer += $output->writeFieldEnd();
|
622 |
-
}
|
623 |
-
$xfer += $output->writeFieldStop();
|
624 |
-
$xfer += $output->writeStructEnd();
|
625 |
-
return $xfer;
|
626 |
}
|
|
|
|
|
|
|
|
|
627 |
|
628 |
}
|
629 |
|
630 |
class P13nService_autocomplete_result {
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
{
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
$xfer += $this->success->write($output);
|
715 |
-
$xfer += $output->writeFieldEnd();
|
716 |
-
}
|
717 |
-
if ($this->p13nServiceException !== null) {
|
718 |
-
$xfer += $output->writeFieldBegin('p13nServiceException', TType::STRUCT, 1);
|
719 |
-
$xfer += $this->p13nServiceException->write($output);
|
720 |
-
$xfer += $output->writeFieldEnd();
|
721 |
-
}
|
722 |
-
$xfer += $output->writeFieldStop();
|
723 |
-
$xfer += $output->writeStructEnd();
|
724 |
-
return $xfer;
|
725 |
}
|
|
|
|
|
|
|
|
|
726 |
|
727 |
}
|
728 |
|
1 |
<?php
|
2 |
namespace com\boxalino\p13n\api\thrift;
|
3 |
/**
|
4 |
+
* Autogenerated by Thrift Compiler (0.9.2)
|
5 |
*
|
6 |
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
7 |
* @generated
|
12 |
use Thrift\Exception\TException;
|
13 |
use Thrift\Exception\TProtocolException;
|
14 |
use Thrift\Protocol\TProtocol;
|
15 |
+
use Thrift\Protocol\TBinaryProtocolAccelerated;
|
16 |
use Thrift\Exception\TApplicationException;
|
17 |
|
18 |
|
19 |
interface P13nServiceIf {
|
20 |
+
/**
|
21 |
+
* <dl>
|
22 |
+
* <dt>@param choiceRequest</dt>
|
23 |
+
* <dd>the ChoiceRequest object containing your request</dd>
|
24 |
+
*
|
25 |
+
* <dt>@return</dt>
|
26 |
+
* <dd>a ChoiceResponse object containing the list of variants</dd>
|
27 |
+
*
|
28 |
+
* <dt>@throws P13nServiceException</dt>
|
29 |
+
* <dd>an exception containing an error message</dd>
|
30 |
+
* </dl>
|
31 |
+
*
|
32 |
+
* @param \com\boxalino\p13n\api\thrift\ChoiceRequest $choiceRequest
|
33 |
+
* @return \com\boxalino\p13n\api\thrift\ChoiceResponse list of personalized variants. Item's index corresponds to the index of the
|
34 |
+
* ChoiceInquiry
|
35 |
+
*
|
36 |
+
* @throws \com\boxalino\p13n\api\thrift\P13nServiceException
|
37 |
+
*/
|
38 |
+
public function choose(\com\boxalino\p13n\api\thrift\ChoiceRequest $choiceRequest);
|
39 |
+
/**
|
40 |
+
* <dl>
|
41 |
+
* <dt>@param batchChoiceRequest</dt>
|
42 |
+
* <dd>the BatchChoiceRequest object containing your requests</dd>
|
43 |
+
*
|
44 |
+
* <dt>@return</dt>
|
45 |
+
* <dd>a BatchChoiceResponse object containing the list of variants for each request</dd>
|
46 |
+
*
|
47 |
+
* <dt>@throws P13nServiceException</dt>
|
48 |
+
* <dd>an exception containing an error message</dd>
|
49 |
+
* </dl>
|
50 |
+
*
|
51 |
+
* @param \com\boxalino\p13n\api\thrift\BatchChoiceRequest $batchChoiceRequest
|
52 |
+
* @return \com\boxalino\p13n\api\thrift\BatchChoiceResponse <dl>
|
53 |
+
* <dt>variants</dt>
|
54 |
+
* <dd><b>deprecated</b> - contains non-null value only if
|
55 |
+
* corresponding BatchChoiceRequest had only one ChoiceInquiry</dd>
|
56 |
+
*
|
57 |
+
* <dt>selectedVariants</dt>
|
58 |
+
* <dd>outer list corresponds to profileIds given in BatchChoiceRequest, while
|
59 |
+
* inner list corresponds to list of ChoiceInquiries from BatchChoiceRequest</dd>
|
60 |
+
* </dl>
|
61 |
+
*
|
62 |
+
* @throws \com\boxalino\p13n\api\thrift\P13nServiceException
|
63 |
+
*/
|
64 |
+
public function batchChoose(\com\boxalino\p13n\api\thrift\BatchChoiceRequest $batchChoiceRequest);
|
65 |
+
/**
|
66 |
+
* <dl>
|
67 |
+
* <dt>@param request</dt>
|
68 |
+
* <dd>the AutocompleteRequest object containing your request</dd>
|
69 |
+
*
|
70 |
+
* <dt>@return</dt>
|
71 |
+
* <dd>a AutocompleteResponse object containing the list of hits</dd>
|
72 |
+
*
|
73 |
+
* <dt>@throws P13nServiceException</dt>
|
74 |
+
* <dd>an exception containing an error message</dd>
|
75 |
+
* </dl>
|
76 |
+
*
|
77 |
+
* @param \com\boxalino\p13n\api\thrift\AutocompleteRequest $request
|
78 |
+
* @return \com\boxalino\p13n\api\thrift\AutocompleteResponse
|
79 |
+
* @throws \com\boxalino\p13n\api\thrift\P13nServiceException
|
80 |
+
*/
|
81 |
+
public function autocomplete(\com\boxalino\p13n\api\thrift\AutocompleteRequest $request);
|
82 |
+
/**
|
83 |
+
* Updating a choice or creating a new choice if choiceId is not given in choiceUpdateRequest.
|
84 |
+
*
|
85 |
+
* @param \com\boxalino\p13n\api\thrift\ChoiceUpdateRequest $choiceUpdateRequest
|
86 |
+
* @return \com\boxalino\p13n\api\thrift\ChoiceUpdateResponse Server response for one ChoiceUpdateRequest
|
87 |
+
*
|
88 |
+
* @throws \com\boxalino\p13n\api\thrift\P13nServiceException
|
89 |
+
*/
|
90 |
+
public function updateChoice(\com\boxalino\p13n\api\thrift\ChoiceUpdateRequest $choiceUpdateRequest);
|
91 |
}
|
92 |
|
93 |
class P13nServiceClient implements \com\boxalino\p13n\api\thrift\P13nServiceIf {
|
94 |
+
protected $input_ = null;
|
95 |
+
protected $output_ = null;
|
96 |
|
97 |
+
protected $seqid_ = 0;
|
98 |
|
99 |
+
public function __construct($input, $output=null) {
|
100 |
+
$this->input_ = $input;
|
101 |
+
$this->output_ = $output ? $output : $input;
|
102 |
+
}
|
103 |
+
|
104 |
+
public function choose(\com\boxalino\p13n\api\thrift\ChoiceRequest $choiceRequest)
|
105 |
+
{
|
106 |
+
$this->send_choose($choiceRequest);
|
107 |
+
return $this->recv_choose();
|
108 |
+
}
|
109 |
+
|
110 |
+
public function send_choose(\com\boxalino\p13n\api\thrift\ChoiceRequest $choiceRequest)
|
111 |
+
{
|
112 |
+
$args = new \com\boxalino\p13n\api\thrift\P13nService_choose_args();
|
113 |
+
$args->choiceRequest = $choiceRequest;
|
114 |
+
$bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
|
115 |
+
if ($bin_accel)
|
116 |
+
{
|
117 |
+
thrift_protocol_write_binary($this->output_, 'choose', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
|
118 |
}
|
119 |
+
else
|
120 |
+
{
|
121 |
+
$this->output_->writeMessageBegin('choose', TMessageType::CALL, $this->seqid_);
|
122 |
+
$args->write($this->output_);
|
123 |
+
$this->output_->writeMessageEnd();
|
124 |
+
$this->output_->getTransport()->flush();
|
125 |
+
}
|
126 |
+
}
|
127 |
|
128 |
+
public function recv_choose()
|
129 |
+
{
|
130 |
+
$bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
|
131 |
+
if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\com\boxalino\p13n\api\thrift\P13nService_choose_result', $this->input_->isStrictRead());
|
132 |
+
else
|
133 |
{
|
134 |
+
$rseqid = 0;
|
135 |
+
$fname = null;
|
136 |
+
$mtype = 0;
|
137 |
+
|
138 |
+
$this->input_->readMessageBegin($fname, $mtype, $rseqid);
|
139 |
+
if ($mtype == TMessageType::EXCEPTION) {
|
140 |
+
$x = new TApplicationException();
|
141 |
+
$x->read($this->input_);
|
142 |
+
$this->input_->readMessageEnd();
|
143 |
+
throw $x;
|
144 |
+
}
|
145 |
+
$result = new \com\boxalino\p13n\api\thrift\P13nService_choose_result();
|
146 |
+
$result->read($this->input_);
|
147 |
+
$this->input_->readMessageEnd();
|
148 |
}
|
149 |
+
if ($result->success !== null) {
|
150 |
+
return $result->success;
|
151 |
+
}
|
152 |
+
if ($result->p13nServiceException !== null) {
|
153 |
+
throw $result->p13nServiceException;
|
154 |
+
}
|
155 |
+
throw new \Exception("choose failed: unknown result");
|
156 |
+
}
|
157 |
+
|
158 |
+
public function batchChoose(\com\boxalino\p13n\api\thrift\BatchChoiceRequest $batchChoiceRequest)
|
159 |
+
{
|
160 |
+
$this->send_batchChoose($batchChoiceRequest);
|
161 |
+
return $this->recv_batchChoose();
|
162 |
+
}
|
163 |
|
164 |
+
public function send_batchChoose(\com\boxalino\p13n\api\thrift\BatchChoiceRequest $batchChoiceRequest)
|
165 |
+
{
|
166 |
+
$args = new \com\boxalino\p13n\api\thrift\P13nService_batchChoose_args();
|
167 |
+
$args->batchChoiceRequest = $batchChoiceRequest;
|
168 |
+
$bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
|
169 |
+
if ($bin_accel)
|
170 |
{
|
171 |
+
thrift_protocol_write_binary($this->output_, 'batchChoose', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
|
172 |
+
}
|
173 |
+
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
{
|
175 |
+
$this->output_->writeMessageBegin('batchChoose', TMessageType::CALL, $this->seqid_);
|
176 |
+
$args->write($this->output_);
|
177 |
+
$this->output_->writeMessageEnd();
|
178 |
+
$this->output_->getTransport()->flush();
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
public function recv_batchChoose()
|
183 |
+
{
|
184 |
+
$bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
|
185 |
+
if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\com\boxalino\p13n\api\thrift\P13nService_batchChoose_result', $this->input_->isStrictRead());
|
186 |
+
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
{
|
188 |
+
$rseqid = 0;
|
189 |
+
$fname = null;
|
190 |
+
$mtype = 0;
|
191 |
+
|
192 |
+
$this->input_->readMessageBegin($fname, $mtype, $rseqid);
|
193 |
+
if ($mtype == TMessageType::EXCEPTION) {
|
194 |
+
$x = new TApplicationException();
|
195 |
+
$x->read($this->input_);
|
196 |
+
$this->input_->readMessageEnd();
|
197 |
+
throw $x;
|
198 |
+
}
|
199 |
+
$result = new \com\boxalino\p13n\api\thrift\P13nService_batchChoose_result();
|
200 |
+
$result->read($this->input_);
|
201 |
+
$this->input_->readMessageEnd();
|
202 |
+
}
|
203 |
+
if ($result->success !== null) {
|
204 |
+
return $result->success;
|
205 |
+
}
|
206 |
+
if ($result->p13nServiceException !== null) {
|
207 |
+
throw $result->p13nServiceException;
|
208 |
}
|
209 |
+
throw new \Exception("batchChoose failed: unknown result");
|
210 |
+
}
|
211 |
|
212 |
+
public function autocomplete(\com\boxalino\p13n\api\thrift\AutocompleteRequest $request)
|
213 |
+
{
|
214 |
+
$this->send_autocomplete($request);
|
215 |
+
return $this->recv_autocomplete();
|
216 |
+
}
|
217 |
+
|
218 |
+
public function send_autocomplete(\com\boxalino\p13n\api\thrift\AutocompleteRequest $request)
|
219 |
+
{
|
220 |
+
$args = new \com\boxalino\p13n\api\thrift\P13nService_autocomplete_args();
|
221 |
+
$args->request = $request;
|
222 |
+
$bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
|
223 |
+
if ($bin_accel)
|
224 |
{
|
225 |
+
thrift_protocol_write_binary($this->output_, 'autocomplete', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
|
226 |
+
}
|
227 |
+
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
{
|
229 |
+
$this->output_->writeMessageBegin('autocomplete', TMessageType::CALL, $this->seqid_);
|
230 |
+
$args->write($this->output_);
|
231 |
+
$this->output_->writeMessageEnd();
|
232 |
+
$this->output_->getTransport()->flush();
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
public function recv_autocomplete()
|
237 |
+
{
|
238 |
+
$bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
|
239 |
+
if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\com\boxalino\p13n\api\thrift\P13nService_autocomplete_result', $this->input_->isStrictRead());
|
240 |
+
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
{
|
242 |
+
$rseqid = 0;
|
243 |
+
$fname = null;
|
244 |
+
$mtype = 0;
|
245 |
+
|
246 |
+
$this->input_->readMessageBegin($fname, $mtype, $rseqid);
|
247 |
+
if ($mtype == TMessageType::EXCEPTION) {
|
248 |
+
$x = new TApplicationException();
|
249 |
+
$x->read($this->input_);
|
250 |
+
$this->input_->readMessageEnd();
|
251 |
+
throw $x;
|
252 |
+
}
|
253 |
+
$result = new \com\boxalino\p13n\api\thrift\P13nService_autocomplete_result();
|
254 |
+
$result->read($this->input_);
|
255 |
+
$this->input_->readMessageEnd();
|
256 |
+
}
|
257 |
+
if ($result->success !== null) {
|
258 |
+
return $result->success;
|
259 |
}
|
260 |
+
if ($result->p13nServiceException !== null) {
|
261 |
+
throw $result->p13nServiceException;
|
262 |
+
}
|
263 |
+
throw new \Exception("autocomplete failed: unknown result");
|
264 |
+
}
|
265 |
+
|
266 |
+
public function updateChoice(\com\boxalino\p13n\api\thrift\ChoiceUpdateRequest $choiceUpdateRequest)
|
267 |
+
{
|
268 |
+
$this->send_updateChoice($choiceUpdateRequest);
|
269 |
+
return $this->recv_updateChoice();
|
270 |
+
}
|
271 |
|
272 |
+
public function send_updateChoice(\com\boxalino\p13n\api\thrift\ChoiceUpdateRequest $choiceUpdateRequest)
|
273 |
+
{
|
274 |
+
$args = new \com\boxalino\p13n\api\thrift\P13nService_updateChoice_args();
|
275 |
+
$args->choiceUpdateRequest = $choiceUpdateRequest;
|
276 |
+
$bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
|
277 |
+
if ($bin_accel)
|
278 |
+
{
|
279 |
+
thrift_protocol_write_binary($this->output_, 'updateChoice', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
|
280 |
+
}
|
281 |
+
else
|
282 |
{
|
283 |
+
$this->output_->writeMessageBegin('updateChoice', TMessageType::CALL, $this->seqid_);
|
284 |
+
$args->write($this->output_);
|
285 |
+
$this->output_->writeMessageEnd();
|
286 |
+
$this->output_->getTransport()->flush();
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
public function recv_updateChoice()
|
291 |
+
{
|
292 |
+
$bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
|
293 |
+
if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\com\boxalino\p13n\api\thrift\P13nService_updateChoice_result', $this->input_->isStrictRead());
|
294 |
+
else
|
|
|
|
|
|
|
|
|
|
|
295 |
{
|
296 |
+
$rseqid = 0;
|
297 |
+
$fname = null;
|
298 |
+
$mtype = 0;
|
299 |
+
|
300 |
+
$this->input_->readMessageBegin($fname, $mtype, $rseqid);
|
301 |
+
if ($mtype == TMessageType::EXCEPTION) {
|
302 |
+
$x = new TApplicationException();
|
303 |
+
$x->read($this->input_);
|
304 |
+
$this->input_->readMessageEnd();
|
305 |
+
throw $x;
|
306 |
+
}
|
307 |
+
$result = new \com\boxalino\p13n\api\thrift\P13nService_updateChoice_result();
|
308 |
+
$result->read($this->input_);
|
309 |
+
$this->input_->readMessageEnd();
|
310 |
+
}
|
311 |
+
if ($result->success !== null) {
|
312 |
+
return $result->success;
|
313 |
+
}
|
314 |
+
if ($result->p13nServiceException !== null) {
|
315 |
+
throw $result->p13nServiceException;
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
}
|
317 |
+
throw new \Exception("updateChoice failed: unknown result");
|
318 |
+
}
|
319 |
|
320 |
}
|
321 |
|
322 |
// HELPER FUNCTIONS AND STRUCTURES
|
323 |
|
324 |
class P13nService_choose_args {
|
325 |
+
static $_TSPEC;
|
326 |
|
327 |
+
/**
|
328 |
+
* @var \com\boxalino\p13n\api\thrift\ChoiceRequest
|
329 |
+
*/
|
330 |
+
public $choiceRequest = null;
|
331 |
|
332 |
+
public function __construct($vals=null) {
|
333 |
+
if (!isset(self::$_TSPEC)) {
|
334 |
+
self::$_TSPEC = array(
|
335 |
+
-1 => array(
|
336 |
+
'var' => 'choiceRequest',
|
337 |
+
'type' => TType::STRUCT,
|
338 |
+
'class' => '\com\boxalino\p13n\api\thrift\ChoiceRequest',
|
339 |
+
),
|
340 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
}
|
342 |
+
if (is_array($vals)) {
|
343 |
+
if (isset($vals['choiceRequest'])) {
|
344 |
+
$this->choiceRequest = $vals['choiceRequest'];
|
345 |
+
}
|
346 |
}
|
347 |
+
}
|
348 |
+
|
349 |
+
public function getName() {
|
350 |
+
return 'P13nService_choose_args';
|
351 |
+
}
|
352 |
|
353 |
+
public function read($input)
|
354 |
+
{
|
355 |
+
$xfer = 0;
|
356 |
+
$fname = null;
|
357 |
+
$ftype = 0;
|
358 |
+
$fid = 0;
|
359 |
+
$xfer += $input->readStructBegin($fname);
|
360 |
+
while (true)
|
361 |
{
|
362 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
363 |
+
if ($ftype == TType::STOP) {
|
364 |
+
break;
|
365 |
+
}
|
366 |
+
switch ($fid)
|
367 |
+
{
|
368 |
+
case -1:
|
369 |
+
if ($ftype == TType::STRUCT) {
|
370 |
+
$this->choiceRequest = new \com\boxalino\p13n\api\thrift\ChoiceRequest();
|
371 |
+
$xfer += $this->choiceRequest->read($input);
|
372 |
+
} else {
|
373 |
+
$xfer += $input->skip($ftype);
|
374 |
+
}
|
375 |
+
break;
|
376 |
+
default:
|
377 |
+
$xfer += $input->skip($ftype);
|
378 |
+
break;
|
379 |
+
}
|
380 |
+
$xfer += $input->readFieldEnd();
|
381 |
+
}
|
382 |
+
$xfer += $input->readStructEnd();
|
383 |
+
return $xfer;
|
384 |
+
}
|
385 |
+
|
386 |
+
public function write($output) {
|
387 |
+
$xfer = 0;
|
388 |
+
$xfer += $output->writeStructBegin('P13nService_choose_args');
|
389 |
+
if ($this->choiceRequest !== null) {
|
390 |
+
if (!is_object($this->choiceRequest)) {
|
391 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
392 |
+
}
|
393 |
+
$xfer += $output->writeFieldBegin('choiceRequest', TType::STRUCT, -1);
|
394 |
+
$xfer += $this->choiceRequest->write($output);
|
395 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
}
|
397 |
+
$xfer += $output->writeFieldStop();
|
398 |
+
$xfer += $output->writeStructEnd();
|
399 |
+
return $xfer;
|
400 |
+
}
|
401 |
|
402 |
}
|
403 |
|
404 |
class P13nService_choose_result {
|
405 |
+
static $_TSPEC;
|
406 |
+
|
407 |
+
/**
|
408 |
+
* @var \com\boxalino\p13n\api\thrift\ChoiceResponse
|
409 |
+
*/
|
410 |
+
public $success = null;
|
411 |
+
/**
|
412 |
+
* @var \com\boxalino\p13n\api\thrift\P13nServiceException
|
413 |
+
*/
|
414 |
+
public $p13nServiceException = null;
|
415 |
+
|
416 |
+
public function __construct($vals=null) {
|
417 |
+
if (!isset(self::$_TSPEC)) {
|
418 |
+
self::$_TSPEC = array(
|
419 |
+
0 => array(
|
420 |
+
'var' => 'success',
|
421 |
+
'type' => TType::STRUCT,
|
422 |
+
'class' => '\com\boxalino\p13n\api\thrift\ChoiceResponse',
|
423 |
+
),
|
424 |
+
1 => array(
|
425 |
+
'var' => 'p13nServiceException',
|
426 |
+
'type' => TType::STRUCT,
|
427 |
+
'class' => '\com\boxalino\p13n\api\thrift\P13nServiceException',
|
428 |
+
),
|
429 |
+
);
|
430 |
+
}
|
431 |
+
if (is_array($vals)) {
|
432 |
+
if (isset($vals['success'])) {
|
433 |
+
$this->success = $vals['success'];
|
434 |
+
}
|
435 |
+
if (isset($vals['p13nServiceException'])) {
|
436 |
+
$this->p13nServiceException = $vals['p13nServiceException'];
|
437 |
+
}
|
438 |
+
}
|
439 |
+
}
|
440 |
+
|
441 |
+
public function getName() {
|
442 |
+
return 'P13nService_choose_result';
|
443 |
+
}
|
444 |
+
|
445 |
+
public function read($input)
|
446 |
+
{
|
447 |
+
$xfer = 0;
|
448 |
+
$fname = null;
|
449 |
+
$ftype = 0;
|
450 |
+
$fid = 0;
|
451 |
+
$xfer += $input->readStructBegin($fname);
|
452 |
+
while (true)
|
453 |
{
|
454 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
455 |
+
if ($ftype == TType::STOP) {
|
456 |
+
break;
|
457 |
+
}
|
458 |
+
switch ($fid)
|
459 |
+
{
|
460 |
+
case 0:
|
461 |
+
if ($ftype == TType::STRUCT) {
|
462 |
+
$this->success = new \com\boxalino\p13n\api\thrift\ChoiceResponse();
|
463 |
+
$xfer += $this->success->read($input);
|
464 |
+
} else {
|
465 |
+
$xfer += $input->skip($ftype);
|
466 |
+
}
|
467 |
+
break;
|
468 |
+
case 1:
|
469 |
+
if ($ftype == TType::STRUCT) {
|
470 |
+
$this->p13nServiceException = new \com\boxalino\p13n\api\thrift\P13nServiceException();
|
471 |
+
$xfer += $this->p13nServiceException->read($input);
|
472 |
+
} else {
|
473 |
+
$xfer += $input->skip($ftype);
|
474 |
+
}
|
475 |
+
break;
|
476 |
+
default:
|
477 |
+
$xfer += $input->skip($ftype);
|
478 |
+
break;
|
479 |
+
}
|
480 |
+
$xfer += $input->readFieldEnd();
|
481 |
+
}
|
482 |
+
$xfer += $input->readStructEnd();
|
483 |
+
return $xfer;
|
484 |
+
}
|
485 |
+
|
486 |
+
public function write($output) {
|
487 |
+
$xfer = 0;
|
488 |
+
$xfer += $output->writeStructBegin('P13nService_choose_result');
|
489 |
+
if ($this->success !== null) {
|
490 |
+
if (!is_object($this->success)) {
|
491 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
492 |
+
}
|
493 |
+
$xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
|
494 |
+
$xfer += $this->success->write($output);
|
495 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
}
|
497 |
+
if ($this->p13nServiceException !== null) {
|
498 |
+
$xfer += $output->writeFieldBegin('p13nServiceException', TType::STRUCT, 1);
|
499 |
+
$xfer += $this->p13nServiceException->write($output);
|
500 |
+
$xfer += $output->writeFieldEnd();
|
501 |
+
}
|
502 |
+
$xfer += $output->writeFieldStop();
|
503 |
+
$xfer += $output->writeStructEnd();
|
504 |
+
return $xfer;
|
505 |
+
}
|
506 |
|
507 |
}
|
508 |
|
509 |
class P13nService_batchChoose_args {
|
510 |
+
static $_TSPEC;
|
511 |
|
512 |
+
/**
|
513 |
+
* @var \com\boxalino\p13n\api\thrift\BatchChoiceRequest
|
514 |
+
*/
|
515 |
+
public $batchChoiceRequest = null;
|
516 |
|
517 |
+
public function __construct($vals=null) {
|
518 |
+
if (!isset(self::$_TSPEC)) {
|
519 |
+
self::$_TSPEC = array(
|
520 |
+
-1 => array(
|
521 |
+
'var' => 'batchChoiceRequest',
|
522 |
+
'type' => TType::STRUCT,
|
523 |
+
'class' => '\com\boxalino\p13n\api\thrift\BatchChoiceRequest',
|
524 |
+
),
|
525 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
526 |
}
|
527 |
+
if (is_array($vals)) {
|
528 |
+
if (isset($vals['batchChoiceRequest'])) {
|
529 |
+
$this->batchChoiceRequest = $vals['batchChoiceRequest'];
|
530 |
+
}
|
531 |
}
|
532 |
+
}
|
533 |
+
|
534 |
+
public function getName() {
|
535 |
+
return 'P13nService_batchChoose_args';
|
536 |
+
}
|
537 |
|
538 |
+
public function read($input)
|
539 |
+
{
|
540 |
+
$xfer = 0;
|
541 |
+
$fname = null;
|
542 |
+
$ftype = 0;
|
543 |
+
$fid = 0;
|
544 |
+
$xfer += $input->readStructBegin($fname);
|
545 |
+
while (true)
|
546 |
{
|
547 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
548 |
+
if ($ftype == TType::STOP) {
|
549 |
+
break;
|
550 |
+
}
|
551 |
+
switch ($fid)
|
552 |
+
{
|
553 |
+
case -1:
|
554 |
+
if ($ftype == TType::STRUCT) {
|
555 |
+
$this->batchChoiceRequest = new \com\boxalino\p13n\api\thrift\BatchChoiceRequest();
|
556 |
+
$xfer += $this->batchChoiceRequest->read($input);
|
557 |
+
} else {
|
558 |
+
$xfer += $input->skip($ftype);
|
559 |
+
}
|
560 |
+
break;
|
561 |
+
default:
|
562 |
+
$xfer += $input->skip($ftype);
|
563 |
+
break;
|
564 |
+
}
|
565 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
}
|
567 |
+
$xfer += $input->readStructEnd();
|
568 |
+
return $xfer;
|
569 |
+
}
|
570 |
+
|
571 |
+
public function write($output) {
|
572 |
+
$xfer = 0;
|
573 |
+
$xfer += $output->writeStructBegin('P13nService_batchChoose_args');
|
574 |
+
if ($this->batchChoiceRequest !== null) {
|
575 |
+
if (!is_object($this->batchChoiceRequest)) {
|
576 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
577 |
+
}
|
578 |
+
$xfer += $output->writeFieldBegin('batchChoiceRequest', TType::STRUCT, -1);
|
579 |
+
$xfer += $this->batchChoiceRequest->write($output);
|
580 |
+
$xfer += $output->writeFieldEnd();
|
581 |
+
}
|
582 |
+
$xfer += $output->writeFieldStop();
|
583 |
+
$xfer += $output->writeStructEnd();
|
584 |
+
return $xfer;
|
585 |
+
}
|
586 |
|
587 |
}
|
588 |
|
589 |
class P13nService_batchChoose_result {
|
590 |
+
static $_TSPEC;
|
591 |
+
|
592 |
+
/**
|
593 |
+
* @var \com\boxalino\p13n\api\thrift\BatchChoiceResponse
|
594 |
+
*/
|
595 |
+
public $success = null;
|
596 |
+
/**
|
597 |
+
* @var \com\boxalino\p13n\api\thrift\P13nServiceException
|
598 |
+
*/
|
599 |
+
public $p13nServiceException = null;
|
600 |
+
|
601 |
+
public function __construct($vals=null) {
|
602 |
+
if (!isset(self::$_TSPEC)) {
|
603 |
+
self::$_TSPEC = array(
|
604 |
+
0 => array(
|
605 |
+
'var' => 'success',
|
606 |
+
'type' => TType::STRUCT,
|
607 |
+
'class' => '\com\boxalino\p13n\api\thrift\BatchChoiceResponse',
|
608 |
+
),
|
609 |
+
1 => array(
|
610 |
+
'var' => 'p13nServiceException',
|
611 |
+
'type' => TType::STRUCT,
|
612 |
+
'class' => '\com\boxalino\p13n\api\thrift\P13nServiceException',
|
613 |
+
),
|
614 |
+
);
|
615 |
+
}
|
616 |
+
if (is_array($vals)) {
|
617 |
+
if (isset($vals['success'])) {
|
618 |
+
$this->success = $vals['success'];
|
619 |
+
}
|
620 |
+
if (isset($vals['p13nServiceException'])) {
|
621 |
+
$this->p13nServiceException = $vals['p13nServiceException'];
|
622 |
+
}
|
623 |
+
}
|
624 |
+
}
|
625 |
+
|
626 |
+
public function getName() {
|
627 |
+
return 'P13nService_batchChoose_result';
|
628 |
+
}
|
629 |
+
|
630 |
+
public function read($input)
|
631 |
+
{
|
632 |
+
$xfer = 0;
|
633 |
+
$fname = null;
|
634 |
+
$ftype = 0;
|
635 |
+
$fid = 0;
|
636 |
+
$xfer += $input->readStructBegin($fname);
|
637 |
+
while (true)
|
638 |
{
|
639 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
640 |
+
if ($ftype == TType::STOP) {
|
641 |
+
break;
|
642 |
+
}
|
643 |
+
switch ($fid)
|
644 |
+
{
|
645 |
+
case 0:
|
646 |
+
if ($ftype == TType::STRUCT) {
|
647 |
+
$this->success = new \com\boxalino\p13n\api\thrift\BatchChoiceResponse();
|
648 |
+
$xfer += $this->success->read($input);
|
649 |
+
} else {
|
650 |
+
$xfer += $input->skip($ftype);
|
651 |
+
}
|
652 |
+
break;
|
653 |
+
case 1:
|
654 |
+
if ($ftype == TType::STRUCT) {
|
655 |
+
$this->p13nServiceException = new \com\boxalino\p13n\api\thrift\P13nServiceException();
|
656 |
+
$xfer += $this->p13nServiceException->read($input);
|
657 |
+
} else {
|
658 |
+
$xfer += $input->skip($ftype);
|
659 |
+
}
|
660 |
+
break;
|
661 |
+
default:
|
662 |
+
$xfer += $input->skip($ftype);
|
663 |
+
break;
|
664 |
+
}
|
665 |
+
$xfer += $input->readFieldEnd();
|
666 |
+
}
|
667 |
+
$xfer += $input->readStructEnd();
|
668 |
+
return $xfer;
|
669 |
+
}
|
670 |
+
|
671 |
+
public function write($output) {
|
672 |
+
$xfer = 0;
|
673 |
+
$xfer += $output->writeStructBegin('P13nService_batchChoose_result');
|
674 |
+
if ($this->success !== null) {
|
675 |
+
if (!is_object($this->success)) {
|
676 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
677 |
+
}
|
678 |
+
$xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
|
679 |
+
$xfer += $this->success->write($output);
|
680 |
+
$xfer += $output->writeFieldEnd();
|
681 |
+
}
|
682 |
+
if ($this->p13nServiceException !== null) {
|
683 |
+
$xfer += $output->writeFieldBegin('p13nServiceException', TType::STRUCT, 1);
|
684 |
+
$xfer += $this->p13nServiceException->write($output);
|
685 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
686 |
}
|
687 |
+
$xfer += $output->writeFieldStop();
|
688 |
+
$xfer += $output->writeStructEnd();
|
689 |
+
return $xfer;
|
690 |
+
}
|
691 |
|
692 |
}
|
693 |
|
694 |
class P13nService_autocomplete_args {
|
695 |
+
static $_TSPEC;
|
696 |
|
697 |
+
/**
|
698 |
+
* @var \com\boxalino\p13n\api\thrift\AutocompleteRequest
|
699 |
+
*/
|
700 |
+
public $request = null;
|
701 |
|
702 |
+
public function __construct($vals=null) {
|
703 |
+
if (!isset(self::$_TSPEC)) {
|
704 |
+
self::$_TSPEC = array(
|
705 |
+
-1 => array(
|
706 |
+
'var' => 'request',
|
707 |
+
'type' => TType::STRUCT,
|
708 |
+
'class' => '\com\boxalino\p13n\api\thrift\AutocompleteRequest',
|
709 |
+
),
|
710 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
711 |
}
|
712 |
+
if (is_array($vals)) {
|
713 |
+
if (isset($vals['request'])) {
|
714 |
+
$this->request = $vals['request'];
|
715 |
+
}
|
716 |
}
|
717 |
+
}
|
718 |
|
719 |
+
public function getName() {
|
720 |
+
return 'P13nService_autocomplete_args';
|
721 |
+
}
|
722 |
+
|
723 |
+
public function read($input)
|
724 |
+
{
|
725 |
+
$xfer = 0;
|
726 |
+
$fname = null;
|
727 |
+
$ftype = 0;
|
728 |
+
$fid = 0;
|
729 |
+
$xfer += $input->readStructBegin($fname);
|
730 |
+
while (true)
|
731 |
{
|
732 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
733 |
+
if ($ftype == TType::STOP) {
|
734 |
+
break;
|
735 |
+
}
|
736 |
+
switch ($fid)
|
737 |
+
{
|
738 |
+
case -1:
|
739 |
+
if ($ftype == TType::STRUCT) {
|
740 |
+
$this->request = new \com\boxalino\p13n\api\thrift\AutocompleteRequest();
|
741 |
+
$xfer += $this->request->read($input);
|
742 |
+
} else {
|
743 |
+
$xfer += $input->skip($ftype);
|
744 |
+
}
|
745 |
+
break;
|
746 |
+
default:
|
747 |
+
$xfer += $input->skip($ftype);
|
748 |
+
break;
|
749 |
+
}
|
750 |
+
$xfer += $input->readFieldEnd();
|
751 |
+
}
|
752 |
+
$xfer += $input->readStructEnd();
|
753 |
+
return $xfer;
|
754 |
+
}
|
755 |
+
|
756 |
+
public function write($output) {
|
757 |
+
$xfer = 0;
|
758 |
+
$xfer += $output->writeStructBegin('P13nService_autocomplete_args');
|
759 |
+
if ($this->request !== null) {
|
760 |
+
if (!is_object($this->request)) {
|
761 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
762 |
+
}
|
763 |
+
$xfer += $output->writeFieldBegin('request', TType::STRUCT, -1);
|
764 |
+
$xfer += $this->request->write($output);
|
765 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
766 |
}
|
767 |
+
$xfer += $output->writeFieldStop();
|
768 |
+
$xfer += $output->writeStructEnd();
|
769 |
+
return $xfer;
|
770 |
+
}
|
771 |
|
772 |
}
|
773 |
|
774 |
class P13nService_autocomplete_result {
|
775 |
+
static $_TSPEC;
|
776 |
+
|
777 |
+
/**
|
778 |
+
* @var \com\boxalino\p13n\api\thrift\AutocompleteResponse
|
779 |
+
*/
|
780 |
+
public $success = null;
|
781 |
+
/**
|
782 |
+
* @var \com\boxalino\p13n\api\thrift\P13nServiceException
|
783 |
+
*/
|
784 |
+
public $p13nServiceException = null;
|
785 |
+
|
786 |
+
public function __construct($vals=null) {
|
787 |
+
if (!isset(self::$_TSPEC)) {
|
788 |
+
self::$_TSPEC = array(
|
789 |
+
0 => array(
|
790 |
+
'var' => 'success',
|
791 |
+
'type' => TType::STRUCT,
|
792 |
+
'class' => '\com\boxalino\p13n\api\thrift\AutocompleteResponse',
|
793 |
+
),
|
794 |
+
1 => array(
|
795 |
+
'var' => 'p13nServiceException',
|
796 |
+
'type' => TType::STRUCT,
|
797 |
+
'class' => '\com\boxalino\p13n\api\thrift\P13nServiceException',
|
798 |
+
),
|
799 |
+
);
|
800 |
+
}
|
801 |
+
if (is_array($vals)) {
|
802 |
+
if (isset($vals['success'])) {
|
803 |
+
$this->success = $vals['success'];
|
804 |
+
}
|
805 |
+
if (isset($vals['p13nServiceException'])) {
|
806 |
+
$this->p13nServiceException = $vals['p13nServiceException'];
|
807 |
+
}
|
808 |
+
}
|
809 |
+
}
|
810 |
+
|
811 |
+
public function getName() {
|
812 |
+
return 'P13nService_autocomplete_result';
|
813 |
+
}
|
814 |
+
|
815 |
+
public function read($input)
|
816 |
+
{
|
817 |
+
$xfer = 0;
|
818 |
+
$fname = null;
|
819 |
+
$ftype = 0;
|
820 |
+
$fid = 0;
|
821 |
+
$xfer += $input->readStructBegin($fname);
|
822 |
+
while (true)
|
823 |
+
{
|
824 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
825 |
+
if ($ftype == TType::STOP) {
|
826 |
+
break;
|
827 |
+
}
|
828 |
+
switch ($fid)
|
829 |
+
{
|
830 |
+
case 0:
|
831 |
+
if ($ftype == TType::STRUCT) {
|
832 |
+
$this->success = new \com\boxalino\p13n\api\thrift\AutocompleteResponse();
|
833 |
+
$xfer += $this->success->read($input);
|
834 |
+
} else {
|
835 |
+
$xfer += $input->skip($ftype);
|
836 |
+
}
|
837 |
+
break;
|
838 |
+
case 1:
|
839 |
+
if ($ftype == TType::STRUCT) {
|
840 |
+
$this->p13nServiceException = new \com\boxalino\p13n\api\thrift\P13nServiceException();
|
841 |
+
$xfer += $this->p13nServiceException->read($input);
|
842 |
+
} else {
|
843 |
+
$xfer += $input->skip($ftype);
|
844 |
+
}
|
845 |
+
break;
|
846 |
+
default:
|
847 |
+
$xfer += $input->skip($ftype);
|
848 |
+
break;
|
849 |
+
}
|
850 |
+
$xfer += $input->readFieldEnd();
|
851 |
+
}
|
852 |
+
$xfer += $input->readStructEnd();
|
853 |
+
return $xfer;
|
854 |
+
}
|
855 |
+
|
856 |
+
public function write($output) {
|
857 |
+
$xfer = 0;
|
858 |
+
$xfer += $output->writeStructBegin('P13nService_autocomplete_result');
|
859 |
+
if ($this->success !== null) {
|
860 |
+
if (!is_object($this->success)) {
|
861 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
862 |
+
}
|
863 |
+
$xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
|
864 |
+
$xfer += $this->success->write($output);
|
865 |
+
$xfer += $output->writeFieldEnd();
|
866 |
+
}
|
867 |
+
if ($this->p13nServiceException !== null) {
|
868 |
+
$xfer += $output->writeFieldBegin('p13nServiceException', TType::STRUCT, 1);
|
869 |
+
$xfer += $this->p13nServiceException->write($output);
|
870 |
+
$xfer += $output->writeFieldEnd();
|
871 |
+
}
|
872 |
+
$xfer += $output->writeFieldStop();
|
873 |
+
$xfer += $output->writeStructEnd();
|
874 |
+
return $xfer;
|
875 |
+
}
|
876 |
+
|
877 |
+
}
|
878 |
+
|
879 |
+
class P13nService_updateChoice_args {
|
880 |
+
static $_TSPEC;
|
881 |
+
|
882 |
+
/**
|
883 |
+
* @var \com\boxalino\p13n\api\thrift\ChoiceUpdateRequest
|
884 |
+
*/
|
885 |
+
public $choiceUpdateRequest = null;
|
886 |
+
|
887 |
+
public function __construct($vals=null) {
|
888 |
+
if (!isset(self::$_TSPEC)) {
|
889 |
+
self::$_TSPEC = array(
|
890 |
+
-1 => array(
|
891 |
+
'var' => 'choiceUpdateRequest',
|
892 |
+
'type' => TType::STRUCT,
|
893 |
+
'class' => '\com\boxalino\p13n\api\thrift\ChoiceUpdateRequest',
|
894 |
+
),
|
895 |
+
);
|
896 |
+
}
|
897 |
+
if (is_array($vals)) {
|
898 |
+
if (isset($vals['choiceUpdateRequest'])) {
|
899 |
+
$this->choiceUpdateRequest = $vals['choiceUpdateRequest'];
|
900 |
+
}
|
901 |
+
}
|
902 |
+
}
|
903 |
+
|
904 |
+
public function getName() {
|
905 |
+
return 'P13nService_updateChoice_args';
|
906 |
+
}
|
907 |
+
|
908 |
+
public function read($input)
|
909 |
+
{
|
910 |
+
$xfer = 0;
|
911 |
+
$fname = null;
|
912 |
+
$ftype = 0;
|
913 |
+
$fid = 0;
|
914 |
+
$xfer += $input->readStructBegin($fname);
|
915 |
+
while (true)
|
916 |
+
{
|
917 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
918 |
+
if ($ftype == TType::STOP) {
|
919 |
+
break;
|
920 |
+
}
|
921 |
+
switch ($fid)
|
922 |
+
{
|
923 |
+
case -1:
|
924 |
+
if ($ftype == TType::STRUCT) {
|
925 |
+
$this->choiceUpdateRequest = new \com\boxalino\p13n\api\thrift\ChoiceUpdateRequest();
|
926 |
+
$xfer += $this->choiceUpdateRequest->read($input);
|
927 |
+
} else {
|
928 |
+
$xfer += $input->skip($ftype);
|
929 |
+
}
|
930 |
+
break;
|
931 |
+
default:
|
932 |
+
$xfer += $input->skip($ftype);
|
933 |
+
break;
|
934 |
+
}
|
935 |
+
$xfer += $input->readFieldEnd();
|
936 |
+
}
|
937 |
+
$xfer += $input->readStructEnd();
|
938 |
+
return $xfer;
|
939 |
+
}
|
940 |
+
|
941 |
+
public function write($output) {
|
942 |
+
$xfer = 0;
|
943 |
+
$xfer += $output->writeStructBegin('P13nService_updateChoice_args');
|
944 |
+
if ($this->choiceUpdateRequest !== null) {
|
945 |
+
if (!is_object($this->choiceUpdateRequest)) {
|
946 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
947 |
+
}
|
948 |
+
$xfer += $output->writeFieldBegin('choiceUpdateRequest', TType::STRUCT, -1);
|
949 |
+
$xfer += $this->choiceUpdateRequest->write($output);
|
950 |
+
$xfer += $output->writeFieldEnd();
|
951 |
+
}
|
952 |
+
$xfer += $output->writeFieldStop();
|
953 |
+
$xfer += $output->writeStructEnd();
|
954 |
+
return $xfer;
|
955 |
+
}
|
956 |
+
|
957 |
+
}
|
958 |
+
|
959 |
+
class P13nService_updateChoice_result {
|
960 |
+
static $_TSPEC;
|
961 |
+
|
962 |
+
/**
|
963 |
+
* @var \com\boxalino\p13n\api\thrift\ChoiceUpdateResponse
|
964 |
+
*/
|
965 |
+
public $success = null;
|
966 |
+
/**
|
967 |
+
* @var \com\boxalino\p13n\api\thrift\P13nServiceException
|
968 |
+
*/
|
969 |
+
public $p13nServiceException = null;
|
970 |
+
|
971 |
+
public function __construct($vals=null) {
|
972 |
+
if (!isset(self::$_TSPEC)) {
|
973 |
+
self::$_TSPEC = array(
|
974 |
+
0 => array(
|
975 |
+
'var' => 'success',
|
976 |
+
'type' => TType::STRUCT,
|
977 |
+
'class' => '\com\boxalino\p13n\api\thrift\ChoiceUpdateResponse',
|
978 |
+
),
|
979 |
+
1 => array(
|
980 |
+
'var' => 'p13nServiceException',
|
981 |
+
'type' => TType::STRUCT,
|
982 |
+
'class' => '\com\boxalino\p13n\api\thrift\P13nServiceException',
|
983 |
+
),
|
984 |
+
);
|
985 |
+
}
|
986 |
+
if (is_array($vals)) {
|
987 |
+
if (isset($vals['success'])) {
|
988 |
+
$this->success = $vals['success'];
|
989 |
+
}
|
990 |
+
if (isset($vals['p13nServiceException'])) {
|
991 |
+
$this->p13nServiceException = $vals['p13nServiceException'];
|
992 |
+
}
|
993 |
+
}
|
994 |
+
}
|
995 |
+
|
996 |
+
public function getName() {
|
997 |
+
return 'P13nService_updateChoice_result';
|
998 |
+
}
|
999 |
+
|
1000 |
+
public function read($input)
|
1001 |
+
{
|
1002 |
+
$xfer = 0;
|
1003 |
+
$fname = null;
|
1004 |
+
$ftype = 0;
|
1005 |
+
$fid = 0;
|
1006 |
+
$xfer += $input->readStructBegin($fname);
|
1007 |
+
while (true)
|
1008 |
{
|
1009 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
1010 |
+
if ($ftype == TType::STOP) {
|
1011 |
+
break;
|
1012 |
+
}
|
1013 |
+
switch ($fid)
|
1014 |
+
{
|
1015 |
+
case 0:
|
1016 |
+
if ($ftype == TType::STRUCT) {
|
1017 |
+
$this->success = new \com\boxalino\p13n\api\thrift\ChoiceUpdateResponse();
|
1018 |
+
$xfer += $this->success->read($input);
|
1019 |
+
} else {
|
1020 |
+
$xfer += $input->skip($ftype);
|
1021 |
+
}
|
1022 |
+
break;
|
1023 |
+
case 1:
|
1024 |
+
if ($ftype == TType::STRUCT) {
|
1025 |
+
$this->p13nServiceException = new \com\boxalino\p13n\api\thrift\P13nServiceException();
|
1026 |
+
$xfer += $this->p13nServiceException->read($input);
|
1027 |
+
} else {
|
1028 |
+
$xfer += $input->skip($ftype);
|
1029 |
+
}
|
1030 |
+
break;
|
1031 |
+
default:
|
1032 |
+
$xfer += $input->skip($ftype);
|
1033 |
+
break;
|
1034 |
+
}
|
1035 |
+
$xfer += $input->readFieldEnd();
|
1036 |
+
}
|
1037 |
+
$xfer += $input->readStructEnd();
|
1038 |
+
return $xfer;
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
public function write($output) {
|
1042 |
+
$xfer = 0;
|
1043 |
+
$xfer += $output->writeStructBegin('P13nService_updateChoice_result');
|
1044 |
+
if ($this->success !== null) {
|
1045 |
+
if (!is_object($this->success)) {
|
1046 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
1047 |
+
}
|
1048 |
+
$xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
|
1049 |
+
$xfer += $this->success->write($output);
|
1050 |
+
$xfer += $output->writeFieldEnd();
|
1051 |
+
}
|
1052 |
+
if ($this->p13nServiceException !== null) {
|
1053 |
+
$xfer += $output->writeFieldBegin('p13nServiceException', TType::STRUCT, 1);
|
1054 |
+
$xfer += $this->p13nServiceException->write($output);
|
1055 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1056 |
}
|
1057 |
+
$xfer += $output->writeFieldStop();
|
1058 |
+
$xfer += $output->writeStructEnd();
|
1059 |
+
return $xfer;
|
1060 |
+
}
|
1061 |
|
1062 |
}
|
1063 |
|
app/code/local/Boxalino/CemSearch/Lib/Types.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
namespace com\boxalino\p13n\api\thrift;
|
3 |
|
4 |
/**
|
5 |
-
* Autogenerated by Thrift Compiler (0.9.
|
6 |
*
|
7 |
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
8 |
* @generated
|
@@ -13,4567 +13,5574 @@ use Thrift\Type\TMessageType;
|
|
13 |
use Thrift\Exception\TException;
|
14 |
use Thrift\Exception\TProtocolException;
|
15 |
use Thrift\Protocol\TProtocol;
|
|
|
16 |
use Thrift\Exception\TApplicationException;
|
17 |
|
18 |
|
|
|
|
|
|
|
19 |
final class DateRangeGap {
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
}
|
41 |
|
|
|
|
|
|
|
42 |
final class FacetSortOrder {
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
class Filter {
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
$this->rangeToInclusive = $vals['rangeToInclusive'];
|
148 |
-
}
|
149 |
-
}
|
150 |
}
|
151 |
-
|
152 |
-
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
{
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
{
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
break;
|
202 |
-
case 4:
|
203 |
-
if ($ftype == TType::STRING) {
|
204 |
-
$xfer += $input->readString($this->prefix);
|
205 |
-
} else {
|
206 |
-
$xfer += $input->skip($ftype);
|
207 |
-
}
|
208 |
-
break;
|
209 |
-
case 41:
|
210 |
-
if ($ftype == TType::STRING) {
|
211 |
-
$xfer += $input->readString($this->hierarchyId);
|
212 |
-
} else {
|
213 |
-
$xfer += $input->skip($ftype);
|
214 |
-
}
|
215 |
-
break;
|
216 |
-
case 5:
|
217 |
-
if ($ftype == TType::LST) {
|
218 |
-
$this->hierarchy = array();
|
219 |
-
$_size6 = 0;
|
220 |
-
$_etype9 = 0;
|
221 |
-
$xfer += $input->readListBegin($_etype9, $_size6);
|
222 |
-
for ($_i10 = 0; $_i10 < $_size6; ++$_i10)
|
223 |
-
{
|
224 |
-
$elem11 = null;
|
225 |
-
$xfer += $input->readString($elem11);
|
226 |
-
$this->hierarchy []= $elem11;
|
227 |
-
}
|
228 |
-
$xfer += $input->readListEnd();
|
229 |
-
} else {
|
230 |
-
$xfer += $input->skip($ftype);
|
231 |
-
}
|
232 |
-
break;
|
233 |
-
case 6:
|
234 |
-
if ($ftype == TType::STRING) {
|
235 |
-
$xfer += $input->readString($this->rangeFrom);
|
236 |
-
} else {
|
237 |
-
$xfer += $input->skip($ftype);
|
238 |
-
}
|
239 |
-
break;
|
240 |
-
case 7:
|
241 |
-
if ($ftype == TType::BOOL) {
|
242 |
-
$xfer += $input->readBool($this->rangeFromInclusive);
|
243 |
-
} else {
|
244 |
-
$xfer += $input->skip($ftype);
|
245 |
-
}
|
246 |
-
break;
|
247 |
-
case 8:
|
248 |
-
if ($ftype == TType::STRING) {
|
249 |
-
$xfer += $input->readString($this->rangeTo);
|
250 |
-
} else {
|
251 |
-
$xfer += $input->skip($ftype);
|
252 |
-
}
|
253 |
-
break;
|
254 |
-
case 9:
|
255 |
-
if ($ftype == TType::BOOL) {
|
256 |
-
$xfer += $input->readBool($this->rangeToInclusive);
|
257 |
-
} else {
|
258 |
-
$xfer += $input->skip($ftype);
|
259 |
-
}
|
260 |
-
break;
|
261 |
-
default:
|
262 |
-
$xfer += $input->skip($ftype);
|
263 |
-
break;
|
264 |
-
}
|
265 |
-
$xfer += $input->readFieldEnd();
|
266 |
-
}
|
267 |
-
$xfer += $input->readStructEnd();
|
268 |
-
return $xfer;
|
269 |
-
}
|
270 |
-
|
271 |
-
public function write($output) {
|
272 |
-
$xfer = 0;
|
273 |
-
$xfer += $output->writeStructBegin('Filter');
|
274 |
-
if ($this->negative !== null) {
|
275 |
-
$xfer += $output->writeFieldBegin('negative', TType::BOOL, 1);
|
276 |
-
$xfer += $output->writeBool($this->negative);
|
277 |
-
$xfer += $output->writeFieldEnd();
|
278 |
-
}
|
279 |
-
if ($this->fieldName !== null) {
|
280 |
-
$xfer += $output->writeFieldBegin('fieldName', TType::STRING, 2);
|
281 |
-
$xfer += $output->writeString($this->fieldName);
|
282 |
-
$xfer += $output->writeFieldEnd();
|
283 |
-
}
|
284 |
-
if ($this->stringValues !== null) {
|
285 |
-
if (!is_array($this->stringValues)) {
|
286 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
287 |
-
}
|
288 |
-
$xfer += $output->writeFieldBegin('stringValues', TType::LST, 3);
|
289 |
{
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
$xfer += $
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
$xfer += $
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
$xfer += $
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
|
353 |
}
|
354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
class FacetValue {
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
$this->selected = $vals['selected'];
|
424 |
-
}
|
425 |
-
}
|
426 |
}
|
427 |
-
|
428 |
-
|
429 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
}
|
431 |
-
|
432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
{
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
{
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
case 4:
|
469 |
-
if ($ftype == TType::I64) {
|
470 |
-
$xfer += $input->readI64($this->hitCount);
|
471 |
-
} else {
|
472 |
-
$xfer += $input->skip($ftype);
|
473 |
-
}
|
474 |
-
break;
|
475 |
-
case 50:
|
476 |
-
if ($ftype == TType::STRING) {
|
477 |
-
$xfer += $input->readString($this->hierarchyId);
|
478 |
-
} else {
|
479 |
-
$xfer += $input->skip($ftype);
|
480 |
-
}
|
481 |
-
break;
|
482 |
-
case 60:
|
483 |
-
if ($ftype == TType::LST) {
|
484 |
-
$this->hierarchy = array();
|
485 |
-
$_size14 = 0;
|
486 |
-
$_etype17 = 0;
|
487 |
-
$xfer += $input->readListBegin($_etype17, $_size14);
|
488 |
-
for ($_i18 = 0; $_i18 < $_size14; ++$_i18)
|
489 |
-
{
|
490 |
-
$elem19 = null;
|
491 |
-
$xfer += $input->readString($elem19);
|
492 |
-
$this->hierarchy []= $elem19;
|
493 |
-
}
|
494 |
-
$xfer += $input->readListEnd();
|
495 |
-
} else {
|
496 |
-
$xfer += $input->skip($ftype);
|
497 |
-
}
|
498 |
-
break;
|
499 |
-
case 70:
|
500 |
-
if ($ftype == TType::BOOL) {
|
501 |
-
$xfer += $input->readBool($this->selected);
|
502 |
-
} else {
|
503 |
-
$xfer += $input->skip($ftype);
|
504 |
-
}
|
505 |
-
break;
|
506 |
-
default:
|
507 |
-
$xfer += $input->skip($ftype);
|
508 |
-
break;
|
509 |
-
}
|
510 |
-
$xfer += $input->readFieldEnd();
|
511 |
-
}
|
512 |
-
$xfer += $input->readStructEnd();
|
513 |
-
return $xfer;
|
514 |
}
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
547 |
-
}
|
548 |
-
$xfer += $output->writeFieldBegin('hierarchy', TType::LST, 60);
|
549 |
-
{
|
550 |
-
$output->writeListBegin(TType::STRING, count($this->hierarchy));
|
551 |
-
{
|
552 |
-
foreach ($this->hierarchy as $iter20)
|
553 |
-
{
|
554 |
-
$xfer += $output->writeString($iter20);
|
555 |
-
}
|
556 |
-
}
|
557 |
-
$output->writeListEnd();
|
558 |
-
}
|
559 |
-
$xfer += $output->writeFieldEnd();
|
560 |
-
}
|
561 |
-
if ($this->selected !== null) {
|
562 |
-
$xfer += $output->writeFieldBegin('selected', TType::BOOL, 70);
|
563 |
-
$xfer += $output->writeBool($this->selected);
|
564 |
-
$xfer += $output->writeFieldEnd();
|
565 |
-
}
|
566 |
-
$xfer += $output->writeFieldStop();
|
567 |
-
$xfer += $output->writeStructEnd();
|
568 |
-
return $xfer;
|
569 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
570 |
|
571 |
}
|
572 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
class FacetRequest {
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
$this->andSelectedValues = $vals['andSelectedValues'];
|
667 |
-
}
|
668 |
-
}
|
669 |
}
|
670 |
-
|
671 |
-
|
672 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
673 |
}
|
674 |
-
|
675 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
676 |
{
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
689 |
{
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
if ($ftype == TType::I32) {
|
713 |
-
$xfer += $input->readI32($this->maxCount);
|
714 |
-
} else {
|
715 |
-
$xfer += $input->skip($ftype);
|
716 |
-
}
|
717 |
-
break;
|
718 |
-
case 5:
|
719 |
-
if ($ftype == TType::I32) {
|
720 |
-
$xfer += $input->readI32($this->minPopulation);
|
721 |
-
} else {
|
722 |
-
$xfer += $input->skip($ftype);
|
723 |
-
}
|
724 |
-
break;
|
725 |
-
case 6:
|
726 |
-
if ($ftype == TType::I32) {
|
727 |
-
$xfer += $input->readI32($this->dateRangeGap);
|
728 |
-
} else {
|
729 |
-
$xfer += $input->skip($ftype);
|
730 |
-
}
|
731 |
-
break;
|
732 |
-
case 7:
|
733 |
-
if ($ftype == TType::I32) {
|
734 |
-
$xfer += $input->readI32($this->sortOrder);
|
735 |
-
} else {
|
736 |
-
$xfer += $input->skip($ftype);
|
737 |
-
}
|
738 |
-
break;
|
739 |
-
case 8:
|
740 |
-
if ($ftype == TType::BOOL) {
|
741 |
-
$xfer += $input->readBool($this->sortAscending);
|
742 |
-
} else {
|
743 |
-
$xfer += $input->skip($ftype);
|
744 |
-
}
|
745 |
-
break;
|
746 |
-
case 90:
|
747 |
-
if ($ftype == TType::LST) {
|
748 |
-
$this->selectedValues = array();
|
749 |
-
$_size21 = 0;
|
750 |
-
$_etype24 = 0;
|
751 |
-
$xfer += $input->readListBegin($_etype24, $_size21);
|
752 |
-
for ($_i25 = 0; $_i25 < $_size21; ++$_i25)
|
753 |
-
{
|
754 |
-
$elem26 = null;
|
755 |
-
$elem26 = new \com\boxalino\p13n\api\thrift\FacetValue();
|
756 |
-
$xfer += $elem26->read($input);
|
757 |
-
$this->selectedValues []= $elem26;
|
758 |
-
}
|
759 |
-
$xfer += $input->readListEnd();
|
760 |
-
} else {
|
761 |
-
$xfer += $input->skip($ftype);
|
762 |
-
}
|
763 |
-
break;
|
764 |
-
case 100:
|
765 |
-
if ($ftype == TType::BOOL) {
|
766 |
-
$xfer += $input->readBool($this->andSelectedValues);
|
767 |
-
} else {
|
768 |
-
$xfer += $input->skip($ftype);
|
769 |
-
}
|
770 |
-
break;
|
771 |
-
default:
|
772 |
-
$xfer += $input->skip($ftype);
|
773 |
-
break;
|
774 |
-
}
|
775 |
-
$xfer += $input->readFieldEnd();
|
776 |
-
}
|
777 |
-
$xfer += $input->readStructEnd();
|
778 |
-
return $xfer;
|
779 |
}
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
827 |
-
}
|
828 |
-
$xfer += $output->writeFieldBegin('selectedValues', TType::LST, 90);
|
829 |
-
{
|
830 |
-
$output->writeListBegin(TType::STRUCT, count($this->selectedValues));
|
831 |
-
{
|
832 |
-
foreach ($this->selectedValues as $iter27)
|
833 |
-
{
|
834 |
-
$xfer += $iter27->write($output);
|
835 |
-
}
|
836 |
-
}
|
837 |
-
$output->writeListEnd();
|
838 |
-
}
|
839 |
-
$xfer += $output->writeFieldEnd();
|
840 |
-
}
|
841 |
-
if ($this->andSelectedValues !== null) {
|
842 |
-
$xfer += $output->writeFieldBegin('andSelectedValues', TType::BOOL, 100);
|
843 |
-
$xfer += $output->writeBool($this->andSelectedValues);
|
844 |
-
$xfer += $output->writeFieldEnd();
|
845 |
-
}
|
846 |
-
$xfer += $output->writeFieldStop();
|
847 |
-
$xfer += $output->writeStructEnd();
|
848 |
-
return $xfer;
|
849 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
850 |
|
851 |
}
|
852 |
|
|
|
|
|
|
|
853 |
class SortField {
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
$this->reverse = $vals['reverse'];
|
878 |
-
}
|
879 |
-
}
|
880 |
}
|
881 |
-
|
882 |
-
|
883 |
-
|
|
|
|
|
|
|
|
|
884 |
}
|
885 |
-
|
886 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
887 |
{
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
}
|
914 |
-
break;
|
915 |
-
default:
|
916 |
-
$xfer += $input->skip($ftype);
|
917 |
-
break;
|
918 |
-
}
|
919 |
-
$xfer += $input->readFieldEnd();
|
920 |
-
}
|
921 |
-
$xfer += $input->readStructEnd();
|
922 |
-
return $xfer;
|
923 |
}
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
return $xfer;
|
941 |
}
|
|
|
|
|
|
|
|
|
942 |
|
943 |
}
|
944 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
945 |
class SimpleSearchQuery {
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
$this->groupItemsSortAscending = $vals['groupItemsSortAscending'];
|
1093 |
-
}
|
1094 |
-
}
|
1095 |
}
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1099 |
}
|
1100 |
-
|
1101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1102 |
{
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
case 4:
|
1138 |
-
if ($ftype == TType::LST) {
|
1139 |
-
$this->filters = array();
|
1140 |
-
$_size28 = 0;
|
1141 |
-
$_etype31 = 0;
|
1142 |
-
$xfer += $input->readListBegin($_etype31, $_size28);
|
1143 |
-
for ($_i32 = 0; $_i32 < $_size28; ++$_i32)
|
1144 |
-
{
|
1145 |
-
$elem33 = null;
|
1146 |
-
$elem33 = new \com\boxalino\p13n\api\thrift\Filter();
|
1147 |
-
$xfer += $elem33->read($input);
|
1148 |
-
$this->filters []= $elem33;
|
1149 |
-
}
|
1150 |
-
$xfer += $input->readListEnd();
|
1151 |
-
} else {
|
1152 |
-
$xfer += $input->skip($ftype);
|
1153 |
-
}
|
1154 |
-
break;
|
1155 |
-
case 5:
|
1156 |
-
if ($ftype == TType::BOOL) {
|
1157 |
-
$xfer += $input->readBool($this->orFilters);
|
1158 |
-
} else {
|
1159 |
-
$xfer += $input->skip($ftype);
|
1160 |
-
}
|
1161 |
-
break;
|
1162 |
-
case 6:
|
1163 |
-
if ($ftype == TType::LST) {
|
1164 |
-
$this->facetRequests = array();
|
1165 |
-
$_size34 = 0;
|
1166 |
-
$_etype37 = 0;
|
1167 |
-
$xfer += $input->readListBegin($_etype37, $_size34);
|
1168 |
-
for ($_i38 = 0; $_i38 < $_size34; ++$_i38)
|
1169 |
-
{
|
1170 |
-
$elem39 = null;
|
1171 |
-
$elem39 = new \com\boxalino\p13n\api\thrift\FacetRequest();
|
1172 |
-
$xfer += $elem39->read($input);
|
1173 |
-
$this->facetRequests []= $elem39;
|
1174 |
-
}
|
1175 |
-
$xfer += $input->readListEnd();
|
1176 |
-
} else {
|
1177 |
-
$xfer += $input->skip($ftype);
|
1178 |
-
}
|
1179 |
-
break;
|
1180 |
-
case 7:
|
1181 |
-
if ($ftype == TType::LST) {
|
1182 |
-
$this->sortFields = array();
|
1183 |
-
$_size40 = 0;
|
1184 |
-
$_etype43 = 0;
|
1185 |
-
$xfer += $input->readListBegin($_etype43, $_size40);
|
1186 |
-
for ($_i44 = 0; $_i44 < $_size40; ++$_i44)
|
1187 |
-
{
|
1188 |
-
$elem45 = null;
|
1189 |
-
$elem45 = new \com\boxalino\p13n\api\thrift\SortField();
|
1190 |
-
$xfer += $elem45->read($input);
|
1191 |
-
$this->sortFields []= $elem45;
|
1192 |
-
}
|
1193 |
-
$xfer += $input->readListEnd();
|
1194 |
-
} else {
|
1195 |
-
$xfer += $input->skip($ftype);
|
1196 |
-
}
|
1197 |
-
break;
|
1198 |
-
case 8:
|
1199 |
-
if ($ftype == TType::I64) {
|
1200 |
-
$xfer += $input->readI64($this->offset);
|
1201 |
-
} else {
|
1202 |
-
$xfer += $input->skip($ftype);
|
1203 |
-
}
|
1204 |
-
break;
|
1205 |
-
case 9:
|
1206 |
-
if ($ftype == TType::I32) {
|
1207 |
-
$xfer += $input->readI32($this->hitCount);
|
1208 |
-
} else {
|
1209 |
-
$xfer += $input->skip($ftype);
|
1210 |
-
}
|
1211 |
-
break;
|
1212 |
-
case 10:
|
1213 |
-
if ($ftype == TType::LST) {
|
1214 |
-
$this->returnFields = array();
|
1215 |
-
$_size46 = 0;
|
1216 |
-
$_etype49 = 0;
|
1217 |
-
$xfer += $input->readListBegin($_etype49, $_size46);
|
1218 |
-
for ($_i50 = 0; $_i50 < $_size46; ++$_i50)
|
1219 |
-
{
|
1220 |
-
$elem51 = null;
|
1221 |
-
$xfer += $input->readString($elem51);
|
1222 |
-
$this->returnFields []= $elem51;
|
1223 |
-
}
|
1224 |
-
$xfer += $input->readListEnd();
|
1225 |
-
} else {
|
1226 |
-
$xfer += $input->skip($ftype);
|
1227 |
-
}
|
1228 |
-
break;
|
1229 |
-
case 20:
|
1230 |
-
if ($ftype == TType::STRING) {
|
1231 |
-
$xfer += $input->readString($this->groupBy);
|
1232 |
-
} else {
|
1233 |
-
$xfer += $input->skip($ftype);
|
1234 |
-
}
|
1235 |
-
break;
|
1236 |
-
case 30:
|
1237 |
-
if ($ftype == TType::BOOL) {
|
1238 |
-
$xfer += $input->readBool($this->groupFacets);
|
1239 |
-
} else {
|
1240 |
-
$xfer += $input->skip($ftype);
|
1241 |
-
}
|
1242 |
-
break;
|
1243 |
-
case 40:
|
1244 |
-
if ($ftype == TType::I32) {
|
1245 |
-
$xfer += $input->readI32($this->groupItemsCount);
|
1246 |
-
} else {
|
1247 |
-
$xfer += $input->skip($ftype);
|
1248 |
-
}
|
1249 |
-
break;
|
1250 |
-
case 50:
|
1251 |
-
if ($ftype == TType::STRING) {
|
1252 |
-
$xfer += $input->readString($this->groupItemsSort);
|
1253 |
-
} else {
|
1254 |
-
$xfer += $input->skip($ftype);
|
1255 |
-
}
|
1256 |
-
break;
|
1257 |
-
case 60:
|
1258 |
-
if ($ftype == TType::BOOL) {
|
1259 |
-
$xfer += $input->readBool($this->groupItemsSortAscending);
|
1260 |
-
} else {
|
1261 |
-
$xfer += $input->skip($ftype);
|
1262 |
-
}
|
1263 |
-
break;
|
1264 |
-
default:
|
1265 |
-
$xfer += $input->skip($ftype);
|
1266 |
-
break;
|
1267 |
-
}
|
1268 |
-
$xfer += $input->readFieldEnd();
|
1269 |
-
}
|
1270 |
-
$xfer += $input->readStructEnd();
|
1271 |
-
return $xfer;
|
1272 |
-
}
|
1273 |
-
|
1274 |
-
public function write($output) {
|
1275 |
-
$xfer = 0;
|
1276 |
-
$xfer += $output->writeStructBegin('SimpleSearchQuery');
|
1277 |
-
if ($this->indexId !== null) {
|
1278 |
-
$xfer += $output->writeFieldBegin('indexId', TType::STRING, 1);
|
1279 |
-
$xfer += $output->writeString($this->indexId);
|
1280 |
-
$xfer += $output->writeFieldEnd();
|
1281 |
-
}
|
1282 |
-
if ($this->language !== null) {
|
1283 |
-
$xfer += $output->writeFieldBegin('language', TType::STRING, 2);
|
1284 |
-
$xfer += $output->writeString($this->language);
|
1285 |
-
$xfer += $output->writeFieldEnd();
|
1286 |
-
}
|
1287 |
-
if ($this->queryText !== null) {
|
1288 |
-
$xfer += $output->writeFieldBegin('queryText', TType::STRING, 3);
|
1289 |
-
$xfer += $output->writeString($this->queryText);
|
1290 |
-
$xfer += $output->writeFieldEnd();
|
1291 |
-
}
|
1292 |
-
if ($this->filters !== null) {
|
1293 |
-
if (!is_array($this->filters)) {
|
1294 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
1295 |
-
}
|
1296 |
-
$xfer += $output->writeFieldBegin('filters', TType::LST, 4);
|
1297 |
{
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
$xfer += $
|
1311 |
-
|
1312 |
-
$xfer += $
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
$
|
|
|
|
|
|
|
1319 |
{
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
$xfer += $
|
|
|
1336 |
{
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
$xfer += $
|
1350 |
-
|
1351 |
-
$xfer += $
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
$xfer += $
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
|
|
|
|
|
|
|
|
|
|
1363 |
{
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
$xfer += $
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
$xfer += $
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
$xfer += $
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
$xfer += $
|
1397 |
-
|
1398 |
-
$xfer += $
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1403 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1404 |
|
1405 |
}
|
1406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1407 |
class ContextItem {
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
$this->role = $vals['role'];
|
1448 |
-
}
|
1449 |
-
}
|
1450 |
}
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1454 |
}
|
1455 |
-
|
1456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1457 |
{
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
}
|
1498 |
-
break;
|
1499 |
-
default:
|
1500 |
-
$xfer += $input->skip($ftype);
|
1501 |
-
break;
|
1502 |
-
}
|
1503 |
-
$xfer += $input->readFieldEnd();
|
1504 |
-
}
|
1505 |
-
$xfer += $input->readStructEnd();
|
1506 |
-
return $xfer;
|
1507 |
}
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
$xfer += $output->writeString($this->contextItemId);
|
1525 |
-
$xfer += $output->writeFieldEnd();
|
1526 |
-
}
|
1527 |
-
if ($this->role !== null) {
|
1528 |
-
$xfer += $output->writeFieldBegin('role', TType::STRING, 4);
|
1529 |
-
$xfer += $output->writeString($this->role);
|
1530 |
-
$xfer += $output->writeFieldEnd();
|
1531 |
-
}
|
1532 |
-
$xfer += $output->writeFieldStop();
|
1533 |
-
$xfer += $output->writeStructEnd();
|
1534 |
-
return $xfer;
|
1535 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1536 |
|
1537 |
}
|
1538 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1539 |
class ChoiceInquiry {
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1616 |
}
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1620 |
}
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1630 |
{
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
$xfer += $input->readString($this->choiceId);
|
1640 |
-
} else {
|
1641 |
-
$xfer += $input->skip($ftype);
|
1642 |
-
}
|
1643 |
-
break;
|
1644 |
-
case 2:
|
1645 |
-
if ($ftype == TType::STRUCT) {
|
1646 |
-
$this->simpleSearchQuery = new \com\boxalino\p13n\api\thrift\SimpleSearchQuery();
|
1647 |
-
$xfer += $this->simpleSearchQuery->read($input);
|
1648 |
-
} else {
|
1649 |
-
$xfer += $input->skip($ftype);
|
1650 |
-
}
|
1651 |
-
break;
|
1652 |
-
case 3:
|
1653 |
-
if ($ftype == TType::LST) {
|
1654 |
-
$this->contextItems = array();
|
1655 |
-
$_size56 = 0;
|
1656 |
-
$_etype59 = 0;
|
1657 |
-
$xfer += $input->readListBegin($_etype59, $_size56);
|
1658 |
-
for ($_i60 = 0; $_i60 < $_size56; ++$_i60)
|
1659 |
-
{
|
1660 |
-
$elem61 = null;
|
1661 |
-
$elem61 = new \com\boxalino\p13n\api\thrift\ContextItem();
|
1662 |
-
$xfer += $elem61->read($input);
|
1663 |
-
$this->contextItems []= $elem61;
|
1664 |
-
}
|
1665 |
-
$xfer += $input->readListEnd();
|
1666 |
-
} else {
|
1667 |
-
$xfer += $input->skip($ftype);
|
1668 |
-
}
|
1669 |
-
break;
|
1670 |
-
case 4:
|
1671 |
-
if ($ftype == TType::I32) {
|
1672 |
-
$xfer += $input->readI32($this->minHitCount);
|
1673 |
-
} else {
|
1674 |
-
$xfer += $input->skip($ftype);
|
1675 |
-
}
|
1676 |
-
break;
|
1677 |
-
case 5:
|
1678 |
-
if ($ftype == TType::SET) {
|
1679 |
-
$this->excludeVariantIds = array();
|
1680 |
-
$_size62 = 0;
|
1681 |
-
$_etype65 = 0;
|
1682 |
-
$xfer += $input->readSetBegin($_etype65, $_size62);
|
1683 |
-
for ($_i66 = 0; $_i66 < $_size62; ++$_i66)
|
1684 |
-
{
|
1685 |
-
$elem67 = null;
|
1686 |
-
$xfer += $input->readString($elem67);
|
1687 |
-
if (is_scalar($elem67)) {
|
1688 |
-
$this->excludeVariantIds[$elem67] = true;
|
1689 |
-
} else {
|
1690 |
-
$this->excludeVariantIds []= $elem67;
|
1691 |
-
}
|
1692 |
-
}
|
1693 |
-
$xfer += $input->readSetEnd();
|
1694 |
-
} else {
|
1695 |
-
$xfer += $input->skip($ftype);
|
1696 |
-
}
|
1697 |
-
break;
|
1698 |
-
case 6:
|
1699 |
-
if ($ftype == TType::STRING) {
|
1700 |
-
$xfer += $input->readString($this->scope);
|
1701 |
-
} else {
|
1702 |
-
$xfer += $input->skip($ftype);
|
1703 |
-
}
|
1704 |
-
break;
|
1705 |
-
case 70:
|
1706 |
-
if ($ftype == TType::BOOL) {
|
1707 |
-
$xfer += $input->readBool($this->withRelaxation);
|
1708 |
-
} else {
|
1709 |
-
$xfer += $input->skip($ftype);
|
1710 |
-
}
|
1711 |
-
break;
|
1712 |
-
default:
|
1713 |
-
$xfer += $input->skip($ftype);
|
1714 |
-
break;
|
1715 |
-
}
|
1716 |
-
$xfer += $input->readFieldEnd();
|
1717 |
-
}
|
1718 |
-
$xfer += $input->readStructEnd();
|
1719 |
-
return $xfer;
|
1720 |
}
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
$xfer += $output->writeFieldBegin('minHitCount', TType::I32, 4);
|
1757 |
-
$xfer += $output->writeI32($this->minHitCount);
|
1758 |
-
$xfer += $output->writeFieldEnd();
|
1759 |
-
}
|
1760 |
-
if ($this->excludeVariantIds !== null) {
|
1761 |
-
if (!is_array($this->excludeVariantIds)) {
|
1762 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
1763 |
-
}
|
1764 |
-
$xfer += $output->writeFieldBegin('excludeVariantIds', TType::SET, 5);
|
1765 |
-
{
|
1766 |
-
$output->writeSetBegin(TType::STRING, count($this->excludeVariantIds));
|
1767 |
-
{
|
1768 |
-
foreach ($this->excludeVariantIds as $iter69 => $iter70)
|
1769 |
-
{
|
1770 |
-
if (is_scalar($iter70)) {
|
1771 |
-
$xfer += $output->writeString($iter69);
|
1772 |
-
} else {
|
1773 |
-
$xfer += $output->writeString($iter70);
|
1774 |
-
}
|
1775 |
-
}
|
1776 |
-
}
|
1777 |
-
$output->writeSetEnd();
|
1778 |
-
}
|
1779 |
-
$xfer += $output->writeFieldEnd();
|
1780 |
-
}
|
1781 |
-
if ($this->scope !== null) {
|
1782 |
-
$xfer += $output->writeFieldBegin('scope', TType::STRING, 6);
|
1783 |
-
$xfer += $output->writeString($this->scope);
|
1784 |
-
$xfer += $output->writeFieldEnd();
|
1785 |
-
}
|
1786 |
-
if ($this->withRelaxation !== null) {
|
1787 |
-
$xfer += $output->writeFieldBegin('withRelaxation', TType::BOOL, 70);
|
1788 |
-
$xfer += $output->writeBool($this->withRelaxation);
|
1789 |
-
$xfer += $output->writeFieldEnd();
|
1790 |
-
}
|
1791 |
-
$xfer += $output->writeFieldStop();
|
1792 |
-
$xfer += $output->writeStructEnd();
|
1793 |
-
return $xfer;
|
1794 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1795 |
|
1796 |
}
|
1797 |
|
|
|
|
|
|
|
1798 |
class RequestContext {
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
$this->parameters = $vals['parameters'];
|
1827 |
-
}
|
1828 |
-
}
|
1829 |
}
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
|
|
1833 |
}
|
1834 |
-
|
1835 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1836 |
{
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
|
|
|
|
1849 |
{
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
} else {
|
1877 |
-
$xfer += $input->skip($ftype);
|
1878 |
-
}
|
1879 |
-
break;
|
1880 |
-
default:
|
1881 |
-
$xfer += $input->skip($ftype);
|
1882 |
-
break;
|
1883 |
-
}
|
1884 |
-
$xfer += $input->readFieldEnd();
|
1885 |
-
}
|
1886 |
-
$xfer += $input->readStructEnd();
|
1887 |
-
return $xfer;
|
1888 |
}
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1898 |
{
|
1899 |
-
|
|
|
|
|
1900 |
{
|
1901 |
-
|
1902 |
-
{
|
1903 |
-
$xfer += $output->writeString($kiter84);
|
1904 |
-
{
|
1905 |
-
$output->writeListBegin(TType::STRING, count($viter85));
|
1906 |
-
{
|
1907 |
-
foreach ($viter85 as $iter86)
|
1908 |
-
{
|
1909 |
-
$xfer += $output->writeString($iter86);
|
1910 |
-
}
|
1911 |
-
}
|
1912 |
-
$output->writeListEnd();
|
1913 |
-
}
|
1914 |
-
}
|
1915 |
}
|
1916 |
-
|
|
|
1917 |
}
|
1918 |
-
|
1919 |
}
|
1920 |
-
$
|
1921 |
-
|
1922 |
-
|
1923 |
}
|
|
|
|
|
|
|
|
|
1924 |
|
1925 |
}
|
1926 |
|
|
|
|
|
|
|
1927 |
class UserRecord {
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
$this->username = $vals['username'];
|
1944 |
-
}
|
1945 |
-
}
|
1946 |
}
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
|
|
1950 |
}
|
1951 |
-
|
1952 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1953 |
{
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
}
|
1973 |
-
break;
|
1974 |
-
default:
|
1975 |
-
$xfer += $input->skip($ftype);
|
1976 |
-
break;
|
1977 |
-
}
|
1978 |
-
$xfer += $input->readFieldEnd();
|
1979 |
-
}
|
1980 |
-
$xfer += $input->readStructEnd();
|
1981 |
-
return $xfer;
|
1982 |
}
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
return $xfer;
|
1995 |
}
|
|
|
|
|
|
|
|
|
1996 |
|
1997 |
}
|
1998 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1999 |
class ChoiceRequest {
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
$this->requestContext = $vals['requestContext'];
|
2047 |
-
}
|
2048 |
-
}
|
2049 |
}
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2053 |
}
|
2054 |
-
|
2055 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2056 |
{
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2069 |
{
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
$elem92 = null;
|
2094 |
-
$elem92 = new \com\boxalino\p13n\api\thrift\ChoiceInquiry();
|
2095 |
-
$xfer += $elem92->read($input);
|
2096 |
-
$this->inquiries []= $elem92;
|
2097 |
-
}
|
2098 |
-
$xfer += $input->readListEnd();
|
2099 |
-
} else {
|
2100 |
-
$xfer += $input->skip($ftype);
|
2101 |
-
}
|
2102 |
-
break;
|
2103 |
-
case 4:
|
2104 |
-
if ($ftype == TType::STRUCT) {
|
2105 |
-
$this->requestContext = new \com\boxalino\p13n\api\thrift\RequestContext();
|
2106 |
-
$xfer += $this->requestContext->read($input);
|
2107 |
-
} else {
|
2108 |
-
$xfer += $input->skip($ftype);
|
2109 |
-
}
|
2110 |
-
break;
|
2111 |
-
default:
|
2112 |
-
$xfer += $input->skip($ftype);
|
2113 |
-
break;
|
2114 |
-
}
|
2115 |
-
$xfer += $input->readFieldEnd();
|
2116 |
-
}
|
2117 |
-
$xfer += $input->readStructEnd();
|
2118 |
-
return $xfer;
|
2119 |
}
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2140 |
-
}
|
2141 |
-
$xfer += $output->writeFieldBegin('inquiries', TType::LST, 3);
|
2142 |
-
{
|
2143 |
-
$output->writeListBegin(TType::STRUCT, count($this->inquiries));
|
2144 |
-
{
|
2145 |
-
foreach ($this->inquiries as $iter93)
|
2146 |
-
{
|
2147 |
-
$xfer += $iter93->write($output);
|
2148 |
-
}
|
2149 |
-
}
|
2150 |
-
$output->writeListEnd();
|
2151 |
-
}
|
2152 |
-
$xfer += $output->writeFieldEnd();
|
2153 |
-
}
|
2154 |
-
if ($this->requestContext !== null) {
|
2155 |
-
if (!is_object($this->requestContext)) {
|
2156 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2157 |
-
}
|
2158 |
-
$xfer += $output->writeFieldBegin('requestContext', TType::STRUCT, 4);
|
2159 |
-
$xfer += $this->requestContext->write($output);
|
2160 |
-
$xfer += $output->writeFieldEnd();
|
2161 |
-
}
|
2162 |
-
$xfer += $output->writeFieldStop();
|
2163 |
-
$xfer += $output->writeStructEnd();
|
2164 |
-
return $xfer;
|
2165 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2166 |
|
2167 |
}
|
2168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2169 |
class FacetResponse {
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
|
2185 |
-
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
$this->values = $vals['values'];
|
2199 |
-
}
|
2200 |
-
}
|
2201 |
}
|
2202 |
-
|
2203 |
-
|
2204 |
-
|
|
|
|
|
|
|
|
|
2205 |
}
|
2206 |
-
|
2207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2208 |
{
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
2215 |
-
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
2220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2221 |
{
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
-
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
$elem99 = null;
|
2238 |
-
$elem99 = new \com\boxalino\p13n\api\thrift\FacetValue();
|
2239 |
-
$xfer += $elem99->read($input);
|
2240 |
-
$this->values []= $elem99;
|
2241 |
-
}
|
2242 |
-
$xfer += $input->readListEnd();
|
2243 |
-
} else {
|
2244 |
-
$xfer += $input->skip($ftype);
|
2245 |
-
}
|
2246 |
-
break;
|
2247 |
-
default:
|
2248 |
-
$xfer += $input->skip($ftype);
|
2249 |
-
break;
|
2250 |
-
}
|
2251 |
-
$xfer += $input->readFieldEnd();
|
2252 |
-
}
|
2253 |
-
$xfer += $input->readStructEnd();
|
2254 |
-
return $xfer;
|
2255 |
}
|
2256 |
-
|
2257 |
-
|
2258 |
-
|
2259 |
-
|
2260 |
-
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
2264 |
-
|
2265 |
-
|
2266 |
-
|
2267 |
-
|
2268 |
-
|
2269 |
-
|
2270 |
-
|
2271 |
-
|
2272 |
-
|
2273 |
-
|
2274 |
-
|
2275 |
-
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
2279 |
-
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
2283 |
-
|
2284 |
-
return $xfer;
|
2285 |
}
|
|
|
|
|
|
|
|
|
2286 |
|
2287 |
}
|
2288 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2289 |
class Hit {
|
2290 |
-
|
2291 |
-
|
2292 |
-
|
2293 |
-
|
2294 |
-
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
2308 |
-
|
2309 |
-
|
2310 |
-
|
2311 |
-
|
2312 |
-
|
2313 |
-
|
2314 |
-
|
2315 |
-
|
2316 |
-
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
$this->scenarioId = $vals['scenarioId'];
|
2334 |
-
}
|
2335 |
-
}
|
2336 |
}
|
2337 |
-
|
2338 |
-
|
2339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2340 |
}
|
2341 |
-
|
2342 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2343 |
{
|
2344 |
-
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
2349 |
-
|
2350 |
-
|
2351 |
-
|
2352 |
-
|
2353 |
-
|
2354 |
-
|
2355 |
-
|
|
|
|
|
2356 |
{
|
2357 |
-
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
-
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
-
|
2387 |
-
|
2388 |
-
|
2389 |
-
|
2390 |
-
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
} else {
|
2398 |
-
$xfer += $input->skip($ftype);
|
2399 |
-
}
|
2400 |
-
break;
|
2401 |
-
default:
|
2402 |
-
$xfer += $input->skip($ftype);
|
2403 |
-
break;
|
2404 |
-
}
|
2405 |
-
$xfer += $input->readFieldEnd();
|
2406 |
-
}
|
2407 |
-
$xfer += $input->readStructEnd();
|
2408 |
-
return $xfer;
|
2409 |
}
|
2410 |
-
|
2411 |
-
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
-
|
2416 |
-
|
2417 |
-
|
2418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2419 |
{
|
2420 |
-
|
|
|
|
|
2421 |
{
|
2422 |
-
|
2423 |
-
{
|
2424 |
-
$xfer += $output->writeString($kiter114);
|
2425 |
-
{
|
2426 |
-
$output->writeListBegin(TType::STRING, count($viter115));
|
2427 |
-
{
|
2428 |
-
foreach ($viter115 as $iter116)
|
2429 |
-
{
|
2430 |
-
$xfer += $output->writeString($iter116);
|
2431 |
-
}
|
2432 |
-
}
|
2433 |
-
$output->writeListEnd();
|
2434 |
-
}
|
2435 |
-
}
|
2436 |
}
|
2437 |
-
|
|
|
2438 |
}
|
2439 |
-
|
2440 |
-
}
|
2441 |
-
if ($this->score !== null) {
|
2442 |
-
$xfer += $output->writeFieldBegin('score', TType::DOUBLE, 2);
|
2443 |
-
$xfer += $output->writeDouble($this->score);
|
2444 |
-
$xfer += $output->writeFieldEnd();
|
2445 |
}
|
2446 |
-
|
2447 |
-
|
2448 |
-
|
2449 |
-
|
2450 |
-
|
2451 |
-
|
2452 |
-
|
2453 |
-
|
2454 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2455 |
|
2456 |
}
|
2457 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2458 |
class HitsGroup {
|
2459 |
-
|
2460 |
-
|
2461 |
-
|
2462 |
-
|
2463 |
-
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
|
2468 |
-
|
2469 |
-
|
2470 |
-
|
2471 |
-
|
2472 |
-
|
2473 |
-
|
2474 |
-
|
2475 |
-
|
2476 |
-
|
2477 |
-
|
2478 |
-
|
2479 |
-
|
2480 |
-
|
2481 |
-
|
2482 |
-
|
2483 |
-
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
|
2490 |
-
|
2491 |
-
|
2492 |
-
|
2493 |
-
|
2494 |
-
|
2495 |
-
$this->hits = $vals['hits'];
|
2496 |
-
}
|
2497 |
-
}
|
2498 |
}
|
2499 |
-
|
2500 |
-
|
2501 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2502 |
}
|
2503 |
-
|
2504 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2505 |
{
|
2506 |
-
|
2507 |
-
|
2508 |
-
|
2509 |
-
|
2510 |
-
|
2511 |
-
|
2512 |
-
|
2513 |
-
|
2514 |
-
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2518 |
{
|
2519 |
-
|
2520 |
-
|
2521 |
-
|
2522 |
-
|
2523 |
-
|
2524 |
-
|
2525 |
-
|
2526 |
-
|
2527 |
-
|
2528 |
-
|
2529 |
-
|
2530 |
-
|
2531 |
-
|
2532 |
-
|
2533 |
-
|
2534 |
-
if ($ftype == TType::LST) {
|
2535 |
-
$this->hits = array();
|
2536 |
-
$_size117 = 0;
|
2537 |
-
$_etype120 = 0;
|
2538 |
-
$xfer += $input->readListBegin($_etype120, $_size117);
|
2539 |
-
for ($_i121 = 0; $_i121 < $_size117; ++$_i121)
|
2540 |
-
{
|
2541 |
-
$elem122 = null;
|
2542 |
-
$elem122 = new \com\boxalino\p13n\api\thrift\Hit();
|
2543 |
-
$xfer += $elem122->read($input);
|
2544 |
-
$this->hits []= $elem122;
|
2545 |
-
}
|
2546 |
-
$xfer += $input->readListEnd();
|
2547 |
-
} else {
|
2548 |
-
$xfer += $input->skip($ftype);
|
2549 |
-
}
|
2550 |
-
break;
|
2551 |
-
default:
|
2552 |
-
$xfer += $input->skip($ftype);
|
2553 |
-
break;
|
2554 |
-
}
|
2555 |
-
$xfer += $input->readFieldEnd();
|
2556 |
-
}
|
2557 |
-
$xfer += $input->readStructEnd();
|
2558 |
-
return $xfer;
|
2559 |
}
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
-
|
2566 |
-
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
2572 |
-
|
2573 |
-
|
2574 |
-
|
2575 |
-
|
2576 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2577 |
-
}
|
2578 |
-
$xfer += $output->writeFieldBegin('hits', TType::LST, 30);
|
2579 |
-
{
|
2580 |
-
$output->writeListBegin(TType::STRUCT, count($this->hits));
|
2581 |
-
{
|
2582 |
-
foreach ($this->hits as $iter123)
|
2583 |
-
{
|
2584 |
-
$xfer += $iter123->write($output);
|
2585 |
-
}
|
2586 |
-
}
|
2587 |
-
$output->writeListEnd();
|
2588 |
-
}
|
2589 |
-
$xfer += $output->writeFieldEnd();
|
2590 |
-
}
|
2591 |
-
$xfer += $output->writeFieldStop();
|
2592 |
-
$xfer += $output->writeStructEnd();
|
2593 |
-
return $xfer;
|
2594 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2595 |
|
2596 |
}
|
2597 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2598 |
class SearchResult {
|
2599 |
-
|
2600 |
-
|
2601 |
-
|
2602 |
-
|
2603 |
-
|
2604 |
-
|
2605 |
-
|
2606 |
-
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
-
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
-
|
2627 |
-
|
2628 |
-
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
-
|
2634 |
-
|
2635 |
-
|
2636 |
-
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
|
2645 |
-
|
2646 |
-
|
2647 |
-
|
2648 |
-
|
2649 |
-
|
2650 |
-
|
2651 |
-
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
|
2656 |
-
|
2657 |
-
|
2658 |
-
|
2659 |
-
|
2660 |
-
|
2661 |
-
$this->hitsGroups = $vals['hitsGroups'];
|
2662 |
-
}
|
2663 |
-
}
|
2664 |
}
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2668 |
}
|
2669 |
-
|
2670 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2671 |
{
|
2672 |
-
|
2673 |
-
|
2674 |
-
|
2675 |
-
|
2676 |
-
|
2677 |
-
|
2678 |
-
|
2679 |
-
|
2680 |
-
|
2681 |
-
|
2682 |
-
|
2683 |
-
|
2684 |
-
|
2685 |
-
case 1:
|
2686 |
-
if ($ftype == TType::LST) {
|
2687 |
-
$this->hits = array();
|
2688 |
-
$_size124 = 0;
|
2689 |
-
$_etype127 = 0;
|
2690 |
-
$xfer += $input->readListBegin($_etype127, $_size124);
|
2691 |
-
for ($_i128 = 0; $_i128 < $_size124; ++$_i128)
|
2692 |
-
{
|
2693 |
-
$elem129 = null;
|
2694 |
-
$elem129 = new \com\boxalino\p13n\api\thrift\Hit();
|
2695 |
-
$xfer += $elem129->read($input);
|
2696 |
-
$this->hits []= $elem129;
|
2697 |
-
}
|
2698 |
-
$xfer += $input->readListEnd();
|
2699 |
-
} else {
|
2700 |
-
$xfer += $input->skip($ftype);
|
2701 |
-
}
|
2702 |
-
break;
|
2703 |
-
case 2:
|
2704 |
-
if ($ftype == TType::LST) {
|
2705 |
-
$this->facetResponses = array();
|
2706 |
-
$_size130 = 0;
|
2707 |
-
$_etype133 = 0;
|
2708 |
-
$xfer += $input->readListBegin($_etype133, $_size130);
|
2709 |
-
for ($_i134 = 0; $_i134 < $_size130; ++$_i134)
|
2710 |
-
{
|
2711 |
-
$elem135 = null;
|
2712 |
-
$elem135 = new \com\boxalino\p13n\api\thrift\FacetResponse();
|
2713 |
-
$xfer += $elem135->read($input);
|
2714 |
-
$this->facetResponses []= $elem135;
|
2715 |
-
}
|
2716 |
-
$xfer += $input->readListEnd();
|
2717 |
-
} else {
|
2718 |
-
$xfer += $input->skip($ftype);
|
2719 |
-
}
|
2720 |
-
break;
|
2721 |
-
case 3:
|
2722 |
-
if ($ftype == TType::I64) {
|
2723 |
-
$xfer += $input->readI64($this->totalHitCount);
|
2724 |
-
} else {
|
2725 |
-
$xfer += $input->skip($ftype);
|
2726 |
-
}
|
2727 |
-
break;
|
2728 |
-
case 40:
|
2729 |
-
if ($ftype == TType::STRING) {
|
2730 |
-
$xfer += $input->readString($this->queryText);
|
2731 |
-
} else {
|
2732 |
-
$xfer += $input->skip($ftype);
|
2733 |
-
}
|
2734 |
-
break;
|
2735 |
-
case 50:
|
2736 |
-
if ($ftype == TType::LST) {
|
2737 |
-
$this->hitsGroups = array();
|
2738 |
-
$_size136 = 0;
|
2739 |
-
$_etype139 = 0;
|
2740 |
-
$xfer += $input->readListBegin($_etype139, $_size136);
|
2741 |
-
for ($_i140 = 0; $_i140 < $_size136; ++$_i140)
|
2742 |
-
{
|
2743 |
-
$elem141 = null;
|
2744 |
-
$elem141 = new \com\boxalino\p13n\api\thrift\HitsGroup();
|
2745 |
-
$xfer += $elem141->read($input);
|
2746 |
-
$this->hitsGroups []= $elem141;
|
2747 |
-
}
|
2748 |
-
$xfer += $input->readListEnd();
|
2749 |
-
} else {
|
2750 |
-
$xfer += $input->skip($ftype);
|
2751 |
-
}
|
2752 |
-
break;
|
2753 |
-
default:
|
2754 |
-
$xfer += $input->skip($ftype);
|
2755 |
-
break;
|
2756 |
-
}
|
2757 |
-
$xfer += $input->readFieldEnd();
|
2758 |
-
}
|
2759 |
-
$xfer += $input->readStructEnd();
|
2760 |
-
return $xfer;
|
2761 |
-
}
|
2762 |
-
|
2763 |
-
public function write($output) {
|
2764 |
-
$xfer = 0;
|
2765 |
-
$xfer += $output->writeStructBegin('SearchResult');
|
2766 |
-
if ($this->hits !== null) {
|
2767 |
-
if (!is_array($this->hits)) {
|
2768 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2769 |
-
}
|
2770 |
-
$xfer += $output->writeFieldBegin('hits', TType::LST, 1);
|
2771 |
{
|
2772 |
-
|
2773 |
-
|
2774 |
-
|
2775 |
-
|
2776 |
-
|
2777 |
-
|
2778 |
-
|
2779 |
-
|
2780 |
-
|
2781 |
-
|
2782 |
-
|
2783 |
-
|
2784 |
-
|
2785 |
-
|
2786 |
-
|
2787 |
-
$xfer += $
|
|
|
2788 |
{
|
2789 |
-
|
2790 |
-
|
2791 |
-
|
2792 |
-
|
2793 |
-
|
2794 |
-
|
2795 |
-
|
2796 |
-
|
2797 |
-
|
2798 |
-
|
2799 |
-
|
2800 |
-
|
2801 |
-
$xfer += $
|
2802 |
-
|
2803 |
-
$xfer += $
|
2804 |
-
|
2805 |
-
|
2806 |
-
|
2807 |
-
|
2808 |
-
$xfer += $
|
2809 |
-
|
2810 |
-
|
2811 |
-
|
2812 |
-
|
2813 |
-
|
2814 |
-
|
|
|
|
|
|
|
|
|
|
|
2815 |
{
|
2816 |
-
|
2817 |
-
|
2818 |
-
|
2819 |
-
|
2820 |
-
|
2821 |
-
|
2822 |
-
|
2823 |
-
|
2824 |
-
|
2825 |
-
|
2826 |
-
|
2827 |
-
|
2828 |
-
|
2829 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2830 |
}
|
|
|
|
|
|
|
|
|
2831 |
|
2832 |
}
|
2833 |
|
2834 |
class SearchRelaxation {
|
2835 |
-
|
2836 |
-
|
2837 |
-
|
2838 |
-
|
2839 |
-
|
2840 |
-
|
2841 |
-
|
2842 |
-
|
2843 |
-
|
2844 |
-
|
2845 |
-
|
2846 |
-
|
2847 |
-
|
2848 |
-
|
2849 |
-
|
2850 |
-
|
2851 |
-
|
2852 |
-
|
2853 |
-
|
2854 |
-
|
2855 |
-
|
2856 |
-
|
2857 |
-
|
2858 |
-
|
2859 |
-
|
2860 |
-
|
2861 |
-
|
2862 |
-
|
2863 |
-
|
2864 |
-
|
2865 |
-
|
2866 |
-
|
2867 |
-
|
2868 |
-
$this->subphrasesResults = $vals['subphrasesResults'];
|
2869 |
-
}
|
2870 |
-
}
|
2871 |
}
|
2872 |
-
|
2873 |
-
|
2874 |
-
|
|
|
|
|
|
|
|
|
2875 |
}
|
2876 |
-
|
2877 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2878 |
{
|
2879 |
-
|
2880 |
-
|
2881 |
-
|
2882 |
-
|
2883 |
-
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
2887 |
-
|
2888 |
-
|
2889 |
-
|
2890 |
-
|
2891 |
-
|
2892 |
-
case 10:
|
2893 |
-
if ($ftype == TType::LST) {
|
2894 |
-
$this->suggestionsResults = array();
|
2895 |
-
$_size145 = 0;
|
2896 |
-
$_etype148 = 0;
|
2897 |
-
$xfer += $input->readListBegin($_etype148, $_size145);
|
2898 |
-
for ($_i149 = 0; $_i149 < $_size145; ++$_i149)
|
2899 |
-
{
|
2900 |
-
$elem150 = null;
|
2901 |
-
$elem150 = new \com\boxalino\p13n\api\thrift\SearchResult();
|
2902 |
-
$xfer += $elem150->read($input);
|
2903 |
-
$this->suggestionsResults []= $elem150;
|
2904 |
-
}
|
2905 |
-
$xfer += $input->readListEnd();
|
2906 |
-
} else {
|
2907 |
-
$xfer += $input->skip($ftype);
|
2908 |
-
}
|
2909 |
-
break;
|
2910 |
-
case 20:
|
2911 |
-
if ($ftype == TType::LST) {
|
2912 |
-
$this->subphrasesResults = array();
|
2913 |
-
$_size151 = 0;
|
2914 |
-
$_etype154 = 0;
|
2915 |
-
$xfer += $input->readListBegin($_etype154, $_size151);
|
2916 |
-
for ($_i155 = 0; $_i155 < $_size151; ++$_i155)
|
2917 |
-
{
|
2918 |
-
$elem156 = null;
|
2919 |
-
$elem156 = new \com\boxalino\p13n\api\thrift\SearchResult();
|
2920 |
-
$xfer += $elem156->read($input);
|
2921 |
-
$this->subphrasesResults []= $elem156;
|
2922 |
-
}
|
2923 |
-
$xfer += $input->readListEnd();
|
2924 |
-
} else {
|
2925 |
-
$xfer += $input->skip($ftype);
|
2926 |
-
}
|
2927 |
-
break;
|
2928 |
-
default:
|
2929 |
-
$xfer += $input->skip($ftype);
|
2930 |
-
break;
|
2931 |
-
}
|
2932 |
-
$xfer += $input->readFieldEnd();
|
2933 |
-
}
|
2934 |
-
$xfer += $input->readStructEnd();
|
2935 |
-
return $xfer;
|
2936 |
-
}
|
2937 |
-
|
2938 |
-
public function write($output) {
|
2939 |
-
$xfer = 0;
|
2940 |
-
$xfer += $output->writeStructBegin('SearchRelaxation');
|
2941 |
-
if ($this->suggestionsResults !== null) {
|
2942 |
-
if (!is_array($this->suggestionsResults)) {
|
2943 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2944 |
-
}
|
2945 |
-
$xfer += $output->writeFieldBegin('suggestionsResults', TType::LST, 10);
|
2946 |
{
|
2947 |
-
|
2948 |
-
|
2949 |
-
|
2950 |
-
|
2951 |
-
|
2952 |
-
|
2953 |
-
|
2954 |
-
|
2955 |
-
|
2956 |
-
|
2957 |
-
|
2958 |
-
|
2959 |
-
|
2960 |
-
|
2961 |
-
|
2962 |
-
$xfer += $
|
|
|
2963 |
{
|
2964 |
-
|
2965 |
-
|
2966 |
-
|
2967 |
-
|
2968 |
-
|
2969 |
-
|
2970 |
-
|
2971 |
-
|
2972 |
-
|
2973 |
-
|
2974 |
-
|
2975 |
-
|
2976 |
-
|
2977 |
-
|
|
|
2978 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2979 |
|
2980 |
}
|
2981 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2982 |
class Variant {
|
2983 |
-
|
2984 |
-
|
2985 |
-
|
2986 |
-
|
2987 |
-
|
2988 |
-
|
2989 |
-
|
2990 |
-
|
2991 |
-
|
2992 |
-
|
2993 |
-
|
2994 |
-
|
2995 |
-
|
2996 |
-
|
2997 |
-
|
2998 |
-
|
2999 |
-
|
3000 |
-
|
3001 |
-
|
3002 |
-
|
3003 |
-
|
3004 |
-
|
3005 |
-
|
3006 |
-
|
3007 |
-
|
3008 |
-
|
3009 |
-
|
3010 |
-
|
3011 |
-
|
3012 |
-
|
3013 |
-
|
3014 |
-
|
3015 |
-
|
3016 |
-
|
3017 |
-
|
3018 |
-
|
3019 |
-
|
3020 |
-
|
3021 |
-
|
3022 |
-
|
3023 |
-
|
3024 |
-
|
3025 |
-
|
3026 |
-
|
3027 |
-
|
3028 |
-
|
3029 |
-
|
3030 |
-
|
3031 |
-
|
3032 |
-
|
3033 |
-
|
3034 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3035 |
}
|
3036 |
-
|
3037 |
-
|
3038 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3039 |
}
|
3040 |
-
|
3041 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3042 |
{
|
3043 |
-
|
3044 |
-
|
3045 |
-
|
3046 |
-
|
3047 |
-
|
3048 |
-
|
3049 |
-
|
3050 |
-
|
3051 |
-
|
3052 |
-
|
3053 |
-
|
3054 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3055 |
{
|
3056 |
-
|
3057 |
-
|
3058 |
-
|
3059 |
-
|
3060 |
-
|
3061 |
-
|
3062 |
-
|
3063 |
-
|
3064 |
-
|
3065 |
-
|
3066 |
-
|
3067 |
-
|
3068 |
-
|
3069 |
-
|
3070 |
-
|
3071 |
-
if ($ftype == TType::STRUCT) {
|
3072 |
-
$this->searchResult = new \com\boxalino\p13n\api\thrift\SearchResult();
|
3073 |
-
$xfer += $this->searchResult->read($input);
|
3074 |
-
} else {
|
3075 |
-
$xfer += $input->skip($ftype);
|
3076 |
-
}
|
3077 |
-
break;
|
3078 |
-
case 4:
|
3079 |
-
if ($ftype == TType::STRING) {
|
3080 |
-
$xfer += $input->readString($this->searchResultTitle);
|
3081 |
-
} else {
|
3082 |
-
$xfer += $input->skip($ftype);
|
3083 |
-
}
|
3084 |
-
break;
|
3085 |
-
case 50:
|
3086 |
-
if ($ftype == TType::STRUCT) {
|
3087 |
-
$this->searchRelaxation = new \com\boxalino\p13n\api\thrift\SearchRelaxation();
|
3088 |
-
$xfer += $this->searchRelaxation->read($input);
|
3089 |
-
} else {
|
3090 |
-
$xfer += $input->skip($ftype);
|
3091 |
-
}
|
3092 |
-
break;
|
3093 |
-
default:
|
3094 |
-
$xfer += $input->skip($ftype);
|
3095 |
-
break;
|
3096 |
-
}
|
3097 |
-
$xfer += $input->readFieldEnd();
|
3098 |
-
}
|
3099 |
-
$xfer += $input->readStructEnd();
|
3100 |
-
return $xfer;
|
3101 |
}
|
3102 |
-
|
3103 |
-
|
3104 |
-
|
3105 |
-
|
3106 |
-
|
3107 |
-
|
3108 |
-
|
3109 |
-
|
3110 |
-
|
3111 |
-
|
3112 |
-
|
3113 |
-
|
3114 |
-
|
3115 |
-
|
3116 |
-
|
3117 |
-
|
3118 |
-
|
3119 |
-
|
3120 |
-
|
3121 |
-
|
3122 |
-
|
3123 |
-
|
3124 |
-
|
3125 |
-
|
3126 |
-
|
3127 |
-
|
3128 |
-
|
3129 |
-
|
3130 |
-
|
3131 |
-
|
3132 |
-
|
3133 |
-
|
3134 |
-
|
3135 |
-
|
3136 |
-
|
3137 |
-
|
3138 |
-
|
3139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3140 |
}
|
|
|
|
|
|
|
|
|
3141 |
|
3142 |
}
|
3143 |
|
|
|
|
|
|
|
|
|
3144 |
class ChoiceResponse {
|
3145 |
-
|
3146 |
-
|
3147 |
-
|
3148 |
-
|
3149 |
-
|
3150 |
-
|
3151 |
-
|
3152 |
-
|
3153 |
-
|
3154 |
-
|
3155 |
-
|
3156 |
-
|
3157 |
-
|
3158 |
-
|
3159 |
-
|
3160 |
-
|
3161 |
-
|
3162 |
-
|
3163 |
-
|
3164 |
-
|
3165 |
-
$this->variants = $vals['variants'];
|
3166 |
-
}
|
3167 |
-
}
|
3168 |
}
|
3169 |
-
|
3170 |
-
|
3171 |
-
|
|
|
3172 |
}
|
3173 |
-
|
3174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3175 |
{
|
3176 |
-
|
3177 |
-
|
3178 |
-
|
3179 |
-
|
3180 |
-
|
3181 |
-
|
3182 |
-
|
3183 |
-
|
3184 |
-
|
3185 |
-
|
3186 |
-
|
3187 |
-
|
|
|
3188 |
{
|
3189 |
-
|
3190 |
-
|
3191 |
-
|
3192 |
-
|
3193 |
-
|
3194 |
-
|
3195 |
-
|
3196 |
-
|
3197 |
-
|
3198 |
-
|
3199 |
-
|
3200 |
-
|
3201 |
-
|
3202 |
-
|
3203 |
-
|
3204 |
-
$xfer += $input->skip($ftype);
|
3205 |
-
}
|
3206 |
-
break;
|
3207 |
-
default:
|
3208 |
-
$xfer += $input->skip($ftype);
|
3209 |
-
break;
|
3210 |
-
}
|
3211 |
-
$xfer += $input->readFieldEnd();
|
3212 |
-
}
|
3213 |
-
$xfer += $input->readStructEnd();
|
3214 |
-
return $xfer;
|
3215 |
}
|
3216 |
-
|
3217 |
-
|
3218 |
-
|
3219 |
-
|
3220 |
-
|
3221 |
-
|
3222 |
-
|
3223 |
-
|
3224 |
-
|
3225 |
-
|
3226 |
-
|
3227 |
-
|
3228 |
-
|
3229 |
-
|
3230 |
-
|
3231 |
-
|
3232 |
-
|
3233 |
-
|
3234 |
-
|
3235 |
-
|
3236 |
-
|
3237 |
-
|
3238 |
-
|
3239 |
-
return $xfer;
|
3240 |
}
|
|
|
|
|
|
|
|
|
3241 |
|
3242 |
}
|
3243 |
|
3244 |
class ProfilePropertyValue {
|
3245 |
-
|
3246 |
-
|
3247 |
-
|
3248 |
-
|
3249 |
-
|
3250 |
-
|
3251 |
-
|
3252 |
-
|
3253 |
-
|
3254 |
-
|
3255 |
-
|
3256 |
-
|
3257 |
-
|
3258 |
-
|
3259 |
-
|
3260 |
-
|
3261 |
-
|
3262 |
-
|
3263 |
-
|
3264 |
-
|
3265 |
-
|
3266 |
-
|
3267 |
-
|
3268 |
-
|
3269 |
-
|
3270 |
-
|
3271 |
-
|
3272 |
-
|
3273 |
-
|
3274 |
-
|
3275 |
-
|
3276 |
-
|
3277 |
-
|
3278 |
-
|
3279 |
-
|
3280 |
-
|
3281 |
-
|
3282 |
-
|
3283 |
-
|
3284 |
-
$this->confidence = $vals['confidence'];
|
3285 |
-
}
|
3286 |
-
}
|
3287 |
}
|
3288 |
-
|
3289 |
-
|
3290 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3291 |
}
|
3292 |
-
|
3293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3294 |
{
|
3295 |
-
|
3296 |
-
|
3297 |
-
|
3298 |
-
|
3299 |
-
|
3300 |
-
|
3301 |
-
|
3302 |
-
|
3303 |
-
|
3304 |
-
|
3305 |
-
|
3306 |
-
|
3307 |
-
|
3308 |
-
|
3309 |
-
|
3310 |
-
|
3311 |
-
|
3312 |
-
|
3313 |
-
|
3314 |
-
|
3315 |
-
|
3316 |
-
|
3317 |
-
|
3318 |
-
|
3319 |
-
|
3320 |
-
|
3321 |
-
|
3322 |
-
|
3323 |
-
|
3324 |
-
|
3325 |
-
|
3326 |
-
|
3327 |
-
|
3328 |
-
|
3329 |
-
|
3330 |
-
|
3331 |
-
|
3332 |
-
|
3333 |
-
|
3334 |
-
}
|
3335 |
-
break;
|
3336 |
-
default:
|
3337 |
-
$xfer += $input->skip($ftype);
|
3338 |
-
break;
|
3339 |
-
}
|
3340 |
-
$xfer += $input->readFieldEnd();
|
3341 |
-
}
|
3342 |
-
$xfer += $input->readStructEnd();
|
3343 |
-
return $xfer;
|
3344 |
}
|
3345 |
-
|
3346 |
-
|
3347 |
-
|
3348 |
-
|
3349 |
-
|
3350 |
-
|
3351 |
-
|
3352 |
-
|
3353 |
-
|
3354 |
-
|
3355 |
-
|
3356 |
-
|
3357 |
-
|
3358 |
-
|
3359 |
-
|
3360 |
-
|
3361 |
-
|
3362 |
-
|
3363 |
-
|
3364 |
-
|
3365 |
-
|
3366 |
-
$xfer += $output->writeI32($this->confidence);
|
3367 |
-
$xfer += $output->writeFieldEnd();
|
3368 |
-
}
|
3369 |
-
$xfer += $output->writeFieldStop();
|
3370 |
-
$xfer += $output->writeStructEnd();
|
3371 |
-
return $xfer;
|
3372 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3373 |
|
3374 |
}
|
3375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3376 |
class BatchChoiceRequest {
|
3377 |
-
|
3378 |
-
|
3379 |
-
|
3380 |
-
|
3381 |
-
|
3382 |
-
|
3383 |
-
|
3384 |
-
|
3385 |
-
|
3386 |
-
|
3387 |
-
|
3388 |
-
|
3389 |
-
|
3390 |
-
|
3391 |
-
|
3392 |
-
|
3393 |
-
|
3394 |
-
|
3395 |
-
|
3396 |
-
|
3397 |
-
|
3398 |
-
|
3399 |
-
|
3400 |
-
|
3401 |
-
|
3402 |
-
|
3403 |
-
|
3404 |
-
|
3405 |
-
|
3406 |
-
|
3407 |
-
|
3408 |
-
|
3409 |
-
|
3410 |
-
|
3411 |
-
|
3412 |
-
|
3413 |
-
|
3414 |
-
|
3415 |
-
|
3416 |
-
|
3417 |
-
|
3418 |
-
|
3419 |
-
|
3420 |
-
|
3421 |
-
|
3422 |
-
|
3423 |
-
|
3424 |
-
|
3425 |
-
|
3426 |
-
|
3427 |
-
|
3428 |
-
|
3429 |
-
|
3430 |
-
|
3431 |
-
|
3432 |
-
|
3433 |
-
|
3434 |
-
|
3435 |
-
|
3436 |
-
$this->choiceInquiries = $vals['choiceInquiries'];
|
3437 |
-
}
|
3438 |
-
}
|
3439 |
}
|
3440 |
-
|
3441 |
-
|
3442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3443 |
}
|
3444 |
-
|
3445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3446 |
{
|
3447 |
-
|
3448 |
-
|
3449 |
-
|
3450 |
-
|
3451 |
-
|
3452 |
-
|
3453 |
-
|
3454 |
-
|
3455 |
-
|
3456 |
-
|
3457 |
-
|
3458 |
-
|
3459 |
-
|
3460 |
-
|
3461 |
-
|
3462 |
-
|
3463 |
-
|
3464 |
-
|
3465 |
-
|
3466 |
-
|
3467 |
-
|
3468 |
-
|
3469 |
-
|
3470 |
-
|
3471 |
-
|
3472 |
-
|
3473 |
-
|
3474 |
-
|
3475 |
-
|
3476 |
-
|
3477 |
-
|
3478 |
-
|
3479 |
-
|
3480 |
-
|
3481 |
-
|
3482 |
-
|
3483 |
-
|
3484 |
-
case 4:
|
3485 |
-
if ($ftype == TType::LST) {
|
3486 |
-
$this->profileIds = array();
|
3487 |
-
$_size166 = 0;
|
3488 |
-
$_etype169 = 0;
|
3489 |
-
$xfer += $input->readListBegin($_etype169, $_size166);
|
3490 |
-
for ($_i170 = 0; $_i170 < $_size166; ++$_i170)
|
3491 |
-
{
|
3492 |
-
$elem171 = null;
|
3493 |
-
$xfer += $input->readString($elem171);
|
3494 |
-
$this->profileIds []= $elem171;
|
3495 |
-
}
|
3496 |
-
$xfer += $input->readListEnd();
|
3497 |
-
} else {
|
3498 |
-
$xfer += $input->skip($ftype);
|
3499 |
-
}
|
3500 |
-
break;
|
3501 |
-
case 5:
|
3502 |
-
if ($ftype == TType::LST) {
|
3503 |
-
$this->choiceInquiries = array();
|
3504 |
-
$_size172 = 0;
|
3505 |
-
$_etype175 = 0;
|
3506 |
-
$xfer += $input->readListBegin($_etype175, $_size172);
|
3507 |
-
for ($_i176 = 0; $_i176 < $_size172; ++$_i176)
|
3508 |
-
{
|
3509 |
-
$elem177 = null;
|
3510 |
-
$elem177 = new \com\boxalino\p13n\api\thrift\ChoiceInquiry();
|
3511 |
-
$xfer += $elem177->read($input);
|
3512 |
-
$this->choiceInquiries []= $elem177;
|
3513 |
-
}
|
3514 |
-
$xfer += $input->readListEnd();
|
3515 |
-
} else {
|
3516 |
-
$xfer += $input->skip($ftype);
|
3517 |
-
}
|
3518 |
-
break;
|
3519 |
-
default:
|
3520 |
-
$xfer += $input->skip($ftype);
|
3521 |
-
break;
|
3522 |
-
}
|
3523 |
-
$xfer += $input->readFieldEnd();
|
3524 |
-
}
|
3525 |
-
$xfer += $input->readStructEnd();
|
3526 |
-
return $xfer;
|
3527 |
-
}
|
3528 |
-
|
3529 |
-
public function write($output) {
|
3530 |
-
$xfer = 0;
|
3531 |
-
$xfer += $output->writeStructBegin('BatchChoiceRequest');
|
3532 |
-
if ($this->userRecord !== null) {
|
3533 |
-
if (!is_object($this->userRecord)) {
|
3534 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3535 |
-
}
|
3536 |
-
$xfer += $output->writeFieldBegin('userRecord', TType::STRUCT, 1);
|
3537 |
-
$xfer += $this->userRecord->write($output);
|
3538 |
-
$xfer += $output->writeFieldEnd();
|
3539 |
-
}
|
3540 |
-
if ($this->choiceInquiry !== null) {
|
3541 |
-
if (!is_object($this->choiceInquiry)) {
|
3542 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3543 |
-
}
|
3544 |
-
$xfer += $output->writeFieldBegin('choiceInquiry', TType::STRUCT, 2);
|
3545 |
-
$xfer += $this->choiceInquiry->write($output);
|
3546 |
-
$xfer += $output->writeFieldEnd();
|
3547 |
-
}
|
3548 |
-
if ($this->requestContext !== null) {
|
3549 |
-
if (!is_object($this->requestContext)) {
|
3550 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3551 |
-
}
|
3552 |
-
$xfer += $output->writeFieldBegin('requestContext', TType::STRUCT, 3);
|
3553 |
-
$xfer += $this->requestContext->write($output);
|
3554 |
-
$xfer += $output->writeFieldEnd();
|
3555 |
-
}
|
3556 |
-
if ($this->profileIds !== null) {
|
3557 |
-
if (!is_array($this->profileIds)) {
|
3558 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3559 |
-
}
|
3560 |
-
$xfer += $output->writeFieldBegin('profileIds', TType::LST, 4);
|
3561 |
{
|
3562 |
-
|
3563 |
-
|
3564 |
-
|
3565 |
-
|
3566 |
-
|
3567 |
-
|
3568 |
-
|
3569 |
-
|
3570 |
-
|
3571 |
-
|
3572 |
-
|
3573 |
-
|
3574 |
-
|
3575 |
-
|
3576 |
-
|
3577 |
-
$
|
3578 |
{
|
3579 |
-
|
3580 |
-
|
3581 |
-
|
3582 |
-
|
3583 |
-
|
3584 |
-
|
3585 |
-
|
3586 |
-
|
3587 |
-
|
3588 |
-
|
3589 |
-
|
3590 |
-
|
3591 |
-
|
3592 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3593 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3594 |
|
3595 |
}
|
3596 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3597 |
class BatchChoiceResponse {
|
3598 |
-
|
3599 |
-
|
3600 |
-
|
3601 |
-
|
3602 |
-
|
3603 |
-
|
3604 |
-
|
3605 |
-
|
3606 |
-
|
3607 |
-
|
3608 |
-
|
3609 |
-
|
3610 |
-
|
3611 |
-
|
3612 |
-
|
3613 |
-
|
3614 |
-
|
3615 |
-
|
3616 |
-
|
3617 |
-
|
3618 |
-
|
3619 |
-
|
3620 |
-
|
3621 |
-
|
3622 |
-
|
3623 |
-
|
3624 |
-
|
3625 |
-
|
3626 |
-
|
3627 |
-
|
3628 |
-
|
3629 |
-
|
3630 |
-
|
3631 |
-
|
3632 |
-
|
3633 |
-
|
3634 |
-
|
3635 |
-
$this->selectedVariants = $vals['selectedVariants'];
|
3636 |
-
}
|
3637 |
-
}
|
3638 |
}
|
3639 |
-
|
3640 |
-
|
3641 |
-
|
|
|
|
|
|
|
|
|
3642 |
}
|
3643 |
-
|
3644 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3645 |
{
|
3646 |
-
|
3647 |
-
|
3648 |
-
|
3649 |
-
|
3650 |
-
|
3651 |
-
|
3652 |
-
|
3653 |
-
|
3654 |
-
|
3655 |
-
|
3656 |
-
|
3657 |
-
|
|
|
3658 |
{
|
3659 |
-
|
3660 |
-
|
3661 |
-
|
3662 |
-
|
3663 |
-
|
3664 |
-
|
3665 |
-
|
3666 |
-
|
3667 |
-
|
3668 |
-
|
3669 |
-
|
3670 |
-
|
3671 |
-
|
3672 |
-
|
3673 |
-
|
3674 |
-
|
3675 |
-
|
3676 |
-
break;
|
3677 |
-
case 2:
|
3678 |
-
if ($ftype == TType::LST) {
|
3679 |
-
$this->selectedVariants = array();
|
3680 |
-
$_size186 = 0;
|
3681 |
-
$_etype189 = 0;
|
3682 |
-
$xfer += $input->readListBegin($_etype189, $_size186);
|
3683 |
-
for ($_i190 = 0; $_i190 < $_size186; ++$_i190)
|
3684 |
-
{
|
3685 |
-
$elem191 = null;
|
3686 |
-
$elem191 = array();
|
3687 |
-
$_size192 = 0;
|
3688 |
-
$_etype195 = 0;
|
3689 |
-
$xfer += $input->readListBegin($_etype195, $_size192);
|
3690 |
-
for ($_i196 = 0; $_i196 < $_size192; ++$_i196)
|
3691 |
-
{
|
3692 |
-
$elem197 = null;
|
3693 |
-
$elem197 = new \com\boxalino\p13n\api\thrift\Variant();
|
3694 |
-
$xfer += $elem197->read($input);
|
3695 |
-
$elem191 []= $elem197;
|
3696 |
-
}
|
3697 |
-
$xfer += $input->readListEnd();
|
3698 |
-
$this->selectedVariants []= $elem191;
|
3699 |
-
}
|
3700 |
-
$xfer += $input->readListEnd();
|
3701 |
-
} else {
|
3702 |
-
$xfer += $input->skip($ftype);
|
3703 |
-
}
|
3704 |
-
break;
|
3705 |
-
default:
|
3706 |
-
$xfer += $input->skip($ftype);
|
3707 |
-
break;
|
3708 |
-
}
|
3709 |
-
$xfer += $input->readFieldEnd();
|
3710 |
-
}
|
3711 |
-
$xfer += $input->readStructEnd();
|
3712 |
-
return $xfer;
|
3713 |
-
}
|
3714 |
-
|
3715 |
-
public function write($output) {
|
3716 |
-
$xfer = 0;
|
3717 |
-
$xfer += $output->writeStructBegin('BatchChoiceResponse');
|
3718 |
-
if ($this->variants !== null) {
|
3719 |
-
if (!is_array($this->variants)) {
|
3720 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3721 |
-
}
|
3722 |
-
$xfer += $output->writeFieldBegin('variants', TType::LST, 1);
|
3723 |
{
|
3724 |
-
|
3725 |
-
|
3726 |
-
|
3727 |
-
|
3728 |
-
|
3729 |
-
|
3730 |
-
|
3731 |
-
$
|
3732 |
-
|
3733 |
-
|
3734 |
-
|
3735 |
-
|
3736 |
-
|
3737 |
-
|
3738 |
-
}
|
3739 |
-
$xfer += $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3740 |
{
|
3741 |
-
|
|
|
|
|
3742 |
{
|
3743 |
-
|
3744 |
-
{
|
3745 |
-
{
|
3746 |
-
$output->writeListBegin(TType::STRUCT, count($iter199));
|
3747 |
-
{
|
3748 |
-
foreach ($iter199 as $iter200)
|
3749 |
-
{
|
3750 |
-
$xfer += $iter200->write($output);
|
3751 |
-
}
|
3752 |
-
}
|
3753 |
-
$output->writeListEnd();
|
3754 |
-
}
|
3755 |
-
}
|
3756 |
}
|
3757 |
-
|
|
|
3758 |
}
|
3759 |
-
|
3760 |
}
|
3761 |
-
$
|
3762 |
-
|
3763 |
-
|
3764 |
}
|
|
|
|
|
|
|
|
|
3765 |
|
3766 |
}
|
3767 |
|
3768 |
class AutocompleteHit {
|
3769 |
-
|
3770 |
-
|
3771 |
-
|
3772 |
-
|
3773 |
-
|
3774 |
-
|
3775 |
-
|
3776 |
-
|
3777 |
-
|
3778 |
-
|
3779 |
-
|
3780 |
-
|
3781 |
-
|
3782 |
-
|
3783 |
-
|
3784 |
-
|
3785 |
-
|
3786 |
-
|
3787 |
-
|
3788 |
-
|
3789 |
-
|
3790 |
-
|
3791 |
-
|
3792 |
-
|
3793 |
-
|
3794 |
-
|
3795 |
-
|
3796 |
-
|
3797 |
-
|
3798 |
-
|
3799 |
-
|
3800 |
-
|
3801 |
-
|
3802 |
-
|
3803 |
-
|
3804 |
-
|
3805 |
-
|
3806 |
-
|
3807 |
-
|
3808 |
-
|
3809 |
-
$this->score = $vals['score'];
|
3810 |
-
}
|
3811 |
-
}
|
3812 |
}
|
3813 |
-
|
3814 |
-
|
3815 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3816 |
}
|
3817 |
-
|
3818 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3819 |
{
|
3820 |
-
|
3821 |
-
|
3822 |
-
|
3823 |
-
|
3824 |
-
|
3825 |
-
|
3826 |
-
|
3827 |
-
|
3828 |
-
|
3829 |
-
|
3830 |
-
|
3831 |
-
|
3832 |
-
|
3833 |
-
|
3834 |
-
|
3835 |
-
|
3836 |
-
|
3837 |
-
|
3838 |
-
|
3839 |
-
|
3840 |
-
|
3841 |
-
|
3842 |
-
|
3843 |
-
|
3844 |
-
|
3845 |
-
|
3846 |
-
|
3847 |
-
|
3848 |
-
|
3849 |
-
|
3850 |
-
|
3851 |
-
|
3852 |
-
|
3853 |
-
|
3854 |
-
|
3855 |
-
|
3856 |
-
|
3857 |
-
|
3858 |
-
|
3859 |
-
|
3860 |
-
}
|
3861 |
-
break;
|
3862 |
-
default:
|
3863 |
-
$xfer += $input->skip($ftype);
|
3864 |
-
break;
|
3865 |
-
}
|
3866 |
-
$xfer += $input->readFieldEnd();
|
3867 |
-
}
|
3868 |
-
$xfer += $input->readStructEnd();
|
3869 |
-
return $xfer;
|
3870 |
}
|
3871 |
-
|
3872 |
-
|
3873 |
-
|
3874 |
-
|
3875 |
-
|
3876 |
-
|
3877 |
-
|
3878 |
-
|
3879 |
-
|
3880 |
-
|
3881 |
-
|
3882 |
-
|
3883 |
-
|
3884 |
-
|
3885 |
-
|
3886 |
-
|
3887 |
-
|
3888 |
-
|
3889 |
-
|
3890 |
-
|
3891 |
-
|
3892 |
-
|
3893 |
-
|
3894 |
-
|
3895 |
-
|
3896 |
-
|
3897 |
-
|
3898 |
-
|
3899 |
-
|
3900 |
-
return $xfer;
|
3901 |
}
|
|
|
|
|
|
|
|
|
3902 |
|
3903 |
}
|
3904 |
|
3905 |
class AutocompleteQuery {
|
3906 |
-
|
3907 |
-
|
3908 |
-
|
3909 |
-
|
3910 |
-
|
3911 |
-
|
3912 |
-
|
3913 |
-
|
3914 |
-
|
3915 |
-
|
3916 |
-
|
3917 |
-
|
3918 |
-
|
3919 |
-
|
3920 |
-
|
3921 |
-
|
3922 |
-
|
3923 |
-
|
3924 |
-
|
3925 |
-
|
3926 |
-
|
3927 |
-
|
3928 |
-
|
3929 |
-
|
3930 |
-
|
3931 |
-
|
3932 |
-
|
3933 |
-
|
3934 |
-
|
3935 |
-
|
3936 |
-
|
3937 |
-
|
3938 |
-
|
3939 |
-
|
3940 |
-
|
3941 |
-
|
3942 |
-
|
3943 |
-
|
3944 |
-
|
3945 |
-
|
3946 |
-
|
3947 |
-
|
3948 |
-
|
3949 |
-
|
3950 |
-
|
3951 |
-
|
3952 |
-
|
3953 |
-
|
3954 |
-
|
3955 |
-
|
3956 |
-
|
3957 |
-
|
3958 |
-
|
3959 |
-
|
3960 |
-
|
3961 |
-
|
3962 |
-
|
3963 |
-
|
3964 |
-
|
3965 |
-
|
3966 |
-
|
3967 |
-
|
3968 |
-
|
3969 |
-
$this->highlightPost = $vals['highlightPost'];
|
3970 |
-
}
|
3971 |
-
}
|
3972 |
}
|
3973 |
-
|
3974 |
-
|
3975 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3976 |
}
|
3977 |
-
|
3978 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3979 |
{
|
3980 |
-
|
3981 |
-
|
3982 |
-
|
3983 |
-
|
3984 |
-
|
3985 |
-
|
3986 |
-
|
3987 |
-
|
3988 |
-
|
3989 |
-
|
3990 |
-
|
3991 |
-
|
3992 |
-
|
3993 |
-
|
3994 |
-
|
3995 |
-
|
3996 |
-
|
3997 |
-
|
3998 |
-
|
3999 |
-
|
4000 |
-
|
4001 |
-
|
4002 |
-
|
4003 |
-
|
4004 |
-
|
4005 |
-
|
4006 |
-
|
4007 |
-
|
4008 |
-
|
4009 |
-
|
4010 |
-
|
4011 |
-
|
4012 |
-
|
4013 |
-
|
4014 |
-
|
4015 |
-
|
4016 |
-
|
4017 |
-
|
4018 |
-
|
4019 |
-
|
4020 |
-
|
4021 |
-
|
4022 |
-
|
4023 |
-
|
4024 |
-
|
4025 |
-
|
4026 |
-
|
4027 |
-
|
4028 |
-
|
4029 |
-
|
4030 |
-
|
4031 |
-
|
4032 |
-
|
4033 |
-
|
4034 |
-
|
4035 |
-
|
4036 |
-
|
4037 |
-
|
4038 |
-
|
4039 |
-
|
4040 |
-
}
|
4041 |
-
break;
|
4042 |
-
default:
|
4043 |
-
$xfer += $input->skip($ftype);
|
4044 |
-
break;
|
4045 |
-
}
|
4046 |
-
$xfer += $input->readFieldEnd();
|
4047 |
-
}
|
4048 |
-
$xfer += $input->readStructEnd();
|
4049 |
-
return $xfer;
|
4050 |
}
|
4051 |
-
|
4052 |
-
|
4053 |
-
|
4054 |
-
|
4055 |
-
|
4056 |
-
|
4057 |
-
|
4058 |
-
|
4059 |
-
|
4060 |
-
|
4061 |
-
|
4062 |
-
$xfer += $output->writeString($this->language);
|
4063 |
-
$xfer += $output->writeFieldEnd();
|
4064 |
-
}
|
4065 |
-
if ($this->queryText !== null) {
|
4066 |
-
$xfer += $output->writeFieldBegin('queryText', TType::STRING, 31);
|
4067 |
-
$xfer += $output->writeString($this->queryText);
|
4068 |
-
$xfer += $output->writeFieldEnd();
|
4069 |
-
}
|
4070 |
-
if ($this->suggestionsHitCount !== null) {
|
4071 |
-
$xfer += $output->writeFieldBegin('suggestionsHitCount', TType::I32, 41);
|
4072 |
-
$xfer += $output->writeI32($this->suggestionsHitCount);
|
4073 |
-
$xfer += $output->writeFieldEnd();
|
4074 |
-
}
|
4075 |
-
if ($this->highlight !== null) {
|
4076 |
-
$xfer += $output->writeFieldBegin('highlight', TType::BOOL, 51);
|
4077 |
-
$xfer += $output->writeBool($this->highlight);
|
4078 |
-
$xfer += $output->writeFieldEnd();
|
4079 |
-
}
|
4080 |
-
if ($this->highlightPre !== null) {
|
4081 |
-
$xfer += $output->writeFieldBegin('highlightPre', TType::STRING, 61);
|
4082 |
-
$xfer += $output->writeString($this->highlightPre);
|
4083 |
-
$xfer += $output->writeFieldEnd();
|
4084 |
-
}
|
4085 |
-
if ($this->highlightPost !== null) {
|
4086 |
-
$xfer += $output->writeFieldBegin('highlightPost', TType::STRING, 71);
|
4087 |
-
$xfer += $output->writeString($this->highlightPost);
|
4088 |
-
$xfer += $output->writeFieldEnd();
|
4089 |
-
}
|
4090 |
-
$xfer += $output->writeFieldStop();
|
4091 |
-
$xfer += $output->writeStructEnd();
|
4092 |
-
return $xfer;
|
4093 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4094 |
|
4095 |
}
|
4096 |
|
4097 |
class AutocompleteRequest {
|
4098 |
-
|
4099 |
-
|
4100 |
-
|
4101 |
-
|
4102 |
-
|
4103 |
-
|
4104 |
-
|
4105 |
-
|
4106 |
-
|
4107 |
-
|
4108 |
-
|
4109 |
-
|
4110 |
-
|
4111 |
-
|
4112 |
-
|
4113 |
-
|
4114 |
-
|
4115 |
-
|
4116 |
-
|
4117 |
-
|
4118 |
-
|
4119 |
-
|
4120 |
-
|
4121 |
-
|
4122 |
-
|
4123 |
-
|
4124 |
-
|
4125 |
-
|
4126 |
-
|
4127 |
-
|
4128 |
-
|
4129 |
-
|
4130 |
-
|
4131 |
-
|
4132 |
-
|
4133 |
-
|
4134 |
-
|
4135 |
-
|
4136 |
-
|
4137 |
-
|
4138 |
-
|
4139 |
-
|
4140 |
-
|
4141 |
-
|
4142 |
-
|
4143 |
-
|
4144 |
-
|
4145 |
-
|
4146 |
-
|
4147 |
-
|
4148 |
-
|
4149 |
-
|
4150 |
-
|
4151 |
-
|
4152 |
-
|
4153 |
-
|
4154 |
-
|
4155 |
-
|
4156 |
-
|
4157 |
-
|
4158 |
-
|
4159 |
-
|
4160 |
-
|
4161 |
-
|
4162 |
-
|
4163 |
-
|
4164 |
-
|
4165 |
-
|
4166 |
-
|
4167 |
-
|
4168 |
-
|
4169 |
-
|
4170 |
-
|
4171 |
-
|
4172 |
-
|
4173 |
-
|
4174 |
-
|
4175 |
-
|
4176 |
-
|
4177 |
-
|
4178 |
-
|
4179 |
-
|
4180 |
-
|
4181 |
-
|
4182 |
-
|
4183 |
-
|
4184 |
-
|
4185 |
-
$this->searchQuery = $vals['searchQuery'];
|
4186 |
-
}
|
4187 |
-
}
|
4188 |
}
|
4189 |
-
|
4190 |
-
|
4191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4192 |
}
|
4193 |
-
|
4194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4195 |
{
|
4196 |
-
|
4197 |
-
|
4198 |
-
|
4199 |
-
|
4200 |
-
|
4201 |
-
|
4202 |
-
|
4203 |
-
|
4204 |
-
|
4205 |
-
|
4206 |
-
|
4207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4208 |
{
|
4209 |
-
|
4210 |
-
|
4211 |
-
|
4212 |
-
|
4213 |
-
|
4214 |
-
|
4215 |
-
|
4216 |
-
|
4217 |
-
|
4218 |
-
|
4219 |
-
|
4220 |
-
|
4221 |
-
|
4222 |
-
|
4223 |
-
|
4224 |
-
|
4225 |
-
|
4226 |
-
|
4227 |
-
|
4228 |
-
|
4229 |
-
|
4230 |
-
|
4231 |
-
|
4232 |
-
|
4233 |
-
|
4234 |
-
|
4235 |
-
|
4236 |
-
|
4237 |
-
|
4238 |
-
|
4239 |
-
|
4240 |
-
|
4241 |
-
|
4242 |
-
|
4243 |
-
|
4244 |
-
|
4245 |
-
|
4246 |
-
|
4247 |
-
|
4248 |
-
|
4249 |
-
|
4250 |
-
$_etype204 = 0;
|
4251 |
-
$xfer += $input->readSetBegin($_etype204, $_size201);
|
4252 |
-
for ($_i205 = 0; $_i205 < $_size201; ++$_i205)
|
4253 |
-
{
|
4254 |
-
$elem206 = null;
|
4255 |
-
$xfer += $input->readString($elem206);
|
4256 |
-
if (is_scalar($elem206)) {
|
4257 |
-
$this->excludeVariantIds[$elem206] = true;
|
4258 |
-
} else {
|
4259 |
-
$this->excludeVariantIds []= $elem206;
|
4260 |
-
}
|
4261 |
-
}
|
4262 |
-
$xfer += $input->readSetEnd();
|
4263 |
-
} else {
|
4264 |
-
$xfer += $input->skip($ftype);
|
4265 |
-
}
|
4266 |
-
break;
|
4267 |
-
case 71:
|
4268 |
-
if ($ftype == TType::STRUCT) {
|
4269 |
-
$this->autocompleteQuery = new \com\boxalino\p13n\api\thrift\AutocompleteQuery();
|
4270 |
-
$xfer += $this->autocompleteQuery->read($input);
|
4271 |
-
} else {
|
4272 |
-
$xfer += $input->skip($ftype);
|
4273 |
-
}
|
4274 |
-
break;
|
4275 |
-
case 81:
|
4276 |
-
if ($ftype == TType::STRING) {
|
4277 |
-
$xfer += $input->readString($this->searchChoiceId);
|
4278 |
-
} else {
|
4279 |
-
$xfer += $input->skip($ftype);
|
4280 |
-
}
|
4281 |
-
break;
|
4282 |
-
case 91:
|
4283 |
-
if ($ftype == TType::STRUCT) {
|
4284 |
-
$this->searchQuery = new \com\boxalino\p13n\api\thrift\SimpleSearchQuery();
|
4285 |
-
$xfer += $this->searchQuery->read($input);
|
4286 |
-
} else {
|
4287 |
-
$xfer += $input->skip($ftype);
|
4288 |
-
}
|
4289 |
-
break;
|
4290 |
-
default:
|
4291 |
-
$xfer += $input->skip($ftype);
|
4292 |
-
break;
|
4293 |
-
}
|
4294 |
-
$xfer += $input->readFieldEnd();
|
4295 |
-
}
|
4296 |
-
$xfer += $input->readStructEnd();
|
4297 |
-
return $xfer;
|
4298 |
}
|
4299 |
-
|
4300 |
-
|
4301 |
-
|
4302 |
-
|
4303 |
-
|
4304 |
-
|
4305 |
-
|
4306 |
-
|
4307 |
-
|
4308 |
-
|
4309 |
-
|
4310 |
-
|
4311 |
-
|
4312 |
-
|
4313 |
-
|
4314 |
-
|
4315 |
-
|
4316 |
-
|
4317 |
-
|
4318 |
-
|
4319 |
-
|
4320 |
-
|
4321 |
-
|
4322 |
-
|
4323 |
-
|
4324 |
-
|
4325 |
-
|
4326 |
-
|
4327 |
-
|
4328 |
-
|
4329 |
-
|
4330 |
-
|
4331 |
-
|
4332 |
-
|
4333 |
-
|
4334 |
-
|
4335 |
-
|
4336 |
-
|
4337 |
-
|
4338 |
-
|
4339 |
-
|
4340 |
-
|
4341 |
-
|
4342 |
-
|
4343 |
-
|
4344 |
-
|
4345 |
-
|
4346 |
-
|
4347 |
-
|
4348 |
-
|
4349 |
-
|
4350 |
-
|
4351 |
-
|
4352 |
-
|
4353 |
-
|
4354 |
-
|
4355 |
-
|
4356 |
-
|
4357 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
4358 |
-
}
|
4359 |
-
$xfer += $output->writeFieldBegin('autocompleteQuery', TType::STRUCT, 71);
|
4360 |
-
$xfer += $this->autocompleteQuery->write($output);
|
4361 |
-
$xfer += $output->writeFieldEnd();
|
4362 |
-
}
|
4363 |
-
if ($this->searchChoiceId !== null) {
|
4364 |
-
$xfer += $output->writeFieldBegin('searchChoiceId', TType::STRING, 81);
|
4365 |
-
$xfer += $output->writeString($this->searchChoiceId);
|
4366 |
-
$xfer += $output->writeFieldEnd();
|
4367 |
-
}
|
4368 |
-
if ($this->searchQuery !== null) {
|
4369 |
-
if (!is_object($this->searchQuery)) {
|
4370 |
-
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
4371 |
-
}
|
4372 |
-
$xfer += $output->writeFieldBegin('searchQuery', TType::STRUCT, 91);
|
4373 |
-
$xfer += $this->searchQuery->write($output);
|
4374 |
-
$xfer += $output->writeFieldEnd();
|
4375 |
-
}
|
4376 |
-
$xfer += $output->writeFieldStop();
|
4377 |
-
$xfer += $output->writeStructEnd();
|
4378 |
-
return $xfer;
|
4379 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4380 |
|
4381 |
}
|
4382 |
|
4383 |
class AutocompleteResponse {
|
4384 |
-
|
4385 |
-
|
4386 |
-
|
4387 |
-
|
4388 |
-
|
4389 |
-
|
4390 |
-
|
4391 |
-
|
4392 |
-
|
4393 |
-
|
4394 |
-
|
4395 |
-
|
4396 |
-
|
4397 |
-
|
4398 |
-
|
4399 |
-
|
4400 |
-
|
4401 |
-
|
4402 |
-
|
4403 |
-
|
4404 |
-
|
4405 |
-
|
4406 |
-
|
4407 |
-
|
4408 |
-
|
4409 |
-
|
4410 |
-
|
4411 |
-
|
4412 |
-
|
4413 |
-
$this->prefixSearchResult = $vals['prefixSearchResult'];
|
4414 |
-
}
|
4415 |
-
}
|
4416 |
}
|
4417 |
-
|
4418 |
-
|
4419 |
-
|
|
|
|
|
|
|
|
|
4420 |
}
|
4421 |
-
|
4422 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4423 |
{
|
4424 |
-
|
4425 |
-
|
4426 |
-
|
4427 |
-
|
4428 |
-
|
4429 |
-
|
4430 |
-
|
4431 |
-
|
4432 |
-
|
4433 |
-
|
4434 |
-
|
4435 |
-
|
|
|
4436 |
{
|
4437 |
-
|
4438 |
-
|
4439 |
-
|
4440 |
-
|
4441 |
-
|
4442 |
-
|
4443 |
-
|
4444 |
-
|
4445 |
-
|
4446 |
-
|
4447 |
-
|
4448 |
-
|
4449 |
-
|
4450 |
-
|
4451 |
-
|
4452 |
-
|
4453 |
-
|
4454 |
-
|
4455 |
-
|
4456 |
-
|
4457 |
-
|
4458 |
-
|
4459 |
-
|
4460 |
-
|
4461 |
-
|
4462 |
-
|
4463 |
-
|
4464 |
-
|
4465 |
-
|
4466 |
-
|
4467 |
-
|
4468 |
-
|
4469 |
-
|
4470 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4471 |
}
|
|
|
|
|
|
|
|
|
4472 |
|
4473 |
-
|
4474 |
-
|
4475 |
-
|
4476 |
-
|
4477 |
-
|
4478 |
-
|
4479 |
-
|
4480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4481 |
{
|
4482 |
-
|
4483 |
-
|
4484 |
-
|
4485 |
-
|
4486 |
-
|
4487 |
-
|
4488 |
-
|
4489 |
-
|
4490 |
-
|
4491 |
-
|
4492 |
-
|
4493 |
-
|
4494 |
-
|
4495 |
-
|
4496 |
-
|
4497 |
-
|
4498 |
-
|
4499 |
-
|
4500 |
-
|
4501 |
-
|
4502 |
-
|
4503 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4504 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4505 |
|
4506 |
}
|
4507 |
|
4508 |
-
|
4509 |
-
|
4510 |
-
|
4511 |
-
|
4512 |
-
|
4513 |
-
|
4514 |
-
|
4515 |
-
|
4516 |
-
|
4517 |
-
|
4518 |
-
|
4519 |
-
|
4520 |
-
|
4521 |
-
|
4522 |
-
|
4523 |
-
|
4524 |
-
|
4525 |
-
|
4526 |
-
|
|
|
|
|
|
|
4527 |
}
|
4528 |
-
|
4529 |
-
|
4530 |
-
|
|
|
4531 |
}
|
4532 |
-
|
4533 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4534 |
{
|
4535 |
-
|
4536 |
-
|
4537 |
-
|
4538 |
-
|
4539 |
-
|
4540 |
-
|
4541 |
-
|
4542 |
-
|
4543 |
-
|
4544 |
-
|
4545 |
-
|
4546 |
-
|
4547 |
-
|
4548 |
-
|
4549 |
-
|
4550 |
-
|
4551 |
-
|
4552 |
-
|
4553 |
-
|
4554 |
-
|
4555 |
-
|
4556 |
-
|
4557 |
-
|
4558 |
-
|
4559 |
-
|
4560 |
-
|
4561 |
-
|
4562 |
-
|
|
|
|
|
4563 |
}
|
|
|
|
|
|
|
|
|
4564 |
|
4565 |
-
|
4566 |
-
|
4567 |
-
|
4568 |
-
|
4569 |
-
|
4570 |
-
|
4571 |
-
|
4572 |
-
|
4573 |
-
|
4574 |
-
|
4575 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4576 |
}
|
|
|
|
|
|
|
|
|
4577 |
|
4578 |
}
|
4579 |
|
2 |
namespace com\boxalino\p13n\api\thrift;
|
3 |
|
4 |
/**
|
5 |
+
* Autogenerated by Thrift Compiler (0.9.2)
|
6 |
*
|
7 |
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
8 |
* @generated
|
13 |
use Thrift\Exception\TException;
|
14 |
use Thrift\Exception\TProtocolException;
|
15 |
use Thrift\Protocol\TProtocol;
|
16 |
+
use Thrift\Protocol\TBinaryProtocolAccelerated;
|
17 |
use Thrift\Exception\TApplicationException;
|
18 |
|
19 |
|
20 |
+
/**
|
21 |
+
* Used for date facets
|
22 |
+
*/
|
23 |
final class DateRangeGap {
|
24 |
+
const SECOND = 1;
|
25 |
+
const MINUTE = 2;
|
26 |
+
const HOUR = 3;
|
27 |
+
const DAY = 4;
|
28 |
+
const WEEK = 5;
|
29 |
+
const MONTH = 6;
|
30 |
+
const YEAR = 7;
|
31 |
+
const DECADE = 8;
|
32 |
+
const CENTURY = 9;
|
33 |
+
static public $__names = array(
|
34 |
+
1 => 'SECOND',
|
35 |
+
2 => 'MINUTE',
|
36 |
+
3 => 'HOUR',
|
37 |
+
4 => 'DAY',
|
38 |
+
5 => 'WEEK',
|
39 |
+
6 => 'MONTH',
|
40 |
+
7 => 'YEAR',
|
41 |
+
8 => 'DECADE',
|
42 |
+
9 => 'CENTURY',
|
43 |
+
);
|
44 |
}
|
45 |
|
46 |
+
/**
|
47 |
+
* Whether facets should be order by population descending or by collation
|
48 |
+
*/
|
49 |
final class FacetSortOrder {
|
50 |
+
const POPULATION = 1;
|
51 |
+
const COLLATION = 2;
|
52 |
+
static public $__names = array(
|
53 |
+
1 => 'POPULATION',
|
54 |
+
2 => 'COLLATION',
|
55 |
+
);
|
56 |
}
|
57 |
|
58 |
+
/**
|
59 |
+
* Filter to be used in query. Note that type of generated filter depends on first non-null and non-empty value in order of preference. Values of lower priority are ignored:
|
60 |
+
* stringValues!=null && simpleValues.size()>0 => simple match, prefix!=null => prefix match, hierarchy!=null && hierarchy.size()>0 => hierarchy filter, else range filter
|
61 |
+
*
|
62 |
+
* <dl>
|
63 |
+
* <dt>negative</dt>
|
64 |
+
* <dd>whether the filter is negative (boolean NOT)</dd>
|
65 |
+
*
|
66 |
+
* <dt>fieldName</dt>
|
67 |
+
* <dd>field name to apply filter to</dd>
|
68 |
+
*
|
69 |
+
* <dt>stringValues</dt>
|
70 |
+
* <dd>values for simple match</dd>
|
71 |
+
*
|
72 |
+
* <dt>prefix</dt>
|
73 |
+
* <dd>prefix match</dd>
|
74 |
+
*
|
75 |
+
* <dt>hierarchyId</dt>
|
76 |
+
* <dd>hierarchy filter - when corresponding hierarchical field has encoded id</dd>
|
77 |
+
*
|
78 |
+
* <dt>hierarchy</dt>
|
79 |
+
* <dd>hierarchy filter - for example categories path in top-down order</dd>
|
80 |
+
*
|
81 |
+
* <dt>rangeFrom</dt>
|
82 |
+
* <dd>lower bound for range filter</dd>
|
83 |
+
*
|
84 |
+
* <dt>rangeFromInclusive</dt>
|
85 |
+
* <dd>whether the lower bound is inclusive</dd>
|
86 |
+
*
|
87 |
+
* <dt>rangeTo</dt>
|
88 |
+
* <dd>upper bound for range filter</dd>
|
89 |
+
*
|
90 |
+
* <dt>rangeToInclusive</dt>
|
91 |
+
* <dd>whether the upper bound is inclusive</dd>
|
92 |
+
* </dl>
|
93 |
+
*/
|
94 |
class Filter {
|
95 |
+
static $_TSPEC;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @var bool
|
99 |
+
*/
|
100 |
+
public $negative = null;
|
101 |
+
/**
|
102 |
+
* @var string
|
103 |
+
*/
|
104 |
+
public $fieldName = null;
|
105 |
+
/**
|
106 |
+
* @var string[]
|
107 |
+
*/
|
108 |
+
public $stringValues = null;
|
109 |
+
/**
|
110 |
+
* @var string
|
111 |
+
*/
|
112 |
+
public $prefix = null;
|
113 |
+
/**
|
114 |
+
* @var string
|
115 |
+
*/
|
116 |
+
public $hierarchyId = null;
|
117 |
+
/**
|
118 |
+
* @var string[]
|
119 |
+
*/
|
120 |
+
public $hierarchy = null;
|
121 |
+
/**
|
122 |
+
* @var string
|
123 |
+
*/
|
124 |
+
public $rangeFrom = null;
|
125 |
+
/**
|
126 |
+
* @var bool
|
127 |
+
*/
|
128 |
+
public $rangeFromInclusive = null;
|
129 |
+
/**
|
130 |
+
* @var string
|
131 |
+
*/
|
132 |
+
public $rangeTo = null;
|
133 |
+
/**
|
134 |
+
* @var bool
|
135 |
+
*/
|
136 |
+
public $rangeToInclusive = null;
|
137 |
+
|
138 |
+
public function __construct($vals=null) {
|
139 |
+
if (!isset(self::$_TSPEC)) {
|
140 |
+
self::$_TSPEC = array(
|
141 |
+
1 => array(
|
142 |
+
'var' => 'negative',
|
143 |
+
'type' => TType::BOOL,
|
144 |
+
),
|
145 |
+
2 => array(
|
146 |
+
'var' => 'fieldName',
|
147 |
+
'type' => TType::STRING,
|
148 |
+
),
|
149 |
+
3 => array(
|
150 |
+
'var' => 'stringValues',
|
151 |
+
'type' => TType::LST,
|
152 |
+
'etype' => TType::STRING,
|
153 |
+
'elem' => array(
|
154 |
+
'type' => TType::STRING,
|
155 |
+
),
|
156 |
+
),
|
157 |
+
4 => array(
|
158 |
+
'var' => 'prefix',
|
159 |
+
'type' => TType::STRING,
|
160 |
+
),
|
161 |
+
41 => array(
|
162 |
+
'var' => 'hierarchyId',
|
163 |
+
'type' => TType::STRING,
|
164 |
+
),
|
165 |
+
5 => array(
|
166 |
+
'var' => 'hierarchy',
|
167 |
+
'type' => TType::LST,
|
168 |
+
'etype' => TType::STRING,
|
169 |
+
'elem' => array(
|
170 |
+
'type' => TType::STRING,
|
171 |
+
),
|
172 |
+
),
|
173 |
+
6 => array(
|
174 |
+
'var' => 'rangeFrom',
|
175 |
+
'type' => TType::STRING,
|
176 |
+
),
|
177 |
+
7 => array(
|
178 |
+
'var' => 'rangeFromInclusive',
|
179 |
+
'type' => TType::BOOL,
|
180 |
+
),
|
181 |
+
8 => array(
|
182 |
+
'var' => 'rangeTo',
|
183 |
+
'type' => TType::STRING,
|
184 |
+
),
|
185 |
+
9 => array(
|
186 |
+
'var' => 'rangeToInclusive',
|
187 |
+
'type' => TType::BOOL,
|
188 |
+
),
|
189 |
+
);
|
|
|
|
|
|
|
190 |
}
|
191 |
+
if (is_array($vals)) {
|
192 |
+
if (isset($vals['negative'])) {
|
193 |
+
$this->negative = $vals['negative'];
|
194 |
+
}
|
195 |
+
if (isset($vals['fieldName'])) {
|
196 |
+
$this->fieldName = $vals['fieldName'];
|
197 |
+
}
|
198 |
+
if (isset($vals['stringValues'])) {
|
199 |
+
$this->stringValues = $vals['stringValues'];
|
200 |
+
}
|
201 |
+
if (isset($vals['prefix'])) {
|
202 |
+
$this->prefix = $vals['prefix'];
|
203 |
+
}
|
204 |
+
if (isset($vals['hierarchyId'])) {
|
205 |
+
$this->hierarchyId = $vals['hierarchyId'];
|
206 |
+
}
|
207 |
+
if (isset($vals['hierarchy'])) {
|
208 |
+
$this->hierarchy = $vals['hierarchy'];
|
209 |
+
}
|
210 |
+
if (isset($vals['rangeFrom'])) {
|
211 |
+
$this->rangeFrom = $vals['rangeFrom'];
|
212 |
+
}
|
213 |
+
if (isset($vals['rangeFromInclusive'])) {
|
214 |
+
$this->rangeFromInclusive = $vals['rangeFromInclusive'];
|
215 |
+
}
|
216 |
+
if (isset($vals['rangeTo'])) {
|
217 |
+
$this->rangeTo = $vals['rangeTo'];
|
218 |
+
}
|
219 |
+
if (isset($vals['rangeToInclusive'])) {
|
220 |
+
$this->rangeToInclusive = $vals['rangeToInclusive'];
|
221 |
+
}
|
222 |
}
|
223 |
+
}
|
224 |
+
|
225 |
+
public function getName() {
|
226 |
+
return 'Filter';
|
227 |
+
}
|
228 |
+
|
229 |
+
public function read($input)
|
230 |
+
{
|
231 |
+
$xfer = 0;
|
232 |
+
$fname = null;
|
233 |
+
$ftype = 0;
|
234 |
+
$fid = 0;
|
235 |
+
$xfer += $input->readStructBegin($fname);
|
236 |
+
while (true)
|
237 |
{
|
238 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
239 |
+
if ($ftype == TType::STOP) {
|
240 |
+
break;
|
241 |
+
}
|
242 |
+
switch ($fid)
|
243 |
+
{
|
244 |
+
case 1:
|
245 |
+
if ($ftype == TType::BOOL) {
|
246 |
+
$xfer += $input->readBool($this->negative);
|
247 |
+
} else {
|
248 |
+
$xfer += $input->skip($ftype);
|
249 |
+
}
|
250 |
+
break;
|
251 |
+
case 2:
|
252 |
+
if ($ftype == TType::STRING) {
|
253 |
+
$xfer += $input->readString($this->fieldName);
|
254 |
+
} else {
|
255 |
+
$xfer += $input->skip($ftype);
|
256 |
+
}
|
257 |
+
break;
|
258 |
+
case 3:
|
259 |
+
if ($ftype == TType::LST) {
|
260 |
+
$this->stringValues = array();
|
261 |
+
$_size0 = 0;
|
262 |
+
$_etype3 = 0;
|
263 |
+
$xfer += $input->readListBegin($_etype3, $_size0);
|
264 |
+
for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
|
265 |
{
|
266 |
+
$elem5 = null;
|
267 |
+
$xfer += $input->readString($elem5);
|
268 |
+
$this->stringValues []= $elem5;
|
269 |
+
}
|
270 |
+
$xfer += $input->readListEnd();
|
271 |
+
} else {
|
272 |
+
$xfer += $input->skip($ftype);
|
273 |
+
}
|
274 |
+
break;
|
275 |
+
case 4:
|
276 |
+
if ($ftype == TType::STRING) {
|
277 |
+
$xfer += $input->readString($this->prefix);
|
278 |
+
} else {
|
279 |
+
$xfer += $input->skip($ftype);
|
280 |
+
}
|
281 |
+
break;
|
282 |
+
case 41:
|
283 |
+
if ($ftype == TType::STRING) {
|
284 |
+
$xfer += $input->readString($this->hierarchyId);
|
285 |
+
} else {
|
286 |
+
$xfer += $input->skip($ftype);
|
287 |
+
}
|
288 |
+
break;
|
289 |
+
case 5:
|
290 |
+
if ($ftype == TType::LST) {
|
291 |
+
$this->hierarchy = array();
|
292 |
+
$_size6 = 0;
|
293 |
+
$_etype9 = 0;
|
294 |
+
$xfer += $input->readListBegin($_etype9, $_size6);
|
295 |
+
for ($_i10 = 0; $_i10 < $_size6; ++$_i10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
{
|
297 |
+
$elem11 = null;
|
298 |
+
$xfer += $input->readString($elem11);
|
299 |
+
$this->hierarchy []= $elem11;
|
300 |
+
}
|
301 |
+
$xfer += $input->readListEnd();
|
302 |
+
} else {
|
303 |
+
$xfer += $input->skip($ftype);
|
304 |
+
}
|
305 |
+
break;
|
306 |
+
case 6:
|
307 |
+
if ($ftype == TType::STRING) {
|
308 |
+
$xfer += $input->readString($this->rangeFrom);
|
309 |
+
} else {
|
310 |
+
$xfer += $input->skip($ftype);
|
311 |
+
}
|
312 |
+
break;
|
313 |
+
case 7:
|
314 |
+
if ($ftype == TType::BOOL) {
|
315 |
+
$xfer += $input->readBool($this->rangeFromInclusive);
|
316 |
+
} else {
|
317 |
+
$xfer += $input->skip($ftype);
|
318 |
+
}
|
319 |
+
break;
|
320 |
+
case 8:
|
321 |
+
if ($ftype == TType::STRING) {
|
322 |
+
$xfer += $input->readString($this->rangeTo);
|
323 |
+
} else {
|
324 |
+
$xfer += $input->skip($ftype);
|
325 |
+
}
|
326 |
+
break;
|
327 |
+
case 9:
|
328 |
+
if ($ftype == TType::BOOL) {
|
329 |
+
$xfer += $input->readBool($this->rangeToInclusive);
|
330 |
+
} else {
|
331 |
+
$xfer += $input->skip($ftype);
|
332 |
+
}
|
333 |
+
break;
|
334 |
+
default:
|
335 |
+
$xfer += $input->skip($ftype);
|
336 |
+
break;
|
337 |
+
}
|
338 |
+
$xfer += $input->readFieldEnd();
|
339 |
+
}
|
340 |
+
$xfer += $input->readStructEnd();
|
341 |
+
return $xfer;
|
342 |
+
}
|
343 |
+
|
344 |
+
public function write($output) {
|
345 |
+
$xfer = 0;
|
346 |
+
$xfer += $output->writeStructBegin('Filter');
|
347 |
+
if ($this->negative !== null) {
|
348 |
+
$xfer += $output->writeFieldBegin('negative', TType::BOOL, 1);
|
349 |
+
$xfer += $output->writeBool($this->negative);
|
350 |
+
$xfer += $output->writeFieldEnd();
|
351 |
+
}
|
352 |
+
if ($this->fieldName !== null) {
|
353 |
+
$xfer += $output->writeFieldBegin('fieldName', TType::STRING, 2);
|
354 |
+
$xfer += $output->writeString($this->fieldName);
|
355 |
+
$xfer += $output->writeFieldEnd();
|
356 |
+
}
|
357 |
+
if ($this->stringValues !== null) {
|
358 |
+
if (!is_array($this->stringValues)) {
|
359 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
360 |
+
}
|
361 |
+
$xfer += $output->writeFieldBegin('stringValues', TType::LST, 3);
|
362 |
+
{
|
363 |
+
$output->writeListBegin(TType::STRING, count($this->stringValues));
|
364 |
+
{
|
365 |
+
foreach ($this->stringValues as $iter12)
|
366 |
+
{
|
367 |
+
$xfer += $output->writeString($iter12);
|
368 |
+
}
|
369 |
+
}
|
370 |
+
$output->writeListEnd();
|
371 |
+
}
|
372 |
+
$xfer += $output->writeFieldEnd();
|
373 |
+
}
|
374 |
+
if ($this->prefix !== null) {
|
375 |
+
$xfer += $output->writeFieldBegin('prefix', TType::STRING, 4);
|
376 |
+
$xfer += $output->writeString($this->prefix);
|
377 |
+
$xfer += $output->writeFieldEnd();
|
378 |
+
}
|
379 |
+
if ($this->hierarchy !== null) {
|
380 |
+
if (!is_array($this->hierarchy)) {
|
381 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
382 |
+
}
|
383 |
+
$xfer += $output->writeFieldBegin('hierarchy', TType::LST, 5);
|
384 |
+
{
|
385 |
+
$output->writeListBegin(TType::STRING, count($this->hierarchy));
|
386 |
+
{
|
387 |
+
foreach ($this->hierarchy as $iter13)
|
388 |
+
{
|
389 |
+
$xfer += $output->writeString($iter13);
|
390 |
+
}
|
391 |
+
}
|
392 |
+
$output->writeListEnd();
|
393 |
+
}
|
394 |
+
$xfer += $output->writeFieldEnd();
|
395 |
}
|
396 |
+
if ($this->rangeFrom !== null) {
|
397 |
+
$xfer += $output->writeFieldBegin('rangeFrom', TType::STRING, 6);
|
398 |
+
$xfer += $output->writeString($this->rangeFrom);
|
399 |
+
$xfer += $output->writeFieldEnd();
|
400 |
+
}
|
401 |
+
if ($this->rangeFromInclusive !== null) {
|
402 |
+
$xfer += $output->writeFieldBegin('rangeFromInclusive', TType::BOOL, 7);
|
403 |
+
$xfer += $output->writeBool($this->rangeFromInclusive);
|
404 |
+
$xfer += $output->writeFieldEnd();
|
405 |
+
}
|
406 |
+
if ($this->rangeTo !== null) {
|
407 |
+
$xfer += $output->writeFieldBegin('rangeTo', TType::STRING, 8);
|
408 |
+
$xfer += $output->writeString($this->rangeTo);
|
409 |
+
$xfer += $output->writeFieldEnd();
|
410 |
+
}
|
411 |
+
if ($this->rangeToInclusive !== null) {
|
412 |
+
$xfer += $output->writeFieldBegin('rangeToInclusive', TType::BOOL, 9);
|
413 |
+
$xfer += $output->writeBool($this->rangeToInclusive);
|
414 |
+
$xfer += $output->writeFieldEnd();
|
415 |
+
}
|
416 |
+
if ($this->hierarchyId !== null) {
|
417 |
+
$xfer += $output->writeFieldBegin('hierarchyId', TType::STRING, 41);
|
418 |
+
$xfer += $output->writeString($this->hierarchyId);
|
419 |
+
$xfer += $output->writeFieldEnd();
|
420 |
+
}
|
421 |
+
$xfer += $output->writeFieldStop();
|
422 |
+
$xfer += $output->writeStructEnd();
|
423 |
+
return $xfer;
|
424 |
+
}
|
425 |
|
426 |
}
|
427 |
|
428 |
+
/**
|
429 |
+
* <dl>
|
430 |
+
* <dt>stringValue</dt>
|
431 |
+
* <dd>corresponding value of the facet</dd>
|
432 |
+
*
|
433 |
+
* <dt>rangeFromInclusive</dt>
|
434 |
+
* <dd>if range facets lower bound (inclusive)</dd>
|
435 |
+
*
|
436 |
+
* <dt>rangeToExclusive</dt>
|
437 |
+
* <dd>if range facets upper bound (inclusive)</dd>
|
438 |
+
*
|
439 |
+
* <dt>hitCount</dt>
|
440 |
+
* <dd>number of hits found</dd>
|
441 |
+
*
|
442 |
+
* <dt>hierarchyId</dt>
|
443 |
+
* <dd>id of hierarchy if corresponding field is hierarchical</dd>
|
444 |
+
*
|
445 |
+
* <dt>hierarchy</dt>
|
446 |
+
* <dd>hierarchy if corresponding field is hierarchical</dd>
|
447 |
+
*
|
448 |
+
* <dt>selected</dt>
|
449 |
+
* <dd>whether the facet value has been selected in corresponding FacetRequest</dd>
|
450 |
+
* </dl>
|
451 |
+
*/
|
452 |
class FacetValue {
|
453 |
+
static $_TSPEC;
|
454 |
+
|
455 |
+
/**
|
456 |
+
* @var string
|
457 |
+
*/
|
458 |
+
public $stringValue = null;
|
459 |
+
/**
|
460 |
+
* @var string
|
461 |
+
*/
|
462 |
+
public $rangeFromInclusive = null;
|
463 |
+
/**
|
464 |
+
* @var string
|
465 |
+
*/
|
466 |
+
public $rangeToExclusive = null;
|
467 |
+
/**
|
468 |
+
* @var int
|
469 |
+
*/
|
470 |
+
public $hitCount = null;
|
471 |
+
/**
|
472 |
+
* @var string
|
473 |
+
*/
|
474 |
+
public $hierarchyId = null;
|
475 |
+
/**
|
476 |
+
* @var string[]
|
477 |
+
*/
|
478 |
+
public $hierarchy = null;
|
479 |
+
/**
|
480 |
+
* @var bool
|
481 |
+
*/
|
482 |
+
public $selected = null;
|
483 |
+
|
484 |
+
public function __construct($vals=null) {
|
485 |
+
if (!isset(self::$_TSPEC)) {
|
486 |
+
self::$_TSPEC = array(
|
487 |
+
1 => array(
|
488 |
+
'var' => 'stringValue',
|
489 |
+
'type' => TType::STRING,
|
490 |
+
),
|
491 |
+
2 => array(
|
492 |
+
'var' => 'rangeFromInclusive',
|
493 |
+
'type' => TType::STRING,
|
494 |
+
),
|
495 |
+
3 => array(
|
496 |
+
'var' => 'rangeToExclusive',
|
497 |
+
'type' => TType::STRING,
|
498 |
+
),
|
499 |
+
4 => array(
|
500 |
+
'var' => 'hitCount',
|
501 |
+
'type' => TType::I64,
|
502 |
+
),
|
503 |
+
50 => array(
|
504 |
+
'var' => 'hierarchyId',
|
505 |
+
'type' => TType::STRING,
|
506 |
+
),
|
507 |
+
60 => array(
|
508 |
+
'var' => 'hierarchy',
|
509 |
+
'type' => TType::LST,
|
510 |
+
'etype' => TType::STRING,
|
511 |
+
'elem' => array(
|
512 |
+
'type' => TType::STRING,
|
513 |
+
),
|
514 |
+
),
|
515 |
+
70 => array(
|
516 |
+
'var' => 'selected',
|
517 |
+
'type' => TType::BOOL,
|
518 |
+
),
|
519 |
+
);
|
|
|
|
|
|
|
520 |
}
|
521 |
+
if (is_array($vals)) {
|
522 |
+
if (isset($vals['stringValue'])) {
|
523 |
+
$this->stringValue = $vals['stringValue'];
|
524 |
+
}
|
525 |
+
if (isset($vals['rangeFromInclusive'])) {
|
526 |
+
$this->rangeFromInclusive = $vals['rangeFromInclusive'];
|
527 |
+
}
|
528 |
+
if (isset($vals['rangeToExclusive'])) {
|
529 |
+
$this->rangeToExclusive = $vals['rangeToExclusive'];
|
530 |
+
}
|
531 |
+
if (isset($vals['hitCount'])) {
|
532 |
+
$this->hitCount = $vals['hitCount'];
|
533 |
+
}
|
534 |
+
if (isset($vals['hierarchyId'])) {
|
535 |
+
$this->hierarchyId = $vals['hierarchyId'];
|
536 |
+
}
|
537 |
+
if (isset($vals['hierarchy'])) {
|
538 |
+
$this->hierarchy = $vals['hierarchy'];
|
539 |
+
}
|
540 |
+
if (isset($vals['selected'])) {
|
541 |
+
$this->selected = $vals['selected'];
|
542 |
+
}
|
543 |
}
|
544 |
+
}
|
545 |
+
|
546 |
+
public function getName() {
|
547 |
+
return 'FacetValue';
|
548 |
+
}
|
549 |
+
|
550 |
+
public function read($input)
|
551 |
+
{
|
552 |
+
$xfer = 0;
|
553 |
+
$fname = null;
|
554 |
+
$ftype = 0;
|
555 |
+
$fid = 0;
|
556 |
+
$xfer += $input->readStructBegin($fname);
|
557 |
+
while (true)
|
558 |
{
|
559 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
560 |
+
if ($ftype == TType::STOP) {
|
561 |
+
break;
|
562 |
+
}
|
563 |
+
switch ($fid)
|
564 |
+
{
|
565 |
+
case 1:
|
566 |
+
if ($ftype == TType::STRING) {
|
567 |
+
$xfer += $input->readString($this->stringValue);
|
568 |
+
} else {
|
569 |
+
$xfer += $input->skip($ftype);
|
570 |
+
}
|
571 |
+
break;
|
572 |
+
case 2:
|
573 |
+
if ($ftype == TType::STRING) {
|
574 |
+
$xfer += $input->readString($this->rangeFromInclusive);
|
575 |
+
} else {
|
576 |
+
$xfer += $input->skip($ftype);
|
577 |
+
}
|
578 |
+
break;
|
579 |
+
case 3:
|
580 |
+
if ($ftype == TType::STRING) {
|
581 |
+
$xfer += $input->readString($this->rangeToExclusive);
|
582 |
+
} else {
|
583 |
+
$xfer += $input->skip($ftype);
|
584 |
+
}
|
585 |
+
break;
|
586 |
+
case 4:
|
587 |
+
if ($ftype == TType::I64) {
|
588 |
+
$xfer += $input->readI64($this->hitCount);
|
589 |
+
} else {
|
590 |
+
$xfer += $input->skip($ftype);
|
591 |
+
}
|
592 |
+
break;
|
593 |
+
case 50:
|
594 |
+
if ($ftype == TType::STRING) {
|
595 |
+
$xfer += $input->readString($this->hierarchyId);
|
596 |
+
} else {
|
597 |
+
$xfer += $input->skip($ftype);
|
598 |
+
}
|
599 |
+
break;
|
600 |
+
case 60:
|
601 |
+
if ($ftype == TType::LST) {
|
602 |
+
$this->hierarchy = array();
|
603 |
+
$_size14 = 0;
|
604 |
+
$_etype17 = 0;
|
605 |
+
$xfer += $input->readListBegin($_etype17, $_size14);
|
606 |
+
for ($_i18 = 0; $_i18 < $_size14; ++$_i18)
|
607 |
{
|
608 |
+
$elem19 = null;
|
609 |
+
$xfer += $input->readString($elem19);
|
610 |
+
$this->hierarchy []= $elem19;
|
611 |
+
}
|
612 |
+
$xfer += $input->readListEnd();
|
613 |
+
} else {
|
614 |
+
$xfer += $input->skip($ftype);
|
615 |
+
}
|
616 |
+
break;
|
617 |
+
case 70:
|
618 |
+
if ($ftype == TType::BOOL) {
|
619 |
+
$xfer += $input->readBool($this->selected);
|
620 |
+
} else {
|
621 |
+
$xfer += $input->skip($ftype);
|
622 |
+
}
|
623 |
+
break;
|
624 |
+
default:
|
625 |
+
$xfer += $input->skip($ftype);
|
626 |
+
break;
|
627 |
+
}
|
628 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
}
|
630 |
+
$xfer += $input->readStructEnd();
|
631 |
+
return $xfer;
|
632 |
+
}
|
633 |
+
|
634 |
+
public function write($output) {
|
635 |
+
$xfer = 0;
|
636 |
+
$xfer += $output->writeStructBegin('FacetValue');
|
637 |
+
if ($this->stringValue !== null) {
|
638 |
+
$xfer += $output->writeFieldBegin('stringValue', TType::STRING, 1);
|
639 |
+
$xfer += $output->writeString($this->stringValue);
|
640 |
+
$xfer += $output->writeFieldEnd();
|
641 |
+
}
|
642 |
+
if ($this->rangeFromInclusive !== null) {
|
643 |
+
$xfer += $output->writeFieldBegin('rangeFromInclusive', TType::STRING, 2);
|
644 |
+
$xfer += $output->writeString($this->rangeFromInclusive);
|
645 |
+
$xfer += $output->writeFieldEnd();
|
646 |
+
}
|
647 |
+
if ($this->rangeToExclusive !== null) {
|
648 |
+
$xfer += $output->writeFieldBegin('rangeToExclusive', TType::STRING, 3);
|
649 |
+
$xfer += $output->writeString($this->rangeToExclusive);
|
650 |
+
$xfer += $output->writeFieldEnd();
|
651 |
+
}
|
652 |
+
if ($this->hitCount !== null) {
|
653 |
+
$xfer += $output->writeFieldBegin('hitCount', TType::I64, 4);
|
654 |
+
$xfer += $output->writeI64($this->hitCount);
|
655 |
+
$xfer += $output->writeFieldEnd();
|
656 |
+
}
|
657 |
+
if ($this->hierarchyId !== null) {
|
658 |
+
$xfer += $output->writeFieldBegin('hierarchyId', TType::STRING, 50);
|
659 |
+
$xfer += $output->writeString($this->hierarchyId);
|
660 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
}
|
662 |
+
if ($this->hierarchy !== null) {
|
663 |
+
if (!is_array($this->hierarchy)) {
|
664 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
665 |
+
}
|
666 |
+
$xfer += $output->writeFieldBegin('hierarchy', TType::LST, 60);
|
667 |
+
{
|
668 |
+
$output->writeListBegin(TType::STRING, count($this->hierarchy));
|
669 |
+
{
|
670 |
+
foreach ($this->hierarchy as $iter20)
|
671 |
+
{
|
672 |
+
$xfer += $output->writeString($iter20);
|
673 |
+
}
|
674 |
+
}
|
675 |
+
$output->writeListEnd();
|
676 |
+
}
|
677 |
+
$xfer += $output->writeFieldEnd();
|
678 |
+
}
|
679 |
+
if ($this->selected !== null) {
|
680 |
+
$xfer += $output->writeFieldBegin('selected', TType::BOOL, 70);
|
681 |
+
$xfer += $output->writeBool($this->selected);
|
682 |
+
$xfer += $output->writeFieldEnd();
|
683 |
+
}
|
684 |
+
$xfer += $output->writeFieldStop();
|
685 |
+
$xfer += $output->writeStructEnd();
|
686 |
+
return $xfer;
|
687 |
+
}
|
688 |
|
689 |
}
|
690 |
|
691 |
+
/**
|
692 |
+
* <dl>
|
693 |
+
* <dt>fieldName</dt>
|
694 |
+
* <dd>name of the field to get facet for</dd>
|
695 |
+
*
|
696 |
+
* <dt>numerical</dt>
|
697 |
+
* <dd>whether the facet is numerical</dd>
|
698 |
+
*
|
699 |
+
* <dt>range</dt>
|
700 |
+
* <dd>whether the facet is range facet</dd>
|
701 |
+
*
|
702 |
+
* <dt>maxCount</dt>
|
703 |
+
* <dd>maximum number of facets to return by given order, -1 for all of them</dd>
|
704 |
+
*
|
705 |
+
* <dt>minPopulation</dt>
|
706 |
+
* <dd>minimum facet population to return</dd>
|
707 |
+
*
|
708 |
+
* <dt>dateRangeGap</dt>
|
709 |
+
* <dd>if the corresponding field is date then the gap to be used for facet</dd>
|
710 |
+
*
|
711 |
+
* <dt>sortOrder</dt>
|
712 |
+
* <dd>sort order</dd>
|
713 |
+
*
|
714 |
+
* <dt>sortAscending</dt>
|
715 |
+
* <dd>whether the sort should be done ascending</dd>
|
716 |
+
*
|
717 |
+
* <dt>selectedValues</dt>
|
718 |
+
* <dd>values selected from the facet.</dd>
|
719 |
+
* <dd>Note that results will be filtered by these values, but the corresponding
|
720 |
+
* FacetResponse is as if this filter was not applied</dd>
|
721 |
+
*
|
722 |
+
* <dt>andSelectedValues</dt>
|
723 |
+
* <dd>whether selectedValues should be considered in AND logic, meaning filter
|
724 |
+
* out those that don't contain ALL selected values - default is OR - include
|
725 |
+
* those contianing any of selectedValue</dd>
|
726 |
+
* </dl>
|
727 |
+
*/
|
728 |
class FacetRequest {
|
729 |
+
static $_TSPEC;
|
730 |
+
|
731 |
+
/**
|
732 |
+
* @var string
|
733 |
+
*/
|
734 |
+
public $fieldName = null;
|
735 |
+
/**
|
736 |
+
* @var bool
|
737 |
+
*/
|
738 |
+
public $numerical = null;
|
739 |
+
/**
|
740 |
+
* @var bool
|
741 |
+
*/
|
742 |
+
public $range = null;
|
743 |
+
/**
|
744 |
+
* @var int
|
745 |
+
*/
|
746 |
+
public $maxCount = -1;
|
747 |
+
/**
|
748 |
+
* @var int
|
749 |
+
*/
|
750 |
+
public $minPopulation = 1;
|
751 |
+
/**
|
752 |
+
* @var int
|
753 |
+
*/
|
754 |
+
public $dateRangeGap = null;
|
755 |
+
/**
|
756 |
+
* @var int
|
757 |
+
*/
|
758 |
+
public $sortOrder = null;
|
759 |
+
/**
|
760 |
+
* @var bool
|
761 |
+
*/
|
762 |
+
public $sortAscending = null;
|
763 |
+
/**
|
764 |
+
* @var \com\boxalino\p13n\api\thrift\FacetValue[]
|
765 |
+
*/
|
766 |
+
public $selectedValues = null;
|
767 |
+
/**
|
768 |
+
* @var bool
|
769 |
+
*/
|
770 |
+
public $andSelectedValues = false;
|
771 |
+
|
772 |
+
public function __construct($vals=null) {
|
773 |
+
if (!isset(self::$_TSPEC)) {
|
774 |
+
self::$_TSPEC = array(
|
775 |
+
1 => array(
|
776 |
+
'var' => 'fieldName',
|
777 |
+
'type' => TType::STRING,
|
778 |
+
),
|
779 |
+
2 => array(
|
780 |
+
'var' => 'numerical',
|
781 |
+
'type' => TType::BOOL,
|
782 |
+
),
|
783 |
+
3 => array(
|
784 |
+
'var' => 'range',
|
785 |
+
'type' => TType::BOOL,
|
786 |
+
),
|
787 |
+
4 => array(
|
788 |
+
'var' => 'maxCount',
|
789 |
+
'type' => TType::I32,
|
790 |
+
),
|
791 |
+
5 => array(
|
792 |
+
'var' => 'minPopulation',
|
793 |
+
'type' => TType::I32,
|
794 |
+
),
|
795 |
+
6 => array(
|
796 |
+
'var' => 'dateRangeGap',
|
797 |
+
'type' => TType::I32,
|
798 |
+
),
|
799 |
+
7 => array(
|
800 |
+
'var' => 'sortOrder',
|
801 |
+
'type' => TType::I32,
|
802 |
+
),
|
803 |
+
8 => array(
|
804 |
+
'var' => 'sortAscending',
|
805 |
+
'type' => TType::BOOL,
|
806 |
+
),
|
807 |
+
90 => array(
|
808 |
+
'var' => 'selectedValues',
|
809 |
+
'type' => TType::LST,
|
810 |
+
'etype' => TType::STRUCT,
|
811 |
+
'elem' => array(
|
812 |
+
'type' => TType::STRUCT,
|
813 |
+
'class' => '\com\boxalino\p13n\api\thrift\FacetValue',
|
814 |
+
),
|
815 |
+
),
|
816 |
+
100 => array(
|
817 |
+
'var' => 'andSelectedValues',
|
818 |
+
'type' => TType::BOOL,
|
819 |
+
),
|
820 |
+
);
|
|
|
|
|
|
|
821 |
}
|
822 |
+
if (is_array($vals)) {
|
823 |
+
if (isset($vals['fieldName'])) {
|
824 |
+
$this->fieldName = $vals['fieldName'];
|
825 |
+
}
|
826 |
+
if (isset($vals['numerical'])) {
|
827 |
+
$this->numerical = $vals['numerical'];
|
828 |
+
}
|
829 |
+
if (isset($vals['range'])) {
|
830 |
+
$this->range = $vals['range'];
|
831 |
+
}
|
832 |
+
if (isset($vals['maxCount'])) {
|
833 |
+
$this->maxCount = $vals['maxCount'];
|
834 |
+
}
|
835 |
+
if (isset($vals['minPopulation'])) {
|
836 |
+
$this->minPopulation = $vals['minPopulation'];
|
837 |
+
}
|
838 |
+
if (isset($vals['dateRangeGap'])) {
|
839 |
+
$this->dateRangeGap = $vals['dateRangeGap'];
|
840 |
+
}
|
841 |
+
if (isset($vals['sortOrder'])) {
|
842 |
+
$this->sortOrder = $vals['sortOrder'];
|
843 |
+
}
|
844 |
+
if (isset($vals['sortAscending'])) {
|
845 |
+
$this->sortAscending = $vals['sortAscending'];
|
846 |
+
}
|
847 |
+
if (isset($vals['selectedValues'])) {
|
848 |
+
$this->selectedValues = $vals['selectedValues'];
|
849 |
+
}
|
850 |
+
if (isset($vals['andSelectedValues'])) {
|
851 |
+
$this->andSelectedValues = $vals['andSelectedValues'];
|
852 |
+
}
|
853 |
}
|
854 |
+
}
|
855 |
+
|
856 |
+
public function getName() {
|
857 |
+
return 'FacetRequest';
|
858 |
+
}
|
859 |
+
|
860 |
+
public function read($input)
|
861 |
+
{
|
862 |
+
$xfer = 0;
|
863 |
+
$fname = null;
|
864 |
+
$ftype = 0;
|
865 |
+
$fid = 0;
|
866 |
+
$xfer += $input->readStructBegin($fname);
|
867 |
+
while (true)
|
868 |
{
|
869 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
870 |
+
if ($ftype == TType::STOP) {
|
871 |
+
break;
|
872 |
+
}
|
873 |
+
switch ($fid)
|
874 |
+
{
|
875 |
+
case 1:
|
876 |
+
if ($ftype == TType::STRING) {
|
877 |
+
$xfer += $input->readString($this->fieldName);
|
878 |
+
} else {
|
879 |
+
$xfer += $input->skip($ftype);
|
880 |
+
}
|
881 |
+
break;
|
882 |
+
case 2:
|
883 |
+
if ($ftype == TType::BOOL) {
|
884 |
+
$xfer += $input->readBool($this->numerical);
|
885 |
+
} else {
|
886 |
+
$xfer += $input->skip($ftype);
|
887 |
+
}
|
888 |
+
break;
|
889 |
+
case 3:
|
890 |
+
if ($ftype == TType::BOOL) {
|
891 |
+
$xfer += $input->readBool($this->range);
|
892 |
+
} else {
|
893 |
+
$xfer += $input->skip($ftype);
|
894 |
+
}
|
895 |
+
break;
|
896 |
+
case 4:
|
897 |
+
if ($ftype == TType::I32) {
|
898 |
+
$xfer += $input->readI32($this->maxCount);
|
899 |
+
} else {
|
900 |
+
$xfer += $input->skip($ftype);
|
901 |
+
}
|
902 |
+
break;
|
903 |
+
case 5:
|
904 |
+
if ($ftype == TType::I32) {
|
905 |
+
$xfer += $input->readI32($this->minPopulation);
|
906 |
+
} else {
|
907 |
+
$xfer += $input->skip($ftype);
|
908 |
+
}
|
909 |
+
break;
|
910 |
+
case 6:
|
911 |
+
if ($ftype == TType::I32) {
|
912 |
+
$xfer += $input->readI32($this->dateRangeGap);
|
913 |
+
} else {
|
914 |
+
$xfer += $input->skip($ftype);
|
915 |
+
}
|
916 |
+
break;
|
917 |
+
case 7:
|
918 |
+
if ($ftype == TType::I32) {
|
919 |
+
$xfer += $input->readI32($this->sortOrder);
|
920 |
+
} else {
|
921 |
+
$xfer += $input->skip($ftype);
|
922 |
+
}
|
923 |
+
break;
|
924 |
+
case 8:
|
925 |
+
if ($ftype == TType::BOOL) {
|
926 |
+
$xfer += $input->readBool($this->sortAscending);
|
927 |
+
} else {
|
928 |
+
$xfer += $input->skip($ftype);
|
929 |
+
}
|
930 |
+
break;
|
931 |
+
case 90:
|
932 |
+
if ($ftype == TType::LST) {
|
933 |
+
$this->selectedValues = array();
|
934 |
+
$_size21 = 0;
|
935 |
+
$_etype24 = 0;
|
936 |
+
$xfer += $input->readListBegin($_etype24, $_size21);
|
937 |
+
for ($_i25 = 0; $_i25 < $_size21; ++$_i25)
|
938 |
{
|
939 |
+
$elem26 = null;
|
940 |
+
$elem26 = new \com\boxalino\p13n\api\thrift\FacetValue();
|
941 |
+
$xfer += $elem26->read($input);
|
942 |
+
$this->selectedValues []= $elem26;
|
943 |
+
}
|
944 |
+
$xfer += $input->readListEnd();
|
945 |
+
} else {
|
946 |
+
$xfer += $input->skip($ftype);
|
947 |
+
}
|
948 |
+
break;
|
949 |
+
case 100:
|
950 |
+
if ($ftype == TType::BOOL) {
|
951 |
+
$xfer += $input->readBool($this->andSelectedValues);
|
952 |
+
} else {
|
953 |
+
$xfer += $input->skip($ftype);
|
954 |
+
}
|
955 |
+
break;
|
956 |
+
default:
|
957 |
+
$xfer += $input->skip($ftype);
|
958 |
+
break;
|
959 |
+
}
|
960 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
961 |
}
|
962 |
+
$xfer += $input->readStructEnd();
|
963 |
+
return $xfer;
|
964 |
+
}
|
965 |
+
|
966 |
+
public function write($output) {
|
967 |
+
$xfer = 0;
|
968 |
+
$xfer += $output->writeStructBegin('FacetRequest');
|
969 |
+
if ($this->fieldName !== null) {
|
970 |
+
$xfer += $output->writeFieldBegin('fieldName', TType::STRING, 1);
|
971 |
+
$xfer += $output->writeString($this->fieldName);
|
972 |
+
$xfer += $output->writeFieldEnd();
|
973 |
+
}
|
974 |
+
if ($this->numerical !== null) {
|
975 |
+
$xfer += $output->writeFieldBegin('numerical', TType::BOOL, 2);
|
976 |
+
$xfer += $output->writeBool($this->numerical);
|
977 |
+
$xfer += $output->writeFieldEnd();
|
978 |
+
}
|
979 |
+
if ($this->range !== null) {
|
980 |
+
$xfer += $output->writeFieldBegin('range', TType::BOOL, 3);
|
981 |
+
$xfer += $output->writeBool($this->range);
|
982 |
+
$xfer += $output->writeFieldEnd();
|
983 |
+
}
|
984 |
+
if ($this->maxCount !== null) {
|
985 |
+
$xfer += $output->writeFieldBegin('maxCount', TType::I32, 4);
|
986 |
+
$xfer += $output->writeI32($this->maxCount);
|
987 |
+
$xfer += $output->writeFieldEnd();
|
988 |
+
}
|
989 |
+
if ($this->minPopulation !== null) {
|
990 |
+
$xfer += $output->writeFieldBegin('minPopulation', TType::I32, 5);
|
991 |
+
$xfer += $output->writeI32($this->minPopulation);
|
992 |
+
$xfer += $output->writeFieldEnd();
|
993 |
+
}
|
994 |
+
if ($this->dateRangeGap !== null) {
|
995 |
+
$xfer += $output->writeFieldBegin('dateRangeGap', TType::I32, 6);
|
996 |
+
$xfer += $output->writeI32($this->dateRangeGap);
|
997 |
+
$xfer += $output->writeFieldEnd();
|
998 |
+
}
|
999 |
+
if ($this->sortOrder !== null) {
|
1000 |
+
$xfer += $output->writeFieldBegin('sortOrder', TType::I32, 7);
|
1001 |
+
$xfer += $output->writeI32($this->sortOrder);
|
1002 |
+
$xfer += $output->writeFieldEnd();
|
1003 |
+
}
|
1004 |
+
if ($this->sortAscending !== null) {
|
1005 |
+
$xfer += $output->writeFieldBegin('sortAscending', TType::BOOL, 8);
|
1006 |
+
$xfer += $output->writeBool($this->sortAscending);
|
1007 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1008 |
}
|
1009 |
+
if ($this->selectedValues !== null) {
|
1010 |
+
if (!is_array($this->selectedValues)) {
|
1011 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
1012 |
+
}
|
1013 |
+
$xfer += $output->writeFieldBegin('selectedValues', TType::LST, 90);
|
1014 |
+
{
|
1015 |
+
$output->writeListBegin(TType::STRUCT, count($this->selectedValues));
|
1016 |
+
{
|
1017 |
+
foreach ($this->selectedValues as $iter27)
|
1018 |
+
{
|
1019 |
+
$xfer += $iter27->write($output);
|
1020 |
+
}
|
1021 |
+
}
|
1022 |
+
$output->writeListEnd();
|
1023 |
+
}
|
1024 |
+
$xfer += $output->writeFieldEnd();
|
1025 |
+
}
|
1026 |
+
if ($this->andSelectedValues !== null) {
|
1027 |
+
$xfer += $output->writeFieldBegin('andSelectedValues', TType::BOOL, 100);
|
1028 |
+
$xfer += $output->writeBool($this->andSelectedValues);
|
1029 |
+
$xfer += $output->writeFieldEnd();
|
1030 |
+
}
|
1031 |
+
$xfer += $output->writeFieldStop();
|
1032 |
+
$xfer += $output->writeStructEnd();
|
1033 |
+
return $xfer;
|
1034 |
+
}
|
1035 |
|
1036 |
}
|
1037 |
|
1038 |
+
/**
|
1039 |
+
* field to be used for sorting
|
1040 |
+
*/
|
1041 |
class SortField {
|
1042 |
+
static $_TSPEC;
|
1043 |
+
|
1044 |
+
/**
|
1045 |
+
* @var string
|
1046 |
+
*/
|
1047 |
+
public $fieldName = null;
|
1048 |
+
/**
|
1049 |
+
* @var bool
|
1050 |
+
*/
|
1051 |
+
public $reverse = null;
|
1052 |
+
|
1053 |
+
public function __construct($vals=null) {
|
1054 |
+
if (!isset(self::$_TSPEC)) {
|
1055 |
+
self::$_TSPEC = array(
|
1056 |
+
1 => array(
|
1057 |
+
'var' => 'fieldName',
|
1058 |
+
'type' => TType::STRING,
|
1059 |
+
),
|
1060 |
+
2 => array(
|
1061 |
+
'var' => 'reverse',
|
1062 |
+
'type' => TType::BOOL,
|
1063 |
+
),
|
1064 |
+
);
|
|
|
|
|
|
|
1065 |
}
|
1066 |
+
if (is_array($vals)) {
|
1067 |
+
if (isset($vals['fieldName'])) {
|
1068 |
+
$this->fieldName = $vals['fieldName'];
|
1069 |
+
}
|
1070 |
+
if (isset($vals['reverse'])) {
|
1071 |
+
$this->reverse = $vals['reverse'];
|
1072 |
+
}
|
1073 |
}
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
public function getName() {
|
1077 |
+
return 'SortField';
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
public function read($input)
|
1081 |
+
{
|
1082 |
+
$xfer = 0;
|
1083 |
+
$fname = null;
|
1084 |
+
$ftype = 0;
|
1085 |
+
$fid = 0;
|
1086 |
+
$xfer += $input->readStructBegin($fname);
|
1087 |
+
while (true)
|
1088 |
{
|
1089 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
1090 |
+
if ($ftype == TType::STOP) {
|
1091 |
+
break;
|
1092 |
+
}
|
1093 |
+
switch ($fid)
|
1094 |
+
{
|
1095 |
+
case 1:
|
1096 |
+
if ($ftype == TType::STRING) {
|
1097 |
+
$xfer += $input->readString($this->fieldName);
|
1098 |
+
} else {
|
1099 |
+
$xfer += $input->skip($ftype);
|
1100 |
+
}
|
1101 |
+
break;
|
1102 |
+
case 2:
|
1103 |
+
if ($ftype == TType::BOOL) {
|
1104 |
+
$xfer += $input->readBool($this->reverse);
|
1105 |
+
} else {
|
1106 |
+
$xfer += $input->skip($ftype);
|
1107 |
+
}
|
1108 |
+
break;
|
1109 |
+
default:
|
1110 |
+
$xfer += $input->skip($ftype);
|
1111 |
+
break;
|
1112 |
+
}
|
1113 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1114 |
}
|
1115 |
+
$xfer += $input->readStructEnd();
|
1116 |
+
return $xfer;
|
1117 |
+
}
|
1118 |
+
|
1119 |
+
public function write($output) {
|
1120 |
+
$xfer = 0;
|
1121 |
+
$xfer += $output->writeStructBegin('SortField');
|
1122 |
+
if ($this->fieldName !== null) {
|
1123 |
+
$xfer += $output->writeFieldBegin('fieldName', TType::STRING, 1);
|
1124 |
+
$xfer += $output->writeString($this->fieldName);
|
1125 |
+
$xfer += $output->writeFieldEnd();
|
1126 |
+
}
|
1127 |
+
if ($this->reverse !== null) {
|
1128 |
+
$xfer += $output->writeFieldBegin('reverse', TType::BOOL, 2);
|
1129 |
+
$xfer += $output->writeBool($this->reverse);
|
1130 |
+
$xfer += $output->writeFieldEnd();
|
|
|
1131 |
}
|
1132 |
+
$xfer += $output->writeFieldStop();
|
1133 |
+
$xfer += $output->writeStructEnd();
|
1134 |
+
return $xfer;
|
1135 |
+
}
|
1136 |
|
1137 |
}
|
1138 |
|
1139 |
+
/**
|
1140 |
+
* <dl>
|
1141 |
+
* <dt>indexId</dt>
|
1142 |
+
* <dd>indexId to be used for search</dd>
|
1143 |
+
*
|
1144 |
+
* <dt>language</dt>
|
1145 |
+
* <dd>language for localization</dd>
|
1146 |
+
*
|
1147 |
+
* <dt>queryText</dt>
|
1148 |
+
* <dd>main search query</dd>
|
1149 |
+
*
|
1150 |
+
* <dt>filters</dt>
|
1151 |
+
* <dd>list of filters to apply</dd>
|
1152 |
+
*
|
1153 |
+
* <dt>orFilters</dt>
|
1154 |
+
* <dd>whether boolean OR should be aplied to the given list of filters if false
|
1155 |
+
* boolean AND will be applied</dd>
|
1156 |
+
*
|
1157 |
+
* <dt>facetRequests</dt>
|
1158 |
+
* <dd>list of facets to be returned</dd>
|
1159 |
+
*
|
1160 |
+
* <dt>sortFields</dt>
|
1161 |
+
* <dd>optional list of sort fields for hardcoded sorting. If not given,
|
1162 |
+
* relevance sort order will be used</dd>
|
1163 |
+
*
|
1164 |
+
* <dt>offset</dt>
|
1165 |
+
* <dd>from which hit to return result</dd>
|
1166 |
+
*
|
1167 |
+
* <dt>hitCount</dt>
|
1168 |
+
* <dd>how many hits to return</dd>
|
1169 |
+
*
|
1170 |
+
* <dt>returnFields</dt>
|
1171 |
+
* <dd>which index fields to be returned</dd>
|
1172 |
+
*
|
1173 |
+
* <dt>groupBy</dt>
|
1174 |
+
* <dd>field name of the field to do grouping by</dd>
|
1175 |
+
*
|
1176 |
+
* <dt>groupFacets</dt>
|
1177 |
+
* <dd>whether facets counts should contain number of groups</dd>
|
1178 |
+
*
|
1179 |
+
* <dt>groupItemsCount</dt>
|
1180 |
+
* <dd>how many hits in each group to return</dd>
|
1181 |
+
*
|
1182 |
+
* <dt>groupItemsSort</dt>
|
1183 |
+
* <dd>how to sort items within the group, default is score</dd>
|
1184 |
+
*
|
1185 |
+
* <dt>groupItemsSortAscending</dt>
|
1186 |
+
* <dd>whether to sort items within the group ascending</dd>
|
1187 |
+
* </dl>
|
1188 |
+
*/
|
1189 |
class SimpleSearchQuery {
|
1190 |
+
static $_TSPEC;
|
1191 |
+
|
1192 |
+
/**
|
1193 |
+
* @var string
|
1194 |
+
*/
|
1195 |
+
public $indexId = null;
|
1196 |
+
/**
|
1197 |
+
* @var string
|
1198 |
+
*/
|
1199 |
+
public $language = null;
|
1200 |
+
/**
|
1201 |
+
* @var string
|
1202 |
+
*/
|
1203 |
+
public $queryText = null;
|
1204 |
+
/**
|
1205 |
+
* @var \com\boxalino\p13n\api\thrift\Filter[]
|
1206 |
+
*/
|
1207 |
+
public $filters = null;
|
1208 |
+
/**
|
1209 |
+
* @var bool
|
1210 |
+
*/
|
1211 |
+
public $orFilters = null;
|
1212 |
+
/**
|
1213 |
+
* @var \com\boxalino\p13n\api\thrift\FacetRequest[]
|
1214 |
+
*/
|
1215 |
+
public $facetRequests = null;
|
1216 |
+
/**
|
1217 |
+
* @var \com\boxalino\p13n\api\thrift\SortField[]
|
1218 |
+
*/
|
1219 |
+
public $sortFields = null;
|
1220 |
+
/**
|
1221 |
+
* @var int
|
1222 |
+
*/
|
1223 |
+
public $offset = null;
|
1224 |
+
/**
|
1225 |
+
* @var int
|
1226 |
+
*/
|
1227 |
+
public $hitCount = null;
|
1228 |
+
/**
|
1229 |
+
* @var string[]
|
1230 |
+
*/
|
1231 |
+
public $returnFields = null;
|
1232 |
+
/**
|
1233 |
+
* @var string
|
1234 |
+
*/
|
1235 |
+
public $groupBy = null;
|
1236 |
+
/**
|
1237 |
+
* @var bool
|
1238 |
+
*/
|
1239 |
+
public $groupFacets = true;
|
1240 |
+
/**
|
1241 |
+
* @var int
|
1242 |
+
*/
|
1243 |
+
public $groupItemsCount = 1;
|
1244 |
+
/**
|
1245 |
+
* @var string
|
1246 |
+
*/
|
1247 |
+
public $groupItemsSort = "score";
|
1248 |
+
/**
|
1249 |
+
* @var bool
|
1250 |
+
*/
|
1251 |
+
public $groupItemsSortAscending = false;
|
1252 |
+
|
1253 |
+
public function __construct($vals=null) {
|
1254 |
+
if (!isset(self::$_TSPEC)) {
|
1255 |
+
self::$_TSPEC = array(
|
1256 |
+
1 => array(
|
1257 |
+
'var' => 'indexId',
|
1258 |
+
'type' => TType::STRING,
|
1259 |
+
),
|
1260 |
+
2 => array(
|
1261 |
+
'var' => 'language',
|
1262 |
+
'type' => TType::STRING,
|
1263 |
+
),
|
1264 |
+
3 => array(
|
1265 |
+
'var' => 'queryText',
|
1266 |
+
'type' => TType::STRING,
|
1267 |
+
),
|
1268 |
+
4 => array(
|
1269 |
+
'var' => 'filters',
|
1270 |
+
'type' => TType::LST,
|
1271 |
+
'etype' => TType::STRUCT,
|
1272 |
+
'elem' => array(
|
1273 |
+
'type' => TType::STRUCT,
|
1274 |
+
'class' => '\com\boxalino\p13n\api\thrift\Filter',
|
1275 |
+
),
|
1276 |
+
),
|
1277 |
+
5 => array(
|
1278 |
+
'var' => 'orFilters',
|
1279 |
+
'type' => TType::BOOL,
|
1280 |
+
),
|
1281 |
+
6 => array(
|
1282 |
+
'var' => 'facetRequests',
|
1283 |
+
'type' => TType::LST,
|
1284 |
+
'etype' => TType::STRUCT,
|
1285 |
+
'elem' => array(
|
1286 |
+
'type' => TType::STRUCT,
|
1287 |
+
'class' => '\com\boxalino\p13n\api\thrift\FacetRequest',
|
1288 |
+
),
|
1289 |
+
),
|
1290 |
+
7 => array(
|
1291 |
+
'var' => 'sortFields',
|
1292 |
+
'type' => TType::LST,
|
1293 |
+
'etype' => TType::STRUCT,
|
1294 |
+
'elem' => array(
|
1295 |
+
'type' => TType::STRUCT,
|
1296 |
+
'class' => '\com\boxalino\p13n\api\thrift\SortField',
|
1297 |
+
),
|
1298 |
+
),
|
1299 |
+
8 => array(
|
1300 |
+
'var' => 'offset',
|
1301 |
+
'type' => TType::I64,
|
1302 |
+
),
|
1303 |
+
9 => array(
|
1304 |
+
'var' => 'hitCount',
|
1305 |
+
'type' => TType::I32,
|
1306 |
+
),
|
1307 |
+
10 => array(
|
1308 |
+
'var' => 'returnFields',
|
1309 |
+
'type' => TType::LST,
|
1310 |
+
'etype' => TType::STRING,
|
1311 |
+
'elem' => array(
|
1312 |
+
'type' => TType::STRING,
|
1313 |
+
),
|
1314 |
+
),
|
1315 |
+
20 => array(
|
1316 |
+
'var' => 'groupBy',
|
1317 |
+
'type' => TType::STRING,
|
1318 |
+
),
|
1319 |
+
30 => array(
|
1320 |
+
'var' => 'groupFacets',
|
1321 |
+
'type' => TType::BOOL,
|
1322 |
+
),
|
1323 |
+
40 => array(
|
1324 |
+
'var' => 'groupItemsCount',
|
1325 |
+
'type' => TType::I32,
|
1326 |
+
),
|
1327 |
+
50 => array(
|
1328 |
+
'var' => 'groupItemsSort',
|
1329 |
+
'type' => TType::STRING,
|
1330 |
+
),
|
1331 |
+
60 => array(
|
1332 |
+
'var' => 'groupItemsSortAscending',
|
1333 |
+
'type' => TType::BOOL,
|
1334 |
+
),
|
1335 |
+
);
|
|
|
|
|
|
|
1336 |
}
|
1337 |
+
if (is_array($vals)) {
|
1338 |
+
if (isset($vals['indexId'])) {
|
1339 |
+
$this->indexId = $vals['indexId'];
|
1340 |
+
}
|
1341 |
+
if (isset($vals['language'])) {
|
1342 |
+
$this->language = $vals['language'];
|
1343 |
+
}
|
1344 |
+
if (isset($vals['queryText'])) {
|
1345 |
+
$this->queryText = $vals['queryText'];
|
1346 |
+
}
|
1347 |
+
if (isset($vals['filters'])) {
|
1348 |
+
$this->filters = $vals['filters'];
|
1349 |
+
}
|
1350 |
+
if (isset($vals['orFilters'])) {
|
1351 |
+
$this->orFilters = $vals['orFilters'];
|
1352 |
+
}
|
1353 |
+
if (isset($vals['facetRequests'])) {
|
1354 |
+
$this->facetRequests = $vals['facetRequests'];
|
1355 |
+
}
|
1356 |
+
if (isset($vals['sortFields'])) {
|
1357 |
+
$this->sortFields = $vals['sortFields'];
|
1358 |
+
}
|
1359 |
+
if (isset($vals['offset'])) {
|
1360 |
+
$this->offset = $vals['offset'];
|
1361 |
+
}
|
1362 |
+
if (isset($vals['hitCount'])) {
|
1363 |
+
$this->hitCount = $vals['hitCount'];
|
1364 |
+
}
|
1365 |
+
if (isset($vals['returnFields'])) {
|
1366 |
+
$this->returnFields = $vals['returnFields'];
|
1367 |
+
}
|
1368 |
+
if (isset($vals['groupBy'])) {
|
1369 |
+
$this->groupBy = $vals['groupBy'];
|
1370 |
+
}
|
1371 |
+
if (isset($vals['groupFacets'])) {
|
1372 |
+
$this->groupFacets = $vals['groupFacets'];
|
1373 |
+
}
|
1374 |
+
if (isset($vals['groupItemsCount'])) {
|
1375 |
+
$this->groupItemsCount = $vals['groupItemsCount'];
|
1376 |
+
}
|
1377 |
+
if (isset($vals['groupItemsSort'])) {
|
1378 |
+
$this->groupItemsSort = $vals['groupItemsSort'];
|
1379 |
+
}
|
1380 |
+
if (isset($vals['groupItemsSortAscending'])) {
|
1381 |
+
$this->groupItemsSortAscending = $vals['groupItemsSortAscending'];
|
1382 |
+
}
|
1383 |
}
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
public function getName() {
|
1387 |
+
return 'SimpleSearchQuery';
|
1388 |
+
}
|
1389 |
+
|
1390 |
+
public function read($input)
|
1391 |
+
{
|
1392 |
+
$xfer = 0;
|
1393 |
+
$fname = null;
|
1394 |
+
$ftype = 0;
|
1395 |
+
$fid = 0;
|
1396 |
+
$xfer += $input->readStructBegin($fname);
|
1397 |
+
while (true)
|
1398 |
{
|
1399 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
1400 |
+
if ($ftype == TType::STOP) {
|
1401 |
+
break;
|
1402 |
+
}
|
1403 |
+
switch ($fid)
|
1404 |
+
{
|
1405 |
+
case 1:
|
1406 |
+
if ($ftype == TType::STRING) {
|
1407 |
+
$xfer += $input->readString($this->indexId);
|
1408 |
+
} else {
|
1409 |
+
$xfer += $input->skip($ftype);
|
1410 |
+
}
|
1411 |
+
break;
|
1412 |
+
case 2:
|
1413 |
+
if ($ftype == TType::STRING) {
|
1414 |
+
$xfer += $input->readString($this->language);
|
1415 |
+
} else {
|
1416 |
+
$xfer += $input->skip($ftype);
|
1417 |
+
}
|
1418 |
+
break;
|
1419 |
+
case 3:
|
1420 |
+
if ($ftype == TType::STRING) {
|
1421 |
+
$xfer += $input->readString($this->queryText);
|
1422 |
+
} else {
|
1423 |
+
$xfer += $input->skip($ftype);
|
1424 |
+
}
|
1425 |
+
break;
|
1426 |
+
case 4:
|
1427 |
+
if ($ftype == TType::LST) {
|
1428 |
+
$this->filters = array();
|
1429 |
+
$_size28 = 0;
|
1430 |
+
$_etype31 = 0;
|
1431 |
+
$xfer += $input->readListBegin($_etype31, $_size28);
|
1432 |
+
for ($_i32 = 0; $_i32 < $_size28; ++$_i32)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1433 |
{
|
1434 |
+
$elem33 = null;
|
1435 |
+
$elem33 = new \com\boxalino\p13n\api\thrift\Filter();
|
1436 |
+
$xfer += $elem33->read($input);
|
1437 |
+
$this->filters []= $elem33;
|
1438 |
+
}
|
1439 |
+
$xfer += $input->readListEnd();
|
1440 |
+
} else {
|
1441 |
+
$xfer += $input->skip($ftype);
|
1442 |
+
}
|
1443 |
+
break;
|
1444 |
+
case 5:
|
1445 |
+
if ($ftype == TType::BOOL) {
|
1446 |
+
$xfer += $input->readBool($this->orFilters);
|
1447 |
+
} else {
|
1448 |
+
$xfer += $input->skip($ftype);
|
1449 |
+
}
|
1450 |
+
break;
|
1451 |
+
case 6:
|
1452 |
+
if ($ftype == TType::LST) {
|
1453 |
+
$this->facetRequests = array();
|
1454 |
+
$_size34 = 0;
|
1455 |
+
$_etype37 = 0;
|
1456 |
+
$xfer += $input->readListBegin($_etype37, $_size34);
|
1457 |
+
for ($_i38 = 0; $_i38 < $_size34; ++$_i38)
|
1458 |
{
|
1459 |
+
$elem39 = null;
|
1460 |
+
$elem39 = new \com\boxalino\p13n\api\thrift\FacetRequest();
|
1461 |
+
$xfer += $elem39->read($input);
|
1462 |
+
$this->facetRequests []= $elem39;
|
1463 |
+
}
|
1464 |
+
$xfer += $input->readListEnd();
|
1465 |
+
} else {
|
1466 |
+
$xfer += $input->skip($ftype);
|
1467 |
+
}
|
1468 |
+
break;
|
1469 |
+
case 7:
|
1470 |
+
if ($ftype == TType::LST) {
|
1471 |
+
$this->sortFields = array();
|
1472 |
+
$_size40 = 0;
|
1473 |
+
$_etype43 = 0;
|
1474 |
+
$xfer += $input->readListBegin($_etype43, $_size40);
|
1475 |
+
for ($_i44 = 0; $_i44 < $_size40; ++$_i44)
|
1476 |
{
|
1477 |
+
$elem45 = null;
|
1478 |
+
$elem45 = new \com\boxalino\p13n\api\thrift\SortField();
|
1479 |
+
$xfer += $elem45->read($input);
|
1480 |
+
$this->sortFields []= $elem45;
|
1481 |
+
}
|
1482 |
+
$xfer += $input->readListEnd();
|
1483 |
+
} else {
|
1484 |
+
$xfer += $input->skip($ftype);
|
1485 |
+
}
|
1486 |
+
break;
|
1487 |
+
case 8:
|
1488 |
+
if ($ftype == TType::I64) {
|
1489 |
+
$xfer += $input->readI64($this->offset);
|
1490 |
+
} else {
|
1491 |
+
$xfer += $input->skip($ftype);
|
1492 |
+
}
|
1493 |
+
break;
|
1494 |
+
case 9:
|
1495 |
+
if ($ftype == TType::I32) {
|
1496 |
+
$xfer += $input->readI32($this->hitCount);
|
1497 |
+
} else {
|
1498 |
+
$xfer += $input->skip($ftype);
|
1499 |
+
}
|
1500 |
+
break;
|
1501 |
+
case 10:
|
1502 |
+
if ($ftype == TType::LST) {
|
1503 |
+
$this->returnFields = array();
|
1504 |
+
$_size46 = 0;
|
1505 |
+
$_etype49 = 0;
|
1506 |
+
$xfer += $input->readListBegin($_etype49, $_size46);
|
1507 |
+
for ($_i50 = 0; $_i50 < $_size46; ++$_i50)
|
1508 |
{
|
1509 |
+
$elem51 = null;
|
1510 |
+
$xfer += $input->readString($elem51);
|
1511 |
+
$this->returnFields []= $elem51;
|
1512 |
+
}
|
1513 |
+
$xfer += $input->readListEnd();
|
1514 |
+
} else {
|
1515 |
+
$xfer += $input->skip($ftype);
|
1516 |
+
}
|
1517 |
+
break;
|
1518 |
+
case 20:
|
1519 |
+
if ($ftype == TType::STRING) {
|
1520 |
+
$xfer += $input->readString($this->groupBy);
|
1521 |
+
} else {
|
1522 |
+
$xfer += $input->skip($ftype);
|
1523 |
+
}
|
1524 |
+
break;
|
1525 |
+
case 30:
|
1526 |
+
if ($ftype == TType::BOOL) {
|
1527 |
+
$xfer += $input->readBool($this->groupFacets);
|
1528 |
+
} else {
|
1529 |
+
$xfer += $input->skip($ftype);
|
1530 |
+
}
|
1531 |
+
break;
|
1532 |
+
case 40:
|
1533 |
+
if ($ftype == TType::I32) {
|
1534 |
+
$xfer += $input->readI32($this->groupItemsCount);
|
1535 |
+
} else {
|
1536 |
+
$xfer += $input->skip($ftype);
|
1537 |
+
}
|
1538 |
+
break;
|
1539 |
+
case 50:
|
1540 |
+
if ($ftype == TType::STRING) {
|
1541 |
+
$xfer += $input->readString($this->groupItemsSort);
|
1542 |
+
} else {
|
1543 |
+
$xfer += $input->skip($ftype);
|
1544 |
+
}
|
1545 |
+
break;
|
1546 |
+
case 60:
|
1547 |
+
if ($ftype == TType::BOOL) {
|
1548 |
+
$xfer += $input->readBool($this->groupItemsSortAscending);
|
1549 |
+
} else {
|
1550 |
+
$xfer += $input->skip($ftype);
|
1551 |
+
}
|
1552 |
+
break;
|
1553 |
+
default:
|
1554 |
+
$xfer += $input->skip($ftype);
|
1555 |
+
break;
|
1556 |
+
}
|
1557 |
+
$xfer += $input->readFieldEnd();
|
1558 |
+
}
|
1559 |
+
$xfer += $input->readStructEnd();
|
1560 |
+
return $xfer;
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
public function write($output) {
|
1564 |
+
$xfer = 0;
|
1565 |
+
$xfer += $output->writeStructBegin('SimpleSearchQuery');
|
1566 |
+
if ($this->indexId !== null) {
|
1567 |
+
$xfer += $output->writeFieldBegin('indexId', TType::STRING, 1);
|
1568 |
+
$xfer += $output->writeString($this->indexId);
|
1569 |
+
$xfer += $output->writeFieldEnd();
|
1570 |
+
}
|
1571 |
+
if ($this->language !== null) {
|
1572 |
+
$xfer += $output->writeFieldBegin('language', TType::STRING, 2);
|
1573 |
+
$xfer += $output->writeString($this->language);
|
1574 |
+
$xfer += $output->writeFieldEnd();
|
1575 |
+
}
|
1576 |
+
if ($this->queryText !== null) {
|
1577 |
+
$xfer += $output->writeFieldBegin('queryText', TType::STRING, 3);
|
1578 |
+
$xfer += $output->writeString($this->queryText);
|
1579 |
+
$xfer += $output->writeFieldEnd();
|
1580 |
+
}
|
1581 |
+
if ($this->filters !== null) {
|
1582 |
+
if (!is_array($this->filters)) {
|
1583 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
1584 |
+
}
|
1585 |
+
$xfer += $output->writeFieldBegin('filters', TType::LST, 4);
|
1586 |
+
{
|
1587 |
+
$output->writeListBegin(TType::STRUCT, count($this->filters));
|
1588 |
+
{
|
1589 |
+
foreach ($this->filters as $iter52)
|
1590 |
+
{
|
1591 |
+
$xfer += $iter52->write($output);
|
1592 |
+
}
|
1593 |
+
}
|
1594 |
+
$output->writeListEnd();
|
1595 |
+
}
|
1596 |
+
$xfer += $output->writeFieldEnd();
|
1597 |
+
}
|
1598 |
+
if ($this->orFilters !== null) {
|
1599 |
+
$xfer += $output->writeFieldBegin('orFilters', TType::BOOL, 5);
|
1600 |
+
$xfer += $output->writeBool($this->orFilters);
|
1601 |
+
$xfer += $output->writeFieldEnd();
|
1602 |
}
|
1603 |
+
if ($this->facetRequests !== null) {
|
1604 |
+
if (!is_array($this->facetRequests)) {
|
1605 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
1606 |
+
}
|
1607 |
+
$xfer += $output->writeFieldBegin('facetRequests', TType::LST, 6);
|
1608 |
+
{
|
1609 |
+
$output->writeListBegin(TType::STRUCT, count($this->facetRequests));
|
1610 |
+
{
|
1611 |
+
foreach ($this->facetRequests as $iter53)
|
1612 |
+
{
|
1613 |
+
$xfer += $iter53->write($output);
|
1614 |
+
}
|
1615 |
+
}
|
1616 |
+
$output->writeListEnd();
|
1617 |
+
}
|
1618 |
+
$xfer += $output->writeFieldEnd();
|
1619 |
+
}
|
1620 |
+
if ($this->sortFields !== null) {
|
1621 |
+
if (!is_array($this->sortFields)) {
|
1622 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
1623 |
+
}
|
1624 |
+
$xfer += $output->writeFieldBegin('sortFields', TType::LST, 7);
|
1625 |
+
{
|
1626 |
+
$output->writeListBegin(TType::STRUCT, count($this->sortFields));
|
1627 |
+
{
|
1628 |
+
foreach ($this->sortFields as $iter54)
|
1629 |
+
{
|
1630 |
+
$xfer += $iter54->write($output);
|
1631 |
+
}
|
1632 |
+
}
|
1633 |
+
$output->writeListEnd();
|
1634 |
+
}
|
1635 |
+
$xfer += $output->writeFieldEnd();
|
1636 |
+
}
|
1637 |
+
if ($this->offset !== null) {
|
1638 |
+
$xfer += $output->writeFieldBegin('offset', TType::I64, 8);
|
1639 |
+
$xfer += $output->writeI64($this->offset);
|
1640 |
+
$xfer += $output->writeFieldEnd();
|
1641 |
+
}
|
1642 |
+
if ($this->hitCount !== null) {
|
1643 |
+
$xfer += $output->writeFieldBegin('hitCount', TType::I32, 9);
|
1644 |
+
$xfer += $output->writeI32($this->hitCount);
|
1645 |
+
$xfer += $output->writeFieldEnd();
|
1646 |
+
}
|
1647 |
+
if ($this->returnFields !== null) {
|
1648 |
+
if (!is_array($this->returnFields)) {
|
1649 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
1650 |
+
}
|
1651 |
+
$xfer += $output->writeFieldBegin('returnFields', TType::LST, 10);
|
1652 |
+
{
|
1653 |
+
$output->writeListBegin(TType::STRING, count($this->returnFields));
|
1654 |
+
{
|
1655 |
+
foreach ($this->returnFields as $iter55)
|
1656 |
+
{
|
1657 |
+
$xfer += $output->writeString($iter55);
|
1658 |
+
}
|
1659 |
+
}
|
1660 |
+
$output->writeListEnd();
|
1661 |
+
}
|
1662 |
+
$xfer += $output->writeFieldEnd();
|
1663 |
+
}
|
1664 |
+
if ($this->groupBy !== null) {
|
1665 |
+
$xfer += $output->writeFieldBegin('groupBy', TType::STRING, 20);
|
1666 |
+
$xfer += $output->writeString($this->groupBy);
|
1667 |
+
$xfer += $output->writeFieldEnd();
|
1668 |
+
}
|
1669 |
+
if ($this->groupFacets !== null) {
|
1670 |
+
$xfer += $output->writeFieldBegin('groupFacets', TType::BOOL, 30);
|
1671 |
+
$xfer += $output->writeBool($this->groupFacets);
|
1672 |
+
$xfer += $output->writeFieldEnd();
|
1673 |
+
}
|
1674 |
+
if ($this->groupItemsCount !== null) {
|
1675 |
+
$xfer += $output->writeFieldBegin('groupItemsCount', TType::I32, 40);
|
1676 |
+
$xfer += $output->writeI32($this->groupItemsCount);
|
1677 |
+
$xfer += $output->writeFieldEnd();
|
1678 |
+
}
|
1679 |
+
if ($this->groupItemsSort !== null) {
|
1680 |
+
$xfer += $output->writeFieldBegin('groupItemsSort', TType::STRING, 50);
|
1681 |
+
$xfer += $output->writeString($this->groupItemsSort);
|
1682 |
+
$xfer += $output->writeFieldEnd();
|
1683 |
+
}
|
1684 |
+
if ($this->groupItemsSortAscending !== null) {
|
1685 |
+
$xfer += $output->writeFieldBegin('groupItemsSortAscending', TType::BOOL, 60);
|
1686 |
+
$xfer += $output->writeBool($this->groupItemsSortAscending);
|
1687 |
+
$xfer += $output->writeFieldEnd();
|
1688 |
+
}
|
1689 |
+
$xfer += $output->writeFieldStop();
|
1690 |
+
$xfer += $output->writeStructEnd();
|
1691 |
+
return $xfer;
|
1692 |
+
}
|
1693 |
|
1694 |
}
|
1695 |
|
1696 |
+
/**
|
1697 |
+
* <dl>
|
1698 |
+
* <dt>indexId</dt>
|
1699 |
+
* <dd>id of the index to fetch context item data from</dd>
|
1700 |
+
*
|
1701 |
+
* <dt>fieldName</dt>
|
1702 |
+
* <dd>the field name of the item's unique identifier within the items index</dd>
|
1703 |
+
* <dd>for example: 'sku' for items 'products'</dd>
|
1704 |
+
*
|
1705 |
+
* <dt>contextItemId</dt>
|
1706 |
+
* <dd>actual item's identifier</dd>
|
1707 |
+
* <dd>for example: actual sku of the product</dd>
|
1708 |
+
*
|
1709 |
+
* <dt>role</dt>
|
1710 |
+
* <dd>role of the item within the context, used to address the item in the
|
1711 |
+
* recommendation script.</dd>
|
1712 |
+
* <dd>for example: 'main product' for recommendations within product detail
|
1713 |
+
* page</dd>
|
1714 |
+
* </dl>
|
1715 |
+
*/
|
1716 |
class ContextItem {
|
1717 |
+
static $_TSPEC;
|
1718 |
+
|
1719 |
+
/**
|
1720 |
+
* @var string
|
1721 |
+
*/
|
1722 |
+
public $indexId = null;
|
1723 |
+
/**
|
1724 |
+
* @var string
|
1725 |
+
*/
|
1726 |
+
public $fieldName = null;
|
1727 |
+
/**
|
1728 |
+
* @var string
|
1729 |
+
*/
|
1730 |
+
public $contextItemId = null;
|
1731 |
+
/**
|
1732 |
+
* @var string
|
1733 |
+
*/
|
1734 |
+
public $role = null;
|
1735 |
+
|
1736 |
+
public function __construct($vals=null) {
|
1737 |
+
if (!isset(self::$_TSPEC)) {
|
1738 |
+
self::$_TSPEC = array(
|
1739 |
+
1 => array(
|
1740 |
+
'var' => 'indexId',
|
1741 |
+
'type' => TType::STRING,
|
1742 |
+
),
|
1743 |
+
2 => array(
|
1744 |
+
'var' => 'fieldName',
|
1745 |
+
'type' => TType::STRING,
|
1746 |
+
),
|
1747 |
+
3 => array(
|
1748 |
+
'var' => 'contextItemId',
|
1749 |
+
'type' => TType::STRING,
|
1750 |
+
),
|
1751 |
+
4 => array(
|
1752 |
+
'var' => 'role',
|
1753 |
+
'type' => TType::STRING,
|
1754 |
+
),
|
1755 |
+
);
|
|
|
|
|
|
|
1756 |
}
|
1757 |
+
if (is_array($vals)) {
|
1758 |
+
if (isset($vals['indexId'])) {
|
1759 |
+
$this->indexId = $vals['indexId'];
|
1760 |
+
}
|
1761 |
+
if (isset($vals['fieldName'])) {
|
1762 |
+
$this->fieldName = $vals['fieldName'];
|
1763 |
+
}
|
1764 |
+
if (isset($vals['contextItemId'])) {
|
1765 |
+
$this->contextItemId = $vals['contextItemId'];
|
1766 |
+
}
|
1767 |
+
if (isset($vals['role'])) {
|
1768 |
+
$this->role = $vals['role'];
|
1769 |
+
}
|
1770 |
}
|
1771 |
+
}
|
1772 |
+
|
1773 |
+
public function getName() {
|
1774 |
+
return 'ContextItem';
|
1775 |
+
}
|
1776 |
+
|
1777 |
+
public function read($input)
|
1778 |
+
{
|
1779 |
+
$xfer = 0;
|
1780 |
+
$fname = null;
|
1781 |
+
$ftype = 0;
|
1782 |
+
$fid = 0;
|
1783 |
+
$xfer += $input->readStructBegin($fname);
|
1784 |
+
while (true)
|
1785 |
{
|
1786 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
1787 |
+
if ($ftype == TType::STOP) {
|
1788 |
+
break;
|
1789 |
+
}
|
1790 |
+
switch ($fid)
|
1791 |
+
{
|
1792 |
+
case 1:
|
1793 |
+
if ($ftype == TType::STRING) {
|
1794 |
+
$xfer += $input->readString($this->indexId);
|
1795 |
+
} else {
|
1796 |
+
$xfer += $input->skip($ftype);
|
1797 |
+
}
|
1798 |
+
break;
|
1799 |
+
case 2:
|
1800 |
+
if ($ftype == TType::STRING) {
|
1801 |
+
$xfer += $input->readString($this->fieldName);
|
1802 |
+
} else {
|
1803 |
+
$xfer += $input->skip($ftype);
|
1804 |
+
}
|
1805 |
+
break;
|
1806 |
+
case 3:
|
1807 |
+
if ($ftype == TType::STRING) {
|
1808 |
+
$xfer += $input->readString($this->contextItemId);
|
1809 |
+
} else {
|
1810 |
+
$xfer += $input->skip($ftype);
|
1811 |
+
}
|
1812 |
+
break;
|
1813 |
+
case 4:
|
1814 |
+
if ($ftype == TType::STRING) {
|
1815 |
+
$xfer += $input->readString($this->role);
|
1816 |
+
} else {
|
1817 |
+
$xfer += $input->skip($ftype);
|
1818 |
+
}
|
1819 |
+
break;
|
1820 |
+
default:
|
1821 |
+
$xfer += $input->skip($ftype);
|
1822 |
+
break;
|
1823 |
+
}
|
1824 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1825 |
}
|
1826 |
+
$xfer += $input->readStructEnd();
|
1827 |
+
return $xfer;
|
1828 |
+
}
|
1829 |
+
|
1830 |
+
public function write($output) {
|
1831 |
+
$xfer = 0;
|
1832 |
+
$xfer += $output->writeStructBegin('ContextItem');
|
1833 |
+
if ($this->indexId !== null) {
|
1834 |
+
$xfer += $output->writeFieldBegin('indexId', TType::STRING, 1);
|
1835 |
+
$xfer += $output->writeString($this->indexId);
|
1836 |
+
$xfer += $output->writeFieldEnd();
|
1837 |
+
}
|
1838 |
+
if ($this->fieldName !== null) {
|
1839 |
+
$xfer += $output->writeFieldBegin('fieldName', TType::STRING, 2);
|
1840 |
+
$xfer += $output->writeString($this->fieldName);
|
1841 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1842 |
}
|
1843 |
+
if ($this->contextItemId !== null) {
|
1844 |
+
$xfer += $output->writeFieldBegin('contextItemId', TType::STRING, 3);
|
1845 |
+
$xfer += $output->writeString($this->contextItemId);
|
1846 |
+
$xfer += $output->writeFieldEnd();
|
1847 |
+
}
|
1848 |
+
if ($this->role !== null) {
|
1849 |
+
$xfer += $output->writeFieldBegin('role', TType::STRING, 4);
|
1850 |
+
$xfer += $output->writeString($this->role);
|
1851 |
+
$xfer += $output->writeFieldEnd();
|
1852 |
+
}
|
1853 |
+
$xfer += $output->writeFieldStop();
|
1854 |
+
$xfer += $output->writeStructEnd();
|
1855 |
+
return $xfer;
|
1856 |
+
}
|
1857 |
|
1858 |
}
|
1859 |
|
1860 |
+
/**
|
1861 |
+
* <dl>
|
1862 |
+
* <dt>choiceId</dt>
|
1863 |
+
* <dd>personalization choice identificator</dd>
|
1864 |
+
*
|
1865 |
+
* <dt>simpleSearchQuery</dt>
|
1866 |
+
* <dd>search query in a case of recommendation and search inquiries</dd>
|
1867 |
+
*
|
1868 |
+
* <dt>contextItems</dt>
|
1869 |
+
* <dd>context items for recommendations</dd>
|
1870 |
+
*
|
1871 |
+
* <dt>minHitCount</dt>
|
1872 |
+
* <dd>minimal hit count to return for recommendations.</dd>
|
1873 |
+
* <dd>if higher priority recommendation strategy yields less results, next
|
1874 |
+
* strategy is tried</dd>
|
1875 |
+
*
|
1876 |
+
* <dt>excludeVariantIds</dt>
|
1877 |
+
* <dd>set of variantIds to be excluded from result</dd>
|
1878 |
+
*
|
1879 |
+
* <dt>scope</dt>
|
1880 |
+
* <dd>choice source to be used</dd>
|
1881 |
+
*
|
1882 |
+
* <dt>withRelaxation</dt>
|
1883 |
+
* <dd>if search relaxation should be used</dd>
|
1884 |
+
* </dl>
|
1885 |
+
*/
|
1886 |
class ChoiceInquiry {
|
1887 |
+
static $_TSPEC;
|
1888 |
+
|
1889 |
+
/**
|
1890 |
+
* @var string
|
1891 |
+
*/
|
1892 |
+
public $choiceId = null;
|
1893 |
+
/**
|
1894 |
+
* @var \com\boxalino\p13n\api\thrift\SimpleSearchQuery
|
1895 |
+
*/
|
1896 |
+
public $simpleSearchQuery = null;
|
1897 |
+
/**
|
1898 |
+
* @var \com\boxalino\p13n\api\thrift\ContextItem[]
|
1899 |
+
*/
|
1900 |
+
public $contextItems = null;
|
1901 |
+
/**
|
1902 |
+
* @var int
|
1903 |
+
*/
|
1904 |
+
public $minHitCount = null;
|
1905 |
+
/**
|
1906 |
+
* @var string[]
|
1907 |
+
*/
|
1908 |
+
public $excludeVariantIds = null;
|
1909 |
+
/**
|
1910 |
+
* @var string
|
1911 |
+
*/
|
1912 |
+
public $scope = "system_rec";
|
1913 |
+
/**
|
1914 |
+
* @var bool
|
1915 |
+
*/
|
1916 |
+
public $withRelaxation = false;
|
1917 |
+
/**
|
1918 |
+
* @var bool
|
1919 |
+
*/
|
1920 |
+
public $withSemanticFiltering = false;
|
1921 |
+
|
1922 |
+
public function __construct($vals=null) {
|
1923 |
+
if (!isset(self::$_TSPEC)) {
|
1924 |
+
self::$_TSPEC = array(
|
1925 |
+
1 => array(
|
1926 |
+
'var' => 'choiceId',
|
1927 |
+
'type' => TType::STRING,
|
1928 |
+
),
|
1929 |
+
2 => array(
|
1930 |
+
'var' => 'simpleSearchQuery',
|
1931 |
+
'type' => TType::STRUCT,
|
1932 |
+
'class' => '\com\boxalino\p13n\api\thrift\SimpleSearchQuery',
|
1933 |
+
),
|
1934 |
+
3 => array(
|
1935 |
+
'var' => 'contextItems',
|
1936 |
+
'type' => TType::LST,
|
1937 |
+
'etype' => TType::STRUCT,
|
1938 |
+
'elem' => array(
|
1939 |
+
'type' => TType::STRUCT,
|
1940 |
+
'class' => '\com\boxalino\p13n\api\thrift\ContextItem',
|
1941 |
+
),
|
1942 |
+
),
|
1943 |
+
4 => array(
|
1944 |
+
'var' => 'minHitCount',
|
1945 |
+
'type' => TType::I32,
|
1946 |
+
),
|
1947 |
+
5 => array(
|
1948 |
+
'var' => 'excludeVariantIds',
|
1949 |
+
'type' => TType::SET,
|
1950 |
+
'etype' => TType::STRING,
|
1951 |
+
'elem' => array(
|
1952 |
+
'type' => TType::STRING,
|
1953 |
+
),
|
1954 |
+
),
|
1955 |
+
6 => array(
|
1956 |
+
'var' => 'scope',
|
1957 |
+
'type' => TType::STRING,
|
1958 |
+
),
|
1959 |
+
70 => array(
|
1960 |
+
'var' => 'withRelaxation',
|
1961 |
+
'type' => TType::BOOL,
|
1962 |
+
),
|
1963 |
+
80 => array(
|
1964 |
+
'var' => 'withSemanticFiltering',
|
1965 |
+
'type' => TType::BOOL,
|
1966 |
+
),
|
1967 |
+
);
|
1968 |
+
}
|
1969 |
+
if (is_array($vals)) {
|
1970 |
+
if (isset($vals['choiceId'])) {
|
1971 |
+
$this->choiceId = $vals['choiceId'];
|
1972 |
+
}
|
1973 |
+
if (isset($vals['simpleSearchQuery'])) {
|
1974 |
+
$this->simpleSearchQuery = $vals['simpleSearchQuery'];
|
1975 |
+
}
|
1976 |
+
if (isset($vals['contextItems'])) {
|
1977 |
+
$this->contextItems = $vals['contextItems'];
|
1978 |
+
}
|
1979 |
+
if (isset($vals['minHitCount'])) {
|
1980 |
+
$this->minHitCount = $vals['minHitCount'];
|
1981 |
+
}
|
1982 |
+
if (isset($vals['excludeVariantIds'])) {
|
1983 |
+
$this->excludeVariantIds = $vals['excludeVariantIds'];
|
1984 |
+
}
|
1985 |
+
if (isset($vals['scope'])) {
|
1986 |
+
$this->scope = $vals['scope'];
|
1987 |
+
}
|
1988 |
+
if (isset($vals['withRelaxation'])) {
|
1989 |
+
$this->withRelaxation = $vals['withRelaxation'];
|
1990 |
+
}
|
1991 |
+
if (isset($vals['withSemanticFiltering'])) {
|
1992 |
+
$this->withSemanticFiltering = $vals['withSemanticFiltering'];
|
1993 |
+
}
|
1994 |
+
}
|
1995 |
+
}
|
1996 |
+
|
1997 |
+
public function getName() {
|
1998 |
+
return 'ChoiceInquiry';
|
1999 |
+
}
|
2000 |
+
|
2001 |
+
public function read($input)
|
2002 |
+
{
|
2003 |
+
$xfer = 0;
|
2004 |
+
$fname = null;
|
2005 |
+
$ftype = 0;
|
2006 |
+
$fid = 0;
|
2007 |
+
$xfer += $input->readStructBegin($fname);
|
2008 |
+
while (true)
|
2009 |
+
{
|
2010 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
2011 |
+
if ($ftype == TType::STOP) {
|
2012 |
+
break;
|
2013 |
+
}
|
2014 |
+
switch ($fid)
|
2015 |
+
{
|
2016 |
+
case 1:
|
2017 |
+
if ($ftype == TType::STRING) {
|
2018 |
+
$xfer += $input->readString($this->choiceId);
|
2019 |
+
} else {
|
2020 |
+
$xfer += $input->skip($ftype);
|
2021 |
+
}
|
2022 |
+
break;
|
2023 |
+
case 2:
|
2024 |
+
if ($ftype == TType::STRUCT) {
|
2025 |
+
$this->simpleSearchQuery = new \com\boxalino\p13n\api\thrift\SimpleSearchQuery();
|
2026 |
+
$xfer += $this->simpleSearchQuery->read($input);
|
2027 |
+
} else {
|
2028 |
+
$xfer += $input->skip($ftype);
|
2029 |
+
}
|
2030 |
+
break;
|
2031 |
+
case 3:
|
2032 |
+
if ($ftype == TType::LST) {
|
2033 |
+
$this->contextItems = array();
|
2034 |
+
$_size56 = 0;
|
2035 |
+
$_etype59 = 0;
|
2036 |
+
$xfer += $input->readListBegin($_etype59, $_size56);
|
2037 |
+
for ($_i60 = 0; $_i60 < $_size56; ++$_i60)
|
2038 |
+
{
|
2039 |
+
$elem61 = null;
|
2040 |
+
$elem61 = new \com\boxalino\p13n\api\thrift\ContextItem();
|
2041 |
+
$xfer += $elem61->read($input);
|
2042 |
+
$this->contextItems []= $elem61;
|
2043 |
+
}
|
2044 |
+
$xfer += $input->readListEnd();
|
2045 |
+
} else {
|
2046 |
+
$xfer += $input->skip($ftype);
|
2047 |
+
}
|
2048 |
+
break;
|
2049 |
+
case 4:
|
2050 |
+
if ($ftype == TType::I32) {
|
2051 |
+
$xfer += $input->readI32($this->minHitCount);
|
2052 |
+
} else {
|
2053 |
+
$xfer += $input->skip($ftype);
|
2054 |
+
}
|
2055 |
+
break;
|
2056 |
+
case 5:
|
2057 |
+
if ($ftype == TType::SET) {
|
2058 |
+
$this->excludeVariantIds = array();
|
2059 |
+
$_size62 = 0;
|
2060 |
+
$_etype65 = 0;
|
2061 |
+
$xfer += $input->readSetBegin($_etype65, $_size62);
|
2062 |
+
for ($_i66 = 0; $_i66 < $_size62; ++$_i66)
|
2063 |
+
{
|
2064 |
+
$elem67 = null;
|
2065 |
+
$xfer += $input->readString($elem67);
|
2066 |
+
if (is_scalar($elem67)) {
|
2067 |
+
$this->excludeVariantIds[$elem67] = true;
|
2068 |
+
} else {
|
2069 |
+
$this->excludeVariantIds []= $elem67;
|
2070 |
+
}
|
2071 |
+
}
|
2072 |
+
$xfer += $input->readSetEnd();
|
2073 |
+
} else {
|
2074 |
+
$xfer += $input->skip($ftype);
|
2075 |
+
}
|
2076 |
+
break;
|
2077 |
+
case 6:
|
2078 |
+
if ($ftype == TType::STRING) {
|
2079 |
+
$xfer += $input->readString($this->scope);
|
2080 |
+
} else {
|
2081 |
+
$xfer += $input->skip($ftype);
|
2082 |
+
}
|
2083 |
+
break;
|
2084 |
+
case 70:
|
2085 |
+
if ($ftype == TType::BOOL) {
|
2086 |
+
$xfer += $input->readBool($this->withRelaxation);
|
2087 |
+
} else {
|
2088 |
+
$xfer += $input->skip($ftype);
|
2089 |
+
}
|
2090 |
+
break;
|
2091 |
+
case 80:
|
2092 |
+
if ($ftype == TType::BOOL) {
|
2093 |
+
$xfer += $input->readBool($this->withSemanticFiltering);
|
2094 |
+
} else {
|
2095 |
+
$xfer += $input->skip($ftype);
|
2096 |
+
}
|
2097 |
+
break;
|
2098 |
+
default:
|
2099 |
+
$xfer += $input->skip($ftype);
|
2100 |
+
break;
|
2101 |
+
}
|
2102 |
+
$xfer += $input->readFieldEnd();
|
2103 |
}
|
2104 |
+
$xfer += $input->readStructEnd();
|
2105 |
+
return $xfer;
|
2106 |
+
}
|
2107 |
+
|
2108 |
+
public function write($output) {
|
2109 |
+
$xfer = 0;
|
2110 |
+
$xfer += $output->writeStructBegin('ChoiceInquiry');
|
2111 |
+
if ($this->choiceId !== null) {
|
2112 |
+
$xfer += $output->writeFieldBegin('choiceId', TType::STRING, 1);
|
2113 |
+
$xfer += $output->writeString($this->choiceId);
|
2114 |
+
$xfer += $output->writeFieldEnd();
|
2115 |
}
|
2116 |
+
if ($this->simpleSearchQuery !== null) {
|
2117 |
+
if (!is_object($this->simpleSearchQuery)) {
|
2118 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2119 |
+
}
|
2120 |
+
$xfer += $output->writeFieldBegin('simpleSearchQuery', TType::STRUCT, 2);
|
2121 |
+
$xfer += $this->simpleSearchQuery->write($output);
|
2122 |
+
$xfer += $output->writeFieldEnd();
|
2123 |
+
}
|
2124 |
+
if ($this->contextItems !== null) {
|
2125 |
+
if (!is_array($this->contextItems)) {
|
2126 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2127 |
+
}
|
2128 |
+
$xfer += $output->writeFieldBegin('contextItems', TType::LST, 3);
|
2129 |
+
{
|
2130 |
+
$output->writeListBegin(TType::STRUCT, count($this->contextItems));
|
2131 |
{
|
2132 |
+
foreach ($this->contextItems as $iter68)
|
2133 |
+
{
|
2134 |
+
$xfer += $iter68->write($output);
|
2135 |
+
}
|
2136 |
+
}
|
2137 |
+
$output->writeListEnd();
|
2138 |
+
}
|
2139 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2140 |
}
|
2141 |
+
if ($this->minHitCount !== null) {
|
2142 |
+
$xfer += $output->writeFieldBegin('minHitCount', TType::I32, 4);
|
2143 |
+
$xfer += $output->writeI32($this->minHitCount);
|
2144 |
+
$xfer += $output->writeFieldEnd();
|
2145 |
+
}
|
2146 |
+
if ($this->excludeVariantIds !== null) {
|
2147 |
+
if (!is_array($this->excludeVariantIds)) {
|
2148 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2149 |
+
}
|
2150 |
+
$xfer += $output->writeFieldBegin('excludeVariantIds', TType::SET, 5);
|
2151 |
+
{
|
2152 |
+
$output->writeSetBegin(TType::STRING, count($this->excludeVariantIds));
|
2153 |
+
{
|
2154 |
+
foreach ($this->excludeVariantIds as $iter69 => $iter70)
|
2155 |
+
{
|
2156 |
+
if (is_scalar($iter70)) {
|
2157 |
+
$xfer += $output->writeString($iter69);
|
2158 |
+
} else {
|
2159 |
+
$xfer += $output->writeString($iter70);
|
2160 |
+
}
|
2161 |
+
}
|
2162 |
+
}
|
2163 |
+
$output->writeSetEnd();
|
2164 |
+
}
|
2165 |
+
$xfer += $output->writeFieldEnd();
|
2166 |
+
}
|
2167 |
+
if ($this->scope !== null) {
|
2168 |
+
$xfer += $output->writeFieldBegin('scope', TType::STRING, 6);
|
2169 |
+
$xfer += $output->writeString($this->scope);
|
2170 |
+
$xfer += $output->writeFieldEnd();
|
2171 |
+
}
|
2172 |
+
if ($this->withRelaxation !== null) {
|
2173 |
+
$xfer += $output->writeFieldBegin('withRelaxation', TType::BOOL, 70);
|
2174 |
+
$xfer += $output->writeBool($this->withRelaxation);
|
2175 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2176 |
}
|
2177 |
+
if ($this->withSemanticFiltering !== null) {
|
2178 |
+
$xfer += $output->writeFieldBegin('withSemanticFiltering', TType::BOOL, 80);
|
2179 |
+
$xfer += $output->writeBool($this->withSemanticFiltering);
|
2180 |
+
$xfer += $output->writeFieldEnd();
|
2181 |
+
}
|
2182 |
+
$xfer += $output->writeFieldStop();
|
2183 |
+
$xfer += $output->writeStructEnd();
|
2184 |
+
return $xfer;
|
2185 |
+
}
|
2186 |
|
2187 |
}
|
2188 |
|
2189 |
+
/**
|
2190 |
+
* parameters of request context. Usually browser, platform, etc.
|
2191 |
+
*/
|
2192 |
class RequestContext {
|
2193 |
+
static $_TSPEC;
|
2194 |
+
|
2195 |
+
/**
|
2196 |
+
* @var array
|
2197 |
+
*/
|
2198 |
+
public $parameters = null;
|
2199 |
+
|
2200 |
+
public function __construct($vals=null) {
|
2201 |
+
if (!isset(self::$_TSPEC)) {
|
2202 |
+
self::$_TSPEC = array(
|
2203 |
+
1 => array(
|
2204 |
+
'var' => 'parameters',
|
2205 |
+
'type' => TType::MAP,
|
2206 |
+
'ktype' => TType::STRING,
|
2207 |
+
'vtype' => TType::LST,
|
2208 |
+
'key' => array(
|
2209 |
+
'type' => TType::STRING,
|
2210 |
+
),
|
2211 |
+
'val' => array(
|
2212 |
+
'type' => TType::LST,
|
2213 |
+
'etype' => TType::STRING,
|
2214 |
+
'elem' => array(
|
2215 |
+
'type' => TType::STRING,
|
2216 |
+
),
|
2217 |
+
),
|
2218 |
+
),
|
2219 |
+
);
|
|
|
|
|
|
|
2220 |
}
|
2221 |
+
if (is_array($vals)) {
|
2222 |
+
if (isset($vals['parameters'])) {
|
2223 |
+
$this->parameters = $vals['parameters'];
|
2224 |
+
}
|
2225 |
}
|
2226 |
+
}
|
2227 |
+
|
2228 |
+
public function getName() {
|
2229 |
+
return 'RequestContext';
|
2230 |
+
}
|
2231 |
+
|
2232 |
+
public function read($input)
|
2233 |
+
{
|
2234 |
+
$xfer = 0;
|
2235 |
+
$fname = null;
|
2236 |
+
$ftype = 0;
|
2237 |
+
$fid = 0;
|
2238 |
+
$xfer += $input->readStructBegin($fname);
|
2239 |
+
while (true)
|
2240 |
{
|
2241 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
2242 |
+
if ($ftype == TType::STOP) {
|
2243 |
+
break;
|
2244 |
+
}
|
2245 |
+
switch ($fid)
|
2246 |
+
{
|
2247 |
+
case 1:
|
2248 |
+
if ($ftype == TType::MAP) {
|
2249 |
+
$this->parameters = array();
|
2250 |
+
$_size71 = 0;
|
2251 |
+
$_ktype72 = 0;
|
2252 |
+
$_vtype73 = 0;
|
2253 |
+
$xfer += $input->readMapBegin($_ktype72, $_vtype73, $_size71);
|
2254 |
+
for ($_i75 = 0; $_i75 < $_size71; ++$_i75)
|
2255 |
{
|
2256 |
+
$key76 = '';
|
2257 |
+
$val77 = array();
|
2258 |
+
$xfer += $input->readString($key76);
|
2259 |
+
$val77 = array();
|
2260 |
+
$_size78 = 0;
|
2261 |
+
$_etype81 = 0;
|
2262 |
+
$xfer += $input->readListBegin($_etype81, $_size78);
|
2263 |
+
for ($_i82 = 0; $_i82 < $_size78; ++$_i82)
|
2264 |
+
{
|
2265 |
+
$elem83 = null;
|
2266 |
+
$xfer += $input->readString($elem83);
|
2267 |
+
$val77 []= $elem83;
|
2268 |
+
}
|
2269 |
+
$xfer += $input->readListEnd();
|
2270 |
+
$this->parameters[$key76] = $val77;
|
2271 |
+
}
|
2272 |
+
$xfer += $input->readMapEnd();
|
2273 |
+
} else {
|
2274 |
+
$xfer += $input->skip($ftype);
|
2275 |
+
}
|
2276 |
+
break;
|
2277 |
+
default:
|
2278 |
+
$xfer += $input->skip($ftype);
|
2279 |
+
break;
|
2280 |
+
}
|
2281 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2282 |
}
|
2283 |
+
$xfer += $input->readStructEnd();
|
2284 |
+
return $xfer;
|
2285 |
+
}
|
2286 |
+
|
2287 |
+
public function write($output) {
|
2288 |
+
$xfer = 0;
|
2289 |
+
$xfer += $output->writeStructBegin('RequestContext');
|
2290 |
+
if ($this->parameters !== null) {
|
2291 |
+
if (!is_array($this->parameters)) {
|
2292 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2293 |
+
}
|
2294 |
+
$xfer += $output->writeFieldBegin('parameters', TType::MAP, 1);
|
2295 |
+
{
|
2296 |
+
$output->writeMapBegin(TType::STRING, TType::LST, count($this->parameters));
|
2297 |
+
{
|
2298 |
+
foreach ($this->parameters as $kiter84 => $viter85)
|
2299 |
+
{
|
2300 |
+
$xfer += $output->writeString($kiter84);
|
2301 |
{
|
2302 |
+
$output->writeListBegin(TType::STRING, count($viter85));
|
2303 |
+
{
|
2304 |
+
foreach ($viter85 as $iter86)
|
2305 |
{
|
2306 |
+
$xfer += $output->writeString($iter86);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2307 |
}
|
2308 |
+
}
|
2309 |
+
$output->writeListEnd();
|
2310 |
}
|
2311 |
+
}
|
2312 |
}
|
2313 |
+
$output->writeMapEnd();
|
2314 |
+
}
|
2315 |
+
$xfer += $output->writeFieldEnd();
|
2316 |
}
|
2317 |
+
$xfer += $output->writeFieldStop();
|
2318 |
+
$xfer += $output->writeStructEnd();
|
2319 |
+
return $xfer;
|
2320 |
+
}
|
2321 |
|
2322 |
}
|
2323 |
|
2324 |
+
/**
|
2325 |
+
* unique identifier of the customer
|
2326 |
+
*/
|
2327 |
class UserRecord {
|
2328 |
+
static $_TSPEC;
|
2329 |
+
|
2330 |
+
/**
|
2331 |
+
* @var string
|
2332 |
+
*/
|
2333 |
+
public $username = null;
|
2334 |
+
|
2335 |
+
public function __construct($vals=null) {
|
2336 |
+
if (!isset(self::$_TSPEC)) {
|
2337 |
+
self::$_TSPEC = array(
|
2338 |
+
1 => array(
|
2339 |
+
'var' => 'username',
|
2340 |
+
'type' => TType::STRING,
|
2341 |
+
),
|
2342 |
+
);
|
|
|
|
|
|
|
2343 |
}
|
2344 |
+
if (is_array($vals)) {
|
2345 |
+
if (isset($vals['username'])) {
|
2346 |
+
$this->username = $vals['username'];
|
2347 |
+
}
|
2348 |
}
|
2349 |
+
}
|
2350 |
+
|
2351 |
+
public function getName() {
|
2352 |
+
return 'UserRecord';
|
2353 |
+
}
|
2354 |
+
|
2355 |
+
public function read($input)
|
2356 |
+
{
|
2357 |
+
$xfer = 0;
|
2358 |
+
$fname = null;
|
2359 |
+
$ftype = 0;
|
2360 |
+
$fid = 0;
|
2361 |
+
$xfer += $input->readStructBegin($fname);
|
2362 |
+
while (true)
|
2363 |
{
|
2364 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
2365 |
+
if ($ftype == TType::STOP) {
|
2366 |
+
break;
|
2367 |
+
}
|
2368 |
+
switch ($fid)
|
2369 |
+
{
|
2370 |
+
case 1:
|
2371 |
+
if ($ftype == TType::STRING) {
|
2372 |
+
$xfer += $input->readString($this->username);
|
2373 |
+
} else {
|
2374 |
+
$xfer += $input->skip($ftype);
|
2375 |
+
}
|
2376 |
+
break;
|
2377 |
+
default:
|
2378 |
+
$xfer += $input->skip($ftype);
|
2379 |
+
break;
|
2380 |
+
}
|
2381 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2382 |
}
|
2383 |
+
$xfer += $input->readStructEnd();
|
2384 |
+
return $xfer;
|
2385 |
+
}
|
2386 |
+
|
2387 |
+
public function write($output) {
|
2388 |
+
$xfer = 0;
|
2389 |
+
$xfer += $output->writeStructBegin('UserRecord');
|
2390 |
+
if ($this->username !== null) {
|
2391 |
+
$xfer += $output->writeFieldBegin('username', TType::STRING, 1);
|
2392 |
+
$xfer += $output->writeString($this->username);
|
2393 |
+
$xfer += $output->writeFieldEnd();
|
|
|
2394 |
}
|
2395 |
+
$xfer += $output->writeFieldStop();
|
2396 |
+
$xfer += $output->writeStructEnd();
|
2397 |
+
return $xfer;
|
2398 |
+
}
|
2399 |
|
2400 |
}
|
2401 |
|
2402 |
+
/**
|
2403 |
+
* <dl>
|
2404 |
+
* <dt>profileId</dt>
|
2405 |
+
* <dd>profile (visitor) identificator</dd>
|
2406 |
+
*
|
2407 |
+
* <dt>inquiries</dt>
|
2408 |
+
* <dd>list of inquiries to be executed sequentially.</dd>
|
2409 |
+
* <dd>Inquiries with higher index may depend from those with lower index.</dd>
|
2410 |
+
*
|
2411 |
+
* <dt>requestContext</dt>
|
2412 |
+
* <dd>context of the request</dd>
|
2413 |
+
* </dl>
|
2414 |
+
*/
|
2415 |
class ChoiceRequest {
|
2416 |
+
static $_TSPEC;
|
2417 |
+
|
2418 |
+
/**
|
2419 |
+
* @var \com\boxalino\p13n\api\thrift\UserRecord
|
2420 |
+
*/
|
2421 |
+
public $userRecord = null;
|
2422 |
+
/**
|
2423 |
+
* @var string
|
2424 |
+
*/
|
2425 |
+
public $profileId = null;
|
2426 |
+
/**
|
2427 |
+
* @var \com\boxalino\p13n\api\thrift\ChoiceInquiry[]
|
2428 |
+
*/
|
2429 |
+
public $inquiries = null;
|
2430 |
+
/**
|
2431 |
+
* @var \com\boxalino\p13n\api\thrift\RequestContext
|
2432 |
+
*/
|
2433 |
+
public $requestContext = null;
|
2434 |
+
|
2435 |
+
public function __construct($vals=null) {
|
2436 |
+
if (!isset(self::$_TSPEC)) {
|
2437 |
+
self::$_TSPEC = array(
|
2438 |
+
1 => array(
|
2439 |
+
'var' => 'userRecord',
|
2440 |
+
'type' => TType::STRUCT,
|
2441 |
+
'class' => '\com\boxalino\p13n\api\thrift\UserRecord',
|
2442 |
+
),
|
2443 |
+
2 => array(
|
2444 |
+
'var' => 'profileId',
|
2445 |
+
'type' => TType::STRING,
|
2446 |
+
),
|
2447 |
+
3 => array(
|
2448 |
+
'var' => 'inquiries',
|
2449 |
+
'type' => TType::LST,
|
2450 |
+
'etype' => TType::STRUCT,
|
2451 |
+
'elem' => array(
|
2452 |
+
'type' => TType::STRUCT,
|
2453 |
+
'class' => '\com\boxalino\p13n\api\thrift\ChoiceInquiry',
|
2454 |
+
),
|
2455 |
+
),
|
2456 |
+
4 => array(
|
2457 |
+
'var' => 'requestContext',
|
2458 |
+
'type' => TType::STRUCT,
|
2459 |
+
'class' => '\com\boxalino\p13n\api\thrift\RequestContext',
|
2460 |
+
),
|
2461 |
+
);
|
|
|
|
|
|
|
2462 |
}
|
2463 |
+
if (is_array($vals)) {
|
2464 |
+
if (isset($vals['userRecord'])) {
|
2465 |
+
$this->userRecord = $vals['userRecord'];
|
2466 |
+
}
|
2467 |
+
if (isset($vals['profileId'])) {
|
2468 |
+
$this->profileId = $vals['profileId'];
|
2469 |
+
}
|
2470 |
+
if (isset($vals['inquiries'])) {
|
2471 |
+
$this->inquiries = $vals['inquiries'];
|
2472 |
+
}
|
2473 |
+
if (isset($vals['requestContext'])) {
|
2474 |
+
$this->requestContext = $vals['requestContext'];
|
2475 |
+
}
|
2476 |
}
|
2477 |
+
}
|
2478 |
+
|
2479 |
+
public function getName() {
|
2480 |
+
return 'ChoiceRequest';
|
2481 |
+
}
|
2482 |
+
|
2483 |
+
public function read($input)
|
2484 |
+
{
|
2485 |
+
$xfer = 0;
|
2486 |
+
$fname = null;
|
2487 |
+
$ftype = 0;
|
2488 |
+
$fid = 0;
|
2489 |
+
$xfer += $input->readStructBegin($fname);
|
2490 |
+
while (true)
|
2491 |
{
|
2492 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
2493 |
+
if ($ftype == TType::STOP) {
|
2494 |
+
break;
|
2495 |
+
}
|
2496 |
+
switch ($fid)
|
2497 |
+
{
|
2498 |
+
case 1:
|
2499 |
+
if ($ftype == TType::STRUCT) {
|
2500 |
+
$this->userRecord = new \com\boxalino\p13n\api\thrift\UserRecord();
|
2501 |
+
$xfer += $this->userRecord->read($input);
|
2502 |
+
} else {
|
2503 |
+
$xfer += $input->skip($ftype);
|
2504 |
+
}
|
2505 |
+
break;
|
2506 |
+
case 2:
|
2507 |
+
if ($ftype == TType::STRING) {
|
2508 |
+
$xfer += $input->readString($this->profileId);
|
2509 |
+
} else {
|
2510 |
+
$xfer += $input->skip($ftype);
|
2511 |
+
}
|
2512 |
+
break;
|
2513 |
+
case 3:
|
2514 |
+
if ($ftype == TType::LST) {
|
2515 |
+
$this->inquiries = array();
|
2516 |
+
$_size87 = 0;
|
2517 |
+
$_etype90 = 0;
|
2518 |
+
$xfer += $input->readListBegin($_etype90, $_size87);
|
2519 |
+
for ($_i91 = 0; $_i91 < $_size87; ++$_i91)
|
2520 |
{
|
2521 |
+
$elem92 = null;
|
2522 |
+
$elem92 = new \com\boxalino\p13n\api\thrift\ChoiceInquiry();
|
2523 |
+
$xfer += $elem92->read($input);
|
2524 |
+
$this->inquiries []= $elem92;
|
2525 |
+
}
|
2526 |
+
$xfer += $input->readListEnd();
|
2527 |
+
} else {
|
2528 |
+
$xfer += $input->skip($ftype);
|
2529 |
+
}
|
2530 |
+
break;
|
2531 |
+
case 4:
|
2532 |
+
if ($ftype == TType::STRUCT) {
|
2533 |
+
$this->requestContext = new \com\boxalino\p13n\api\thrift\RequestContext();
|
2534 |
+
$xfer += $this->requestContext->read($input);
|
2535 |
+
} else {
|
2536 |
+
$xfer += $input->skip($ftype);
|
2537 |
+
}
|
2538 |
+
break;
|
2539 |
+
default:
|
2540 |
+
$xfer += $input->skip($ftype);
|
2541 |
+
break;
|
2542 |
+
}
|
2543 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2544 |
}
|
2545 |
+
$xfer += $input->readStructEnd();
|
2546 |
+
return $xfer;
|
2547 |
+
}
|
2548 |
+
|
2549 |
+
public function write($output) {
|
2550 |
+
$xfer = 0;
|
2551 |
+
$xfer += $output->writeStructBegin('ChoiceRequest');
|
2552 |
+
if ($this->userRecord !== null) {
|
2553 |
+
if (!is_object($this->userRecord)) {
|
2554 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2555 |
+
}
|
2556 |
+
$xfer += $output->writeFieldBegin('userRecord', TType::STRUCT, 1);
|
2557 |
+
$xfer += $this->userRecord->write($output);
|
2558 |
+
$xfer += $output->writeFieldEnd();
|
2559 |
+
}
|
2560 |
+
if ($this->profileId !== null) {
|
2561 |
+
$xfer += $output->writeFieldBegin('profileId', TType::STRING, 2);
|
2562 |
+
$xfer += $output->writeString($this->profileId);
|
2563 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2564 |
}
|
2565 |
+
if ($this->inquiries !== null) {
|
2566 |
+
if (!is_array($this->inquiries)) {
|
2567 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2568 |
+
}
|
2569 |
+
$xfer += $output->writeFieldBegin('inquiries', TType::LST, 3);
|
2570 |
+
{
|
2571 |
+
$output->writeListBegin(TType::STRUCT, count($this->inquiries));
|
2572 |
+
{
|
2573 |
+
foreach ($this->inquiries as $iter93)
|
2574 |
+
{
|
2575 |
+
$xfer += $iter93->write($output);
|
2576 |
+
}
|
2577 |
+
}
|
2578 |
+
$output->writeListEnd();
|
2579 |
+
}
|
2580 |
+
$xfer += $output->writeFieldEnd();
|
2581 |
+
}
|
2582 |
+
if ($this->requestContext !== null) {
|
2583 |
+
if (!is_object($this->requestContext)) {
|
2584 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2585 |
+
}
|
2586 |
+
$xfer += $output->writeFieldBegin('requestContext', TType::STRUCT, 4);
|
2587 |
+
$xfer += $this->requestContext->write($output);
|
2588 |
+
$xfer += $output->writeFieldEnd();
|
2589 |
+
}
|
2590 |
+
$xfer += $output->writeFieldStop();
|
2591 |
+
$xfer += $output->writeStructEnd();
|
2592 |
+
return $xfer;
|
2593 |
+
}
|
2594 |
|
2595 |
}
|
2596 |
|
2597 |
+
/**
|
2598 |
+
* <dl>
|
2599 |
+
* <dt>fieldName</dt>
|
2600 |
+
* <dd>name of the facet field</dd>
|
2601 |
+
*
|
2602 |
+
* <dt>values</dt>
|
2603 |
+
* <dd>list of facet values</dd>
|
2604 |
+
* </dl>
|
2605 |
+
*/
|
2606 |
class FacetResponse {
|
2607 |
+
static $_TSPEC;
|
2608 |
+
|
2609 |
+
/**
|
2610 |
+
* @var string
|
2611 |
+
*/
|
2612 |
+
public $fieldName = null;
|
2613 |
+
/**
|
2614 |
+
* @var \com\boxalino\p13n\api\thrift\FacetValue[]
|
2615 |
+
*/
|
2616 |
+
public $values = null;
|
2617 |
+
|
2618 |
+
public function __construct($vals=null) {
|
2619 |
+
if (!isset(self::$_TSPEC)) {
|
2620 |
+
self::$_TSPEC = array(
|
2621 |
+
1 => array(
|
2622 |
+
'var' => 'fieldName',
|
2623 |
+
'type' => TType::STRING,
|
2624 |
+
),
|
2625 |
+
2 => array(
|
2626 |
+
'var' => 'values',
|
2627 |
+
'type' => TType::LST,
|
2628 |
+
'etype' => TType::STRUCT,
|
2629 |
+
'elem' => array(
|
2630 |
+
'type' => TType::STRUCT,
|
2631 |
+
'class' => '\com\boxalino\p13n\api\thrift\FacetValue',
|
2632 |
+
),
|
2633 |
+
),
|
2634 |
+
);
|
|
|
|
|
|
|
2635 |
}
|
2636 |
+
if (is_array($vals)) {
|
2637 |
+
if (isset($vals['fieldName'])) {
|
2638 |
+
$this->fieldName = $vals['fieldName'];
|
2639 |
+
}
|
2640 |
+
if (isset($vals['values'])) {
|
2641 |
+
$this->values = $vals['values'];
|
2642 |
+
}
|
2643 |
}
|
2644 |
+
}
|
2645 |
+
|
2646 |
+
public function getName() {
|
2647 |
+
return 'FacetResponse';
|
2648 |
+
}
|
2649 |
+
|
2650 |
+
public function read($input)
|
2651 |
+
{
|
2652 |
+
$xfer = 0;
|
2653 |
+
$fname = null;
|
2654 |
+
$ftype = 0;
|
2655 |
+
$fid = 0;
|
2656 |
+
$xfer += $input->readStructBegin($fname);
|
2657 |
+
while (true)
|
2658 |
{
|
2659 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
2660 |
+
if ($ftype == TType::STOP) {
|
2661 |
+
break;
|
2662 |
+
}
|
2663 |
+
switch ($fid)
|
2664 |
+
{
|
2665 |
+
case 1:
|
2666 |
+
if ($ftype == TType::STRING) {
|
2667 |
+
$xfer += $input->readString($this->fieldName);
|
2668 |
+
} else {
|
2669 |
+
$xfer += $input->skip($ftype);
|
2670 |
+
}
|
2671 |
+
break;
|
2672 |
+
case 2:
|
2673 |
+
if ($ftype == TType::LST) {
|
2674 |
+
$this->values = array();
|
2675 |
+
$_size94 = 0;
|
2676 |
+
$_etype97 = 0;
|
2677 |
+
$xfer += $input->readListBegin($_etype97, $_size94);
|
2678 |
+
for ($_i98 = 0; $_i98 < $_size94; ++$_i98)
|
2679 |
{
|
2680 |
+
$elem99 = null;
|
2681 |
+
$elem99 = new \com\boxalino\p13n\api\thrift\FacetValue();
|
2682 |
+
$xfer += $elem99->read($input);
|
2683 |
+
$this->values []= $elem99;
|
2684 |
+
}
|
2685 |
+
$xfer += $input->readListEnd();
|
2686 |
+
} else {
|
2687 |
+
$xfer += $input->skip($ftype);
|
2688 |
+
}
|
2689 |
+
break;
|
2690 |
+
default:
|
2691 |
+
$xfer += $input->skip($ftype);
|
2692 |
+
break;
|
2693 |
+
}
|
2694 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2695 |
}
|
2696 |
+
$xfer += $input->readStructEnd();
|
2697 |
+
return $xfer;
|
2698 |
+
}
|
2699 |
+
|
2700 |
+
public function write($output) {
|
2701 |
+
$xfer = 0;
|
2702 |
+
$xfer += $output->writeStructBegin('FacetResponse');
|
2703 |
+
if ($this->fieldName !== null) {
|
2704 |
+
$xfer += $output->writeFieldBegin('fieldName', TType::STRING, 1);
|
2705 |
+
$xfer += $output->writeString($this->fieldName);
|
2706 |
+
$xfer += $output->writeFieldEnd();
|
2707 |
+
}
|
2708 |
+
if ($this->values !== null) {
|
2709 |
+
if (!is_array($this->values)) {
|
2710 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2711 |
+
}
|
2712 |
+
$xfer += $output->writeFieldBegin('values', TType::LST, 2);
|
2713 |
+
{
|
2714 |
+
$output->writeListBegin(TType::STRUCT, count($this->values));
|
2715 |
+
{
|
2716 |
+
foreach ($this->values as $iter100)
|
2717 |
+
{
|
2718 |
+
$xfer += $iter100->write($output);
|
2719 |
+
}
|
2720 |
+
}
|
2721 |
+
$output->writeListEnd();
|
2722 |
+
}
|
2723 |
+
$xfer += $output->writeFieldEnd();
|
|
|
2724 |
}
|
2725 |
+
$xfer += $output->writeFieldStop();
|
2726 |
+
$xfer += $output->writeStructEnd();
|
2727 |
+
return $xfer;
|
2728 |
+
}
|
2729 |
|
2730 |
}
|
2731 |
|
2732 |
+
/**
|
2733 |
+
* item found
|
2734 |
+
*
|
2735 |
+
* <dl>
|
2736 |
+
* <dt>values</dt>
|
2737 |
+
* <dd>map containing name of the field and list of values as strings</dd>
|
2738 |
+
* <dd>if index contains no value for a field, empty array will be returned.</dd>
|
2739 |
+
*
|
2740 |
+
* <dt>score</dt>
|
2741 |
+
* <dd>index score of the hit</dd>
|
2742 |
+
*
|
2743 |
+
* <dt>scenarioId</dt>
|
2744 |
+
* <dd>source scenarioId in case of mixed recommendations modes</dd>
|
2745 |
+
* </dl>
|
2746 |
+
*/
|
2747 |
class Hit {
|
2748 |
+
static $_TSPEC;
|
2749 |
+
|
2750 |
+
/**
|
2751 |
+
* @var array
|
2752 |
+
*/
|
2753 |
+
public $values = null;
|
2754 |
+
/**
|
2755 |
+
* @var double
|
2756 |
+
*/
|
2757 |
+
public $score = null;
|
2758 |
+
/**
|
2759 |
+
* @var string
|
2760 |
+
*/
|
2761 |
+
public $scenarioId = null;
|
2762 |
+
|
2763 |
+
public function __construct($vals=null) {
|
2764 |
+
if (!isset(self::$_TSPEC)) {
|
2765 |
+
self::$_TSPEC = array(
|
2766 |
+
1 => array(
|
2767 |
+
'var' => 'values',
|
2768 |
+
'type' => TType::MAP,
|
2769 |
+
'ktype' => TType::STRING,
|
2770 |
+
'vtype' => TType::LST,
|
2771 |
+
'key' => array(
|
2772 |
+
'type' => TType::STRING,
|
2773 |
+
),
|
2774 |
+
'val' => array(
|
2775 |
+
'type' => TType::LST,
|
2776 |
+
'etype' => TType::STRING,
|
2777 |
+
'elem' => array(
|
2778 |
+
'type' => TType::STRING,
|
2779 |
+
),
|
2780 |
+
),
|
2781 |
+
),
|
2782 |
+
2 => array(
|
2783 |
+
'var' => 'score',
|
2784 |
+
'type' => TType::DOUBLE,
|
2785 |
+
),
|
2786 |
+
30 => array(
|
2787 |
+
'var' => 'scenarioId',
|
2788 |
+
'type' => TType::STRING,
|
2789 |
+
),
|
2790 |
+
);
|
|
|
|
|
|
|
2791 |
}
|
2792 |
+
if (is_array($vals)) {
|
2793 |
+
if (isset($vals['values'])) {
|
2794 |
+
$this->values = $vals['values'];
|
2795 |
+
}
|
2796 |
+
if (isset($vals['score'])) {
|
2797 |
+
$this->score = $vals['score'];
|
2798 |
+
}
|
2799 |
+
if (isset($vals['scenarioId'])) {
|
2800 |
+
$this->scenarioId = $vals['scenarioId'];
|
2801 |
+
}
|
2802 |
}
|
2803 |
+
}
|
2804 |
+
|
2805 |
+
public function getName() {
|
2806 |
+
return 'Hit';
|
2807 |
+
}
|
2808 |
+
|
2809 |
+
public function read($input)
|
2810 |
+
{
|
2811 |
+
$xfer = 0;
|
2812 |
+
$fname = null;
|
2813 |
+
$ftype = 0;
|
2814 |
+
$fid = 0;
|
2815 |
+
$xfer += $input->readStructBegin($fname);
|
2816 |
+
while (true)
|
2817 |
{
|
2818 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
2819 |
+
if ($ftype == TType::STOP) {
|
2820 |
+
break;
|
2821 |
+
}
|
2822 |
+
switch ($fid)
|
2823 |
+
{
|
2824 |
+
case 1:
|
2825 |
+
if ($ftype == TType::MAP) {
|
2826 |
+
$this->values = array();
|
2827 |
+
$_size101 = 0;
|
2828 |
+
$_ktype102 = 0;
|
2829 |
+
$_vtype103 = 0;
|
2830 |
+
$xfer += $input->readMapBegin($_ktype102, $_vtype103, $_size101);
|
2831 |
+
for ($_i105 = 0; $_i105 < $_size101; ++$_i105)
|
2832 |
{
|
2833 |
+
$key106 = '';
|
2834 |
+
$val107 = array();
|
2835 |
+
$xfer += $input->readString($key106);
|
2836 |
+
$val107 = array();
|
2837 |
+
$_size108 = 0;
|
2838 |
+
$_etype111 = 0;
|
2839 |
+
$xfer += $input->readListBegin($_etype111, $_size108);
|
2840 |
+
for ($_i112 = 0; $_i112 < $_size108; ++$_i112)
|
2841 |
+
{
|
2842 |
+
$elem113 = null;
|
2843 |
+
$xfer += $input->readString($elem113);
|
2844 |
+
$val107 []= $elem113;
|
2845 |
+
}
|
2846 |
+
$xfer += $input->readListEnd();
|
2847 |
+
$this->values[$key106] = $val107;
|
2848 |
+
}
|
2849 |
+
$xfer += $input->readMapEnd();
|
2850 |
+
} else {
|
2851 |
+
$xfer += $input->skip($ftype);
|
2852 |
+
}
|
2853 |
+
break;
|
2854 |
+
case 2:
|
2855 |
+
if ($ftype == TType::DOUBLE) {
|
2856 |
+
$xfer += $input->readDouble($this->score);
|
2857 |
+
} else {
|
2858 |
+
$xfer += $input->skip($ftype);
|
2859 |
+
}
|
2860 |
+
break;
|
2861 |
+
case 30:
|
2862 |
+
if ($ftype == TType::STRING) {
|
2863 |
+
$xfer += $input->readString($this->scenarioId);
|
2864 |
+
} else {
|
2865 |
+
$xfer += $input->skip($ftype);
|
2866 |
+
}
|
2867 |
+
break;
|
2868 |
+
default:
|
2869 |
+
$xfer += $input->skip($ftype);
|
2870 |
+
break;
|
2871 |
+
}
|
2872 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2873 |
}
|
2874 |
+
$xfer += $input->readStructEnd();
|
2875 |
+
return $xfer;
|
2876 |
+
}
|
2877 |
+
|
2878 |
+
public function write($output) {
|
2879 |
+
$xfer = 0;
|
2880 |
+
$xfer += $output->writeStructBegin('Hit');
|
2881 |
+
if ($this->values !== null) {
|
2882 |
+
if (!is_array($this->values)) {
|
2883 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
2884 |
+
}
|
2885 |
+
$xfer += $output->writeFieldBegin('values', TType::MAP, 1);
|
2886 |
+
{
|
2887 |
+
$output->writeMapBegin(TType::STRING, TType::LST, count($this->values));
|
2888 |
+
{
|
2889 |
+
foreach ($this->values as $kiter114 => $viter115)
|
2890 |
+
{
|
2891 |
+
$xfer += $output->writeString($kiter114);
|
2892 |
{
|
2893 |
+
$output->writeListBegin(TType::STRING, count($viter115));
|
2894 |
+
{
|
2895 |
+
foreach ($viter115 as $iter116)
|
2896 |
{
|
2897 |
+
$xfer += $output->writeString($iter116);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2898 |
}
|
2899 |
+
}
|
2900 |
+
$output->writeListEnd();
|
2901 |
}
|
2902 |
+
}
|
|
|
|
|
|
|
|
|
|
|
2903 |
}
|
2904 |
+
$output->writeMapEnd();
|
2905 |
+
}
|
2906 |
+
$xfer += $output->writeFieldEnd();
|
2907 |
+
}
|
2908 |
+
if ($this->score !== null) {
|
2909 |
+
$xfer += $output->writeFieldBegin('score', TType::DOUBLE, 2);
|
2910 |
+
$xfer += $output->writeDouble($this->score);
|
2911 |
+
$xfer += $output->writeFieldEnd();
|
2912 |
}
|
2913 |
+
if ($this->scenarioId !== null) {
|
2914 |
+
$xfer += $output->writeFieldBegin('scenarioId', TType::STRING, 30);
|
2915 |
+
$xfer += $output->writeString($this->scenarioId);
|
2916 |
+
$xfer += $output->writeFieldEnd();
|
2917 |
+
}
|
2918 |
+
$xfer += $output->writeFieldStop();
|
2919 |
+
$xfer += $output->writeStructEnd();
|
2920 |
+
return $xfer;
|
2921 |
+
}
|
2922 |
|
2923 |
}
|
2924 |
|
2925 |
+
/**
|
2926 |
+
* grouped item found
|
2927 |
+
*
|
2928 |
+
* <dl>
|
2929 |
+
* <dt>groupValue</dt>
|
2930 |
+
* <dd>value of the groupBy field</dd>
|
2931 |
+
*
|
2932 |
+
* <dt>totalHitCount</dt>
|
2933 |
+
* <dd>total hits count within the group</dd>
|
2934 |
+
*
|
2935 |
+
* <dt>hits</dt>
|
2936 |
+
* <dd>group hits</dd>
|
2937 |
+
* </dl>
|
2938 |
+
*/
|
2939 |
class HitsGroup {
|
2940 |
+
static $_TSPEC;
|
2941 |
+
|
2942 |
+
/**
|
2943 |
+
* @var string
|
2944 |
+
*/
|
2945 |
+
public $groupValue = null;
|
2946 |
+
/**
|
2947 |
+
* @var int
|
2948 |
+
*/
|
2949 |
+
public $totalHitCount = null;
|
2950 |
+
/**
|
2951 |
+
* @var \com\boxalino\p13n\api\thrift\Hit[]
|
2952 |
+
*/
|
2953 |
+
public $hits = null;
|
2954 |
+
|
2955 |
+
public function __construct($vals=null) {
|
2956 |
+
if (!isset(self::$_TSPEC)) {
|
2957 |
+
self::$_TSPEC = array(
|
2958 |
+
10 => array(
|
2959 |
+
'var' => 'groupValue',
|
2960 |
+
'type' => TType::STRING,
|
2961 |
+
),
|
2962 |
+
20 => array(
|
2963 |
+
'var' => 'totalHitCount',
|
2964 |
+
'type' => TType::I64,
|
2965 |
+
),
|
2966 |
+
30 => array(
|
2967 |
+
'var' => 'hits',
|
2968 |
+
'type' => TType::LST,
|
2969 |
+
'etype' => TType::STRUCT,
|
2970 |
+
'elem' => array(
|
2971 |
+
'type' => TType::STRUCT,
|
2972 |
+
'class' => '\com\boxalino\p13n\api\thrift\Hit',
|
2973 |
+
),
|
2974 |
+
),
|
2975 |
+
);
|
|
|
|
|
|
|
2976 |
}
|
2977 |
+
if (is_array($vals)) {
|
2978 |
+
if (isset($vals['groupValue'])) {
|
2979 |
+
$this->groupValue = $vals['groupValue'];
|
2980 |
+
}
|
2981 |
+
if (isset($vals['totalHitCount'])) {
|
2982 |
+
$this->totalHitCount = $vals['totalHitCount'];
|
2983 |
+
}
|
2984 |
+
if (isset($vals['hits'])) {
|
2985 |
+
$this->hits = $vals['hits'];
|
2986 |
+
}
|
2987 |
}
|
2988 |
+
}
|
2989 |
+
|
2990 |
+
public function getName() {
|
2991 |
+
return 'HitsGroup';
|
2992 |
+
}
|
2993 |
+
|
2994 |
+
public function read($input)
|
2995 |
+
{
|
2996 |
+
$xfer = 0;
|
2997 |
+
$fname = null;
|
2998 |
+
$ftype = 0;
|
2999 |
+
$fid = 0;
|
3000 |
+
$xfer += $input->readStructBegin($fname);
|
3001 |
+
while (true)
|
3002 |
{
|
3003 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
3004 |
+
if ($ftype == TType::STOP) {
|
3005 |
+
break;
|
3006 |
+
}
|
3007 |
+
switch ($fid)
|
3008 |
+
{
|
3009 |
+
case 10:
|
3010 |
+
if ($ftype == TType::STRING) {
|
3011 |
+
$xfer += $input->readString($this->groupValue);
|
3012 |
+
} else {
|
3013 |
+
$xfer += $input->skip($ftype);
|
3014 |
+
}
|
3015 |
+
break;
|
3016 |
+
case 20:
|
3017 |
+
if ($ftype == TType::I64) {
|
3018 |
+
$xfer += $input->readI64($this->totalHitCount);
|
3019 |
+
} else {
|
3020 |
+
$xfer += $input->skip($ftype);
|
3021 |
+
}
|
3022 |
+
break;
|
3023 |
+
case 30:
|
3024 |
+
if ($ftype == TType::LST) {
|
3025 |
+
$this->hits = array();
|
3026 |
+
$_size117 = 0;
|
3027 |
+
$_etype120 = 0;
|
3028 |
+
$xfer += $input->readListBegin($_etype120, $_size117);
|
3029 |
+
for ($_i121 = 0; $_i121 < $_size117; ++$_i121)
|
3030 |
{
|
3031 |
+
$elem122 = null;
|
3032 |
+
$elem122 = new \com\boxalino\p13n\api\thrift\Hit();
|
3033 |
+
$xfer += $elem122->read($input);
|
3034 |
+
$this->hits []= $elem122;
|
3035 |
+
}
|
3036 |
+
$xfer += $input->readListEnd();
|
3037 |
+
} else {
|
3038 |
+
$xfer += $input->skip($ftype);
|
3039 |
+
}
|
3040 |
+
break;
|
3041 |
+
default:
|
3042 |
+
$xfer += $input->skip($ftype);
|
3043 |
+
break;
|
3044 |
+
}
|
3045 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3046 |
}
|
3047 |
+
$xfer += $input->readStructEnd();
|
3048 |
+
return $xfer;
|
3049 |
+
}
|
3050 |
+
|
3051 |
+
public function write($output) {
|
3052 |
+
$xfer = 0;
|
3053 |
+
$xfer += $output->writeStructBegin('HitsGroup');
|
3054 |
+
if ($this->groupValue !== null) {
|
3055 |
+
$xfer += $output->writeFieldBegin('groupValue', TType::STRING, 10);
|
3056 |
+
$xfer += $output->writeString($this->groupValue);
|
3057 |
+
$xfer += $output->writeFieldEnd();
|
3058 |
+
}
|
3059 |
+
if ($this->totalHitCount !== null) {
|
3060 |
+
$xfer += $output->writeFieldBegin('totalHitCount', TType::I64, 20);
|
3061 |
+
$xfer += $output->writeI64($this->totalHitCount);
|
3062 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3063 |
}
|
3064 |
+
if ($this->hits !== null) {
|
3065 |
+
if (!is_array($this->hits)) {
|
3066 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3067 |
+
}
|
3068 |
+
$xfer += $output->writeFieldBegin('hits', TType::LST, 30);
|
3069 |
+
{
|
3070 |
+
$output->writeListBegin(TType::STRUCT, count($this->hits));
|
3071 |
+
{
|
3072 |
+
foreach ($this->hits as $iter123)
|
3073 |
+
{
|
3074 |
+
$xfer += $iter123->write($output);
|
3075 |
+
}
|
3076 |
+
}
|
3077 |
+
$output->writeListEnd();
|
3078 |
+
}
|
3079 |
+
$xfer += $output->writeFieldEnd();
|
3080 |
+
}
|
3081 |
+
$xfer += $output->writeFieldStop();
|
3082 |
+
$xfer += $output->writeStructEnd();
|
3083 |
+
return $xfer;
|
3084 |
+
}
|
3085 |
|
3086 |
}
|
3087 |
|
3088 |
+
/**
|
3089 |
+
* <dl>
|
3090 |
+
* <dt>hits</dt>
|
3091 |
+
* <dd>list of hits found for given SimpleSearchQuery</dd>
|
3092 |
+
*
|
3093 |
+
* <dt>facetResponses</dt>
|
3094 |
+
* <dd>list of requested facets or null if none requested</dd>
|
3095 |
+
*
|
3096 |
+
* <dt>totalHitCount</dt>
|
3097 |
+
* <dd>total number of hits; -1 in case of mixed recommendation strategy</dd>
|
3098 |
+
*
|
3099 |
+
* <dt>queryText</dt>
|
3100 |
+
* <dd>relaxation query text for relaxation results or requested queryText for a
|
3101 |
+
* regular SearchResult</dd>
|
3102 |
+
*
|
3103 |
+
* <dt>hitsGroups</dt>
|
3104 |
+
* <dd>grouped hits; not null when corresponding SimplSearchQuery has
|
3105 |
+
* groupBy!=null </dd>
|
3106 |
+
* </dl>
|
3107 |
+
*/
|
3108 |
class SearchResult {
|
3109 |
+
static $_TSPEC;
|
3110 |
+
|
3111 |
+
/**
|
3112 |
+
* @var \com\boxalino\p13n\api\thrift\Hit[]
|
3113 |
+
*/
|
3114 |
+
public $hits = null;
|
3115 |
+
/**
|
3116 |
+
* @var \com\boxalino\p13n\api\thrift\FacetResponse[]
|
3117 |
+
*/
|
3118 |
+
public $facetResponses = null;
|
3119 |
+
/**
|
3120 |
+
* @var int
|
3121 |
+
*/
|
3122 |
+
public $totalHitCount = null;
|
3123 |
+
/**
|
3124 |
+
* @var string
|
3125 |
+
*/
|
3126 |
+
public $queryText = null;
|
3127 |
+
/**
|
3128 |
+
* @var \com\boxalino\p13n\api\thrift\HitsGroup[]
|
3129 |
+
*/
|
3130 |
+
public $hitsGroups = null;
|
3131 |
+
|
3132 |
+
public function __construct($vals=null) {
|
3133 |
+
if (!isset(self::$_TSPEC)) {
|
3134 |
+
self::$_TSPEC = array(
|
3135 |
+
1 => array(
|
3136 |
+
'var' => 'hits',
|
3137 |
+
'type' => TType::LST,
|
3138 |
+
'etype' => TType::STRUCT,
|
3139 |
+
'elem' => array(
|
3140 |
+
'type' => TType::STRUCT,
|
3141 |
+
'class' => '\com\boxalino\p13n\api\thrift\Hit',
|
3142 |
+
),
|
3143 |
+
),
|
3144 |
+
2 => array(
|
3145 |
+
'var' => 'facetResponses',
|
3146 |
+
'type' => TType::LST,
|
3147 |
+
'etype' => TType::STRUCT,
|
3148 |
+
'elem' => array(
|
3149 |
+
'type' => TType::STRUCT,
|
3150 |
+
'class' => '\com\boxalino\p13n\api\thrift\FacetResponse',
|
3151 |
+
),
|
3152 |
+
),
|
3153 |
+
3 => array(
|
3154 |
+
'var' => 'totalHitCount',
|
3155 |
+
'type' => TType::I64,
|
3156 |
+
),
|
3157 |
+
40 => array(
|
3158 |
+
'var' => 'queryText',
|
3159 |
+
'type' => TType::STRING,
|
3160 |
+
),
|
3161 |
+
50 => array(
|
3162 |
+
'var' => 'hitsGroups',
|
3163 |
+
'type' => TType::LST,
|
3164 |
+
'etype' => TType::STRUCT,
|
3165 |
+
'elem' => array(
|
3166 |
+
'type' => TType::STRUCT,
|
3167 |
+
'class' => '\com\boxalino\p13n\api\thrift\HitsGroup',
|
3168 |
+
),
|
3169 |
+
),
|
3170 |
+
);
|
|
|
|
|
|
|
3171 |
}
|
3172 |
+
if (is_array($vals)) {
|
3173 |
+
if (isset($vals['hits'])) {
|
3174 |
+
$this->hits = $vals['hits'];
|
3175 |
+
}
|
3176 |
+
if (isset($vals['facetResponses'])) {
|
3177 |
+
$this->facetResponses = $vals['facetResponses'];
|
3178 |
+
}
|
3179 |
+
if (isset($vals['totalHitCount'])) {
|
3180 |
+
$this->totalHitCount = $vals['totalHitCount'];
|
3181 |
+
}
|
3182 |
+
if (isset($vals['queryText'])) {
|
3183 |
+
$this->queryText = $vals['queryText'];
|
3184 |
+
}
|
3185 |
+
if (isset($vals['hitsGroups'])) {
|
3186 |
+
$this->hitsGroups = $vals['hitsGroups'];
|
3187 |
+
}
|
3188 |
}
|
3189 |
+
}
|
3190 |
+
|
3191 |
+
public function getName() {
|
3192 |
+
return 'SearchResult';
|
3193 |
+
}
|
3194 |
+
|
3195 |
+
public function read($input)
|
3196 |
+
{
|
3197 |
+
$xfer = 0;
|
3198 |
+
$fname = null;
|
3199 |
+
$ftype = 0;
|
3200 |
+
$fid = 0;
|
3201 |
+
$xfer += $input->readStructBegin($fname);
|
3202 |
+
while (true)
|
3203 |
{
|
3204 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
3205 |
+
if ($ftype == TType::STOP) {
|
3206 |
+
break;
|
3207 |
+
}
|
3208 |
+
switch ($fid)
|
3209 |
+
{
|
3210 |
+
case 1:
|
3211 |
+
if ($ftype == TType::LST) {
|
3212 |
+
$this->hits = array();
|
3213 |
+
$_size124 = 0;
|
3214 |
+
$_etype127 = 0;
|
3215 |
+
$xfer += $input->readListBegin($_etype127, $_size124);
|
3216 |
+
for ($_i128 = 0; $_i128 < $_size124; ++$_i128)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3217 |
{
|
3218 |
+
$elem129 = null;
|
3219 |
+
$elem129 = new \com\boxalino\p13n\api\thrift\Hit();
|
3220 |
+
$xfer += $elem129->read($input);
|
3221 |
+
$this->hits []= $elem129;
|
3222 |
+
}
|
3223 |
+
$xfer += $input->readListEnd();
|
3224 |
+
} else {
|
3225 |
+
$xfer += $input->skip($ftype);
|
3226 |
+
}
|
3227 |
+
break;
|
3228 |
+
case 2:
|
3229 |
+
if ($ftype == TType::LST) {
|
3230 |
+
$this->facetResponses = array();
|
3231 |
+
$_size130 = 0;
|
3232 |
+
$_etype133 = 0;
|
3233 |
+
$xfer += $input->readListBegin($_etype133, $_size130);
|
3234 |
+
for ($_i134 = 0; $_i134 < $_size130; ++$_i134)
|
3235 |
{
|
3236 |
+
$elem135 = null;
|
3237 |
+
$elem135 = new \com\boxalino\p13n\api\thrift\FacetResponse();
|
3238 |
+
$xfer += $elem135->read($input);
|
3239 |
+
$this->facetResponses []= $elem135;
|
3240 |
+
}
|
3241 |
+
$xfer += $input->readListEnd();
|
3242 |
+
} else {
|
3243 |
+
$xfer += $input->skip($ftype);
|
3244 |
+
}
|
3245 |
+
break;
|
3246 |
+
case 3:
|
3247 |
+
if ($ftype == TType::I64) {
|
3248 |
+
$xfer += $input->readI64($this->totalHitCount);
|
3249 |
+
} else {
|
3250 |
+
$xfer += $input->skip($ftype);
|
3251 |
+
}
|
3252 |
+
break;
|
3253 |
+
case 40:
|
3254 |
+
if ($ftype == TType::STRING) {
|
3255 |
+
$xfer += $input->readString($this->queryText);
|
3256 |
+
} else {
|
3257 |
+
$xfer += $input->skip($ftype);
|
3258 |
+
}
|
3259 |
+
break;
|
3260 |
+
case 50:
|
3261 |
+
if ($ftype == TType::LST) {
|
3262 |
+
$this->hitsGroups = array();
|
3263 |
+
$_size136 = 0;
|
3264 |
+
$_etype139 = 0;
|
3265 |
+
$xfer += $input->readListBegin($_etype139, $_size136);
|
3266 |
+
for ($_i140 = 0; $_i140 < $_size136; ++$_i140)
|
3267 |
{
|
3268 |
+
$elem141 = null;
|
3269 |
+
$elem141 = new \com\boxalino\p13n\api\thrift\HitsGroup();
|
3270 |
+
$xfer += $elem141->read($input);
|
3271 |
+
$this->hitsGroups []= $elem141;
|
3272 |
+
}
|
3273 |
+
$xfer += $input->readListEnd();
|
3274 |
+
} else {
|
3275 |
+
$xfer += $input->skip($ftype);
|
3276 |
+
}
|
3277 |
+
break;
|
3278 |
+
default:
|
3279 |
+
$xfer += $input->skip($ftype);
|
3280 |
+
break;
|
3281 |
+
}
|
3282 |
+
$xfer += $input->readFieldEnd();
|
3283 |
+
}
|
3284 |
+
$xfer += $input->readStructEnd();
|
3285 |
+
return $xfer;
|
3286 |
+
}
|
3287 |
+
|
3288 |
+
public function write($output) {
|
3289 |
+
$xfer = 0;
|
3290 |
+
$xfer += $output->writeStructBegin('SearchResult');
|
3291 |
+
if ($this->hits !== null) {
|
3292 |
+
if (!is_array($this->hits)) {
|
3293 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3294 |
+
}
|
3295 |
+
$xfer += $output->writeFieldBegin('hits', TType::LST, 1);
|
3296 |
+
{
|
3297 |
+
$output->writeListBegin(TType::STRUCT, count($this->hits));
|
3298 |
+
{
|
3299 |
+
foreach ($this->hits as $iter142)
|
3300 |
+
{
|
3301 |
+
$xfer += $iter142->write($output);
|
3302 |
+
}
|
3303 |
+
}
|
3304 |
+
$output->writeListEnd();
|
3305 |
+
}
|
3306 |
+
$xfer += $output->writeFieldEnd();
|
3307 |
+
}
|
3308 |
+
if ($this->facetResponses !== null) {
|
3309 |
+
if (!is_array($this->facetResponses)) {
|
3310 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3311 |
+
}
|
3312 |
+
$xfer += $output->writeFieldBegin('facetResponses', TType::LST, 2);
|
3313 |
+
{
|
3314 |
+
$output->writeListBegin(TType::STRUCT, count($this->facetResponses));
|
3315 |
+
{
|
3316 |
+
foreach ($this->facetResponses as $iter143)
|
3317 |
+
{
|
3318 |
+
$xfer += $iter143->write($output);
|
3319 |
+
}
|
3320 |
+
}
|
3321 |
+
$output->writeListEnd();
|
3322 |
+
}
|
3323 |
+
$xfer += $output->writeFieldEnd();
|
3324 |
+
}
|
3325 |
+
if ($this->totalHitCount !== null) {
|
3326 |
+
$xfer += $output->writeFieldBegin('totalHitCount', TType::I64, 3);
|
3327 |
+
$xfer += $output->writeI64($this->totalHitCount);
|
3328 |
+
$xfer += $output->writeFieldEnd();
|
3329 |
+
}
|
3330 |
+
if ($this->queryText !== null) {
|
3331 |
+
$xfer += $output->writeFieldBegin('queryText', TType::STRING, 40);
|
3332 |
+
$xfer += $output->writeString($this->queryText);
|
3333 |
+
$xfer += $output->writeFieldEnd();
|
3334 |
+
}
|
3335 |
+
if ($this->hitsGroups !== null) {
|
3336 |
+
if (!is_array($this->hitsGroups)) {
|
3337 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3338 |
+
}
|
3339 |
+
$xfer += $output->writeFieldBegin('hitsGroups', TType::LST, 50);
|
3340 |
+
{
|
3341 |
+
$output->writeListBegin(TType::STRUCT, count($this->hitsGroups));
|
3342 |
+
{
|
3343 |
+
foreach ($this->hitsGroups as $iter144)
|
3344 |
+
{
|
3345 |
+
$xfer += $iter144->write($output);
|
3346 |
+
}
|
3347 |
+
}
|
3348 |
+
$output->writeListEnd();
|
3349 |
+
}
|
3350 |
+
$xfer += $output->writeFieldEnd();
|
3351 |
}
|
3352 |
+
$xfer += $output->writeFieldStop();
|
3353 |
+
$xfer += $output->writeStructEnd();
|
3354 |
+
return $xfer;
|
3355 |
+
}
|
3356 |
|
3357 |
}
|
3358 |
|
3359 |
class SearchRelaxation {
|
3360 |
+
static $_TSPEC;
|
3361 |
+
|
3362 |
+
/**
|
3363 |
+
* @var \com\boxalino\p13n\api\thrift\SearchResult[]
|
3364 |
+
*/
|
3365 |
+
public $suggestionsResults = null;
|
3366 |
+
/**
|
3367 |
+
* @var \com\boxalino\p13n\api\thrift\SearchResult[]
|
3368 |
+
*/
|
3369 |
+
public $subphrasesResults = null;
|
3370 |
+
|
3371 |
+
public function __construct($vals=null) {
|
3372 |
+
if (!isset(self::$_TSPEC)) {
|
3373 |
+
self::$_TSPEC = array(
|
3374 |
+
10 => array(
|
3375 |
+
'var' => 'suggestionsResults',
|
3376 |
+
'type' => TType::LST,
|
3377 |
+
'etype' => TType::STRUCT,
|
3378 |
+
'elem' => array(
|
3379 |
+
'type' => TType::STRUCT,
|
3380 |
+
'class' => '\com\boxalino\p13n\api\thrift\SearchResult',
|
3381 |
+
),
|
3382 |
+
),
|
3383 |
+
20 => array(
|
3384 |
+
'var' => 'subphrasesResults',
|
3385 |
+
'type' => TType::LST,
|
3386 |
+
'etype' => TType::STRUCT,
|
3387 |
+
'elem' => array(
|
3388 |
+
'type' => TType::STRUCT,
|
3389 |
+
'class' => '\com\boxalino\p13n\api\thrift\SearchResult',
|
3390 |
+
),
|
3391 |
+
),
|
3392 |
+
);
|
|
|
|
|
|
|
3393 |
}
|
3394 |
+
if (is_array($vals)) {
|
3395 |
+
if (isset($vals['suggestionsResults'])) {
|
3396 |
+
$this->suggestionsResults = $vals['suggestionsResults'];
|
3397 |
+
}
|
3398 |
+
if (isset($vals['subphrasesResults'])) {
|
3399 |
+
$this->subphrasesResults = $vals['subphrasesResults'];
|
3400 |
+
}
|
3401 |
}
|
3402 |
+
}
|
3403 |
+
|
3404 |
+
public function getName() {
|
3405 |
+
return 'SearchRelaxation';
|
3406 |
+
}
|
3407 |
+
|
3408 |
+
public function read($input)
|
3409 |
+
{
|
3410 |
+
$xfer = 0;
|
3411 |
+
$fname = null;
|
3412 |
+
$ftype = 0;
|
3413 |
+
$fid = 0;
|
3414 |
+
$xfer += $input->readStructBegin($fname);
|
3415 |
+
while (true)
|
3416 |
{
|
3417 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
3418 |
+
if ($ftype == TType::STOP) {
|
3419 |
+
break;
|
3420 |
+
}
|
3421 |
+
switch ($fid)
|
3422 |
+
{
|
3423 |
+
case 10:
|
3424 |
+
if ($ftype == TType::LST) {
|
3425 |
+
$this->suggestionsResults = array();
|
3426 |
+
$_size145 = 0;
|
3427 |
+
$_etype148 = 0;
|
3428 |
+
$xfer += $input->readListBegin($_etype148, $_size145);
|
3429 |
+
for ($_i149 = 0; $_i149 < $_size145; ++$_i149)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3430 |
{
|
3431 |
+
$elem150 = null;
|
3432 |
+
$elem150 = new \com\boxalino\p13n\api\thrift\SearchResult();
|
3433 |
+
$xfer += $elem150->read($input);
|
3434 |
+
$this->suggestionsResults []= $elem150;
|
3435 |
+
}
|
3436 |
+
$xfer += $input->readListEnd();
|
3437 |
+
} else {
|
3438 |
+
$xfer += $input->skip($ftype);
|
3439 |
+
}
|
3440 |
+
break;
|
3441 |
+
case 20:
|
3442 |
+
if ($ftype == TType::LST) {
|
3443 |
+
$this->subphrasesResults = array();
|
3444 |
+
$_size151 = 0;
|
3445 |
+
$_etype154 = 0;
|
3446 |
+
$xfer += $input->readListBegin($_etype154, $_size151);
|
3447 |
+
for ($_i155 = 0; $_i155 < $_size151; ++$_i155)
|
3448 |
{
|
3449 |
+
$elem156 = null;
|
3450 |
+
$elem156 = new \com\boxalino\p13n\api\thrift\SearchResult();
|
3451 |
+
$xfer += $elem156->read($input);
|
3452 |
+
$this->subphrasesResults []= $elem156;
|
3453 |
+
}
|
3454 |
+
$xfer += $input->readListEnd();
|
3455 |
+
} else {
|
3456 |
+
$xfer += $input->skip($ftype);
|
3457 |
+
}
|
3458 |
+
break;
|
3459 |
+
default:
|
3460 |
+
$xfer += $input->skip($ftype);
|
3461 |
+
break;
|
3462 |
+
}
|
3463 |
+
$xfer += $input->readFieldEnd();
|
3464 |
}
|
3465 |
+
$xfer += $input->readStructEnd();
|
3466 |
+
return $xfer;
|
3467 |
+
}
|
3468 |
+
|
3469 |
+
public function write($output) {
|
3470 |
+
$xfer = 0;
|
3471 |
+
$xfer += $output->writeStructBegin('SearchRelaxation');
|
3472 |
+
if ($this->suggestionsResults !== null) {
|
3473 |
+
if (!is_array($this->suggestionsResults)) {
|
3474 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3475 |
+
}
|
3476 |
+
$xfer += $output->writeFieldBegin('suggestionsResults', TType::LST, 10);
|
3477 |
+
{
|
3478 |
+
$output->writeListBegin(TType::STRUCT, count($this->suggestionsResults));
|
3479 |
+
{
|
3480 |
+
foreach ($this->suggestionsResults as $iter157)
|
3481 |
+
{
|
3482 |
+
$xfer += $iter157->write($output);
|
3483 |
+
}
|
3484 |
+
}
|
3485 |
+
$output->writeListEnd();
|
3486 |
+
}
|
3487 |
+
$xfer += $output->writeFieldEnd();
|
3488 |
+
}
|
3489 |
+
if ($this->subphrasesResults !== null) {
|
3490 |
+
if (!is_array($this->subphrasesResults)) {
|
3491 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3492 |
+
}
|
3493 |
+
$xfer += $output->writeFieldBegin('subphrasesResults', TType::LST, 20);
|
3494 |
+
{
|
3495 |
+
$output->writeListBegin(TType::STRUCT, count($this->subphrasesResults));
|
3496 |
+
{
|
3497 |
+
foreach ($this->subphrasesResults as $iter158)
|
3498 |
+
{
|
3499 |
+
$xfer += $iter158->write($output);
|
3500 |
+
}
|
3501 |
+
}
|
3502 |
+
$output->writeListEnd();
|
3503 |
+
}
|
3504 |
+
$xfer += $output->writeFieldEnd();
|
3505 |
+
}
|
3506 |
+
$xfer += $output->writeFieldStop();
|
3507 |
+
$xfer += $output->writeStructEnd();
|
3508 |
+
return $xfer;
|
3509 |
+
}
|
3510 |
|
3511 |
}
|
3512 |
|
3513 |
+
/**
|
3514 |
+
* <dl>
|
3515 |
+
* <dt>variantId</dt>
|
3516 |
+
* <dd>id of the personalized variant</dd>
|
3517 |
+
*
|
3518 |
+
* <dt>scenarioId</dt>
|
3519 |
+
* <dd>scenario identificator used to produce recommendation result or search
|
3520 |
+
* result personalization</dd>
|
3521 |
+
*
|
3522 |
+
* <dt>searchResult</dt>
|
3523 |
+
* <dd>result of the search request for recommendations and search requests</dd>
|
3524 |
+
*
|
3525 |
+
* <dt>searchResultTitle</dt>
|
3526 |
+
* <dd>recommendation's result title localized in language requested in
|
3527 |
+
* corresponding SimpleSearchQuery</dd>
|
3528 |
+
*
|
3529 |
+
* <dt>searchRelaxation</dt>
|
3530 |
+
* <dd>When the service considers queryText invalid, it will evaluate and return
|
3531 |
+
* relaxations if it is requested in corresponding ChoiceInquiry and if
|
3532 |
+
* relaxations could be found.</dd>
|
3533 |
+
* <dd>Note that original query still could yield some results; it is up to the
|
3534 |
+
* client to decide whether searchRelaxations should be used (with displaying
|
3535 |
+
* appropriate message) or not.</dd>
|
3536 |
+
* </dl>
|
3537 |
+
*/
|
3538 |
class Variant {
|
3539 |
+
static $_TSPEC;
|
3540 |
+
|
3541 |
+
/**
|
3542 |
+
* @var string
|
3543 |
+
*/
|
3544 |
+
public $variantId = null;
|
3545 |
+
/**
|
3546 |
+
* @var string
|
3547 |
+
*/
|
3548 |
+
public $scenarioId = null;
|
3549 |
+
/**
|
3550 |
+
* @var \com\boxalino\p13n\api\thrift\SearchResult
|
3551 |
+
*/
|
3552 |
+
public $searchResult = null;
|
3553 |
+
/**
|
3554 |
+
* @var string
|
3555 |
+
*/
|
3556 |
+
public $searchResultTitle = null;
|
3557 |
+
/**
|
3558 |
+
* @var \com\boxalino\p13n\api\thrift\SearchRelaxation
|
3559 |
+
*/
|
3560 |
+
public $searchRelaxation = null;
|
3561 |
+
/**
|
3562 |
+
* @var \com\boxalino\p13n\api\thrift\SearchResult[]
|
3563 |
+
*/
|
3564 |
+
public $semanticFilteringResults = null;
|
3565 |
+
|
3566 |
+
public function __construct($vals=null) {
|
3567 |
+
if (!isset(self::$_TSPEC)) {
|
3568 |
+
self::$_TSPEC = array(
|
3569 |
+
1 => array(
|
3570 |
+
'var' => 'variantId',
|
3571 |
+
'type' => TType::STRING,
|
3572 |
+
),
|
3573 |
+
2 => array(
|
3574 |
+
'var' => 'scenarioId',
|
3575 |
+
'type' => TType::STRING,
|
3576 |
+
),
|
3577 |
+
3 => array(
|
3578 |
+
'var' => 'searchResult',
|
3579 |
+
'type' => TType::STRUCT,
|
3580 |
+
'class' => '\com\boxalino\p13n\api\thrift\SearchResult',
|
3581 |
+
),
|
3582 |
+
4 => array(
|
3583 |
+
'var' => 'searchResultTitle',
|
3584 |
+
'type' => TType::STRING,
|
3585 |
+
),
|
3586 |
+
50 => array(
|
3587 |
+
'var' => 'searchRelaxation',
|
3588 |
+
'type' => TType::STRUCT,
|
3589 |
+
'class' => '\com\boxalino\p13n\api\thrift\SearchRelaxation',
|
3590 |
+
),
|
3591 |
+
60 => array(
|
3592 |
+
'var' => 'semanticFilteringResults',
|
3593 |
+
'type' => TType::LST,
|
3594 |
+
'etype' => TType::STRUCT,
|
3595 |
+
'elem' => array(
|
3596 |
+
'type' => TType::STRUCT,
|
3597 |
+
'class' => '\com\boxalino\p13n\api\thrift\SearchResult',
|
3598 |
+
),
|
3599 |
+
),
|
3600 |
+
);
|
3601 |
}
|
3602 |
+
if (is_array($vals)) {
|
3603 |
+
if (isset($vals['variantId'])) {
|
3604 |
+
$this->variantId = $vals['variantId'];
|
3605 |
+
}
|
3606 |
+
if (isset($vals['scenarioId'])) {
|
3607 |
+
$this->scenarioId = $vals['scenarioId'];
|
3608 |
+
}
|
3609 |
+
if (isset($vals['searchResult'])) {
|
3610 |
+
$this->searchResult = $vals['searchResult'];
|
3611 |
+
}
|
3612 |
+
if (isset($vals['searchResultTitle'])) {
|
3613 |
+
$this->searchResultTitle = $vals['searchResultTitle'];
|
3614 |
+
}
|
3615 |
+
if (isset($vals['searchRelaxation'])) {
|
3616 |
+
$this->searchRelaxation = $vals['searchRelaxation'];
|
3617 |
+
}
|
3618 |
+
if (isset($vals['semanticFilteringResults'])) {
|
3619 |
+
$this->semanticFilteringResults = $vals['semanticFilteringResults'];
|
3620 |
+
}
|
3621 |
}
|
3622 |
+
}
|
3623 |
+
|
3624 |
+
public function getName() {
|
3625 |
+
return 'Variant';
|
3626 |
+
}
|
3627 |
+
|
3628 |
+
public function read($input)
|
3629 |
+
{
|
3630 |
+
$xfer = 0;
|
3631 |
+
$fname = null;
|
3632 |
+
$ftype = 0;
|
3633 |
+
$fid = 0;
|
3634 |
+
$xfer += $input->readStructBegin($fname);
|
3635 |
+
while (true)
|
3636 |
{
|
3637 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
3638 |
+
if ($ftype == TType::STOP) {
|
3639 |
+
break;
|
3640 |
+
}
|
3641 |
+
switch ($fid)
|
3642 |
+
{
|
3643 |
+
case 1:
|
3644 |
+
if ($ftype == TType::STRING) {
|
3645 |
+
$xfer += $input->readString($this->variantId);
|
3646 |
+
} else {
|
3647 |
+
$xfer += $input->skip($ftype);
|
3648 |
+
}
|
3649 |
+
break;
|
3650 |
+
case 2:
|
3651 |
+
if ($ftype == TType::STRING) {
|
3652 |
+
$xfer += $input->readString($this->scenarioId);
|
3653 |
+
} else {
|
3654 |
+
$xfer += $input->skip($ftype);
|
3655 |
+
}
|
3656 |
+
break;
|
3657 |
+
case 3:
|
3658 |
+
if ($ftype == TType::STRUCT) {
|
3659 |
+
$this->searchResult = new \com\boxalino\p13n\api\thrift\SearchResult();
|
3660 |
+
$xfer += $this->searchResult->read($input);
|
3661 |
+
} else {
|
3662 |
+
$xfer += $input->skip($ftype);
|
3663 |
+
}
|
3664 |
+
break;
|
3665 |
+
case 4:
|
3666 |
+
if ($ftype == TType::STRING) {
|
3667 |
+
$xfer += $input->readString($this->searchResultTitle);
|
3668 |
+
} else {
|
3669 |
+
$xfer += $input->skip($ftype);
|
3670 |
+
}
|
3671 |
+
break;
|
3672 |
+
case 50:
|
3673 |
+
if ($ftype == TType::STRUCT) {
|
3674 |
+
$this->searchRelaxation = new \com\boxalino\p13n\api\thrift\SearchRelaxation();
|
3675 |
+
$xfer += $this->searchRelaxation->read($input);
|
3676 |
+
} else {
|
3677 |
+
$xfer += $input->skip($ftype);
|
3678 |
+
}
|
3679 |
+
break;
|
3680 |
+
case 60:
|
3681 |
+
if ($ftype == TType::LST) {
|
3682 |
+
$this->semanticFilteringResults = array();
|
3683 |
+
$_size159 = 0;
|
3684 |
+
$_etype162 = 0;
|
3685 |
+
$xfer += $input->readListBegin($_etype162, $_size159);
|
3686 |
+
for ($_i163 = 0; $_i163 < $_size159; ++$_i163)
|
3687 |
{
|
3688 |
+
$elem164 = null;
|
3689 |
+
$elem164 = new \com\boxalino\p13n\api\thrift\SearchResult();
|
3690 |
+
$xfer += $elem164->read($input);
|
3691 |
+
$this->semanticFilteringResults []= $elem164;
|
3692 |
+
}
|
3693 |
+
$xfer += $input->readListEnd();
|
3694 |
+
} else {
|
3695 |
+
$xfer += $input->skip($ftype);
|
3696 |
+
}
|
3697 |
+
break;
|
3698 |
+
default:
|
3699 |
+
$xfer += $input->skip($ftype);
|
3700 |
+
break;
|
3701 |
+
}
|
3702 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3703 |
}
|
3704 |
+
$xfer += $input->readStructEnd();
|
3705 |
+
return $xfer;
|
3706 |
+
}
|
3707 |
+
|
3708 |
+
public function write($output) {
|
3709 |
+
$xfer = 0;
|
3710 |
+
$xfer += $output->writeStructBegin('Variant');
|
3711 |
+
if ($this->variantId !== null) {
|
3712 |
+
$xfer += $output->writeFieldBegin('variantId', TType::STRING, 1);
|
3713 |
+
$xfer += $output->writeString($this->variantId);
|
3714 |
+
$xfer += $output->writeFieldEnd();
|
3715 |
+
}
|
3716 |
+
if ($this->scenarioId !== null) {
|
3717 |
+
$xfer += $output->writeFieldBegin('scenarioId', TType::STRING, 2);
|
3718 |
+
$xfer += $output->writeString($this->scenarioId);
|
3719 |
+
$xfer += $output->writeFieldEnd();
|
3720 |
+
}
|
3721 |
+
if ($this->searchResult !== null) {
|
3722 |
+
if (!is_object($this->searchResult)) {
|
3723 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3724 |
+
}
|
3725 |
+
$xfer += $output->writeFieldBegin('searchResult', TType::STRUCT, 3);
|
3726 |
+
$xfer += $this->searchResult->write($output);
|
3727 |
+
$xfer += $output->writeFieldEnd();
|
3728 |
+
}
|
3729 |
+
if ($this->searchResultTitle !== null) {
|
3730 |
+
$xfer += $output->writeFieldBegin('searchResultTitle', TType::STRING, 4);
|
3731 |
+
$xfer += $output->writeString($this->searchResultTitle);
|
3732 |
+
$xfer += $output->writeFieldEnd();
|
3733 |
+
}
|
3734 |
+
if ($this->searchRelaxation !== null) {
|
3735 |
+
if (!is_object($this->searchRelaxation)) {
|
3736 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3737 |
+
}
|
3738 |
+
$xfer += $output->writeFieldBegin('searchRelaxation', TType::STRUCT, 50);
|
3739 |
+
$xfer += $this->searchRelaxation->write($output);
|
3740 |
+
$xfer += $output->writeFieldEnd();
|
3741 |
+
}
|
3742 |
+
if ($this->semanticFilteringResults !== null) {
|
3743 |
+
if (!is_array($this->semanticFilteringResults)) {
|
3744 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3745 |
+
}
|
3746 |
+
$xfer += $output->writeFieldBegin('semanticFilteringResults', TType::LST, 60);
|
3747 |
+
{
|
3748 |
+
$output->writeListBegin(TType::STRUCT, count($this->semanticFilteringResults));
|
3749 |
+
{
|
3750 |
+
foreach ($this->semanticFilteringResults as $iter165)
|
3751 |
+
{
|
3752 |
+
$xfer += $iter165->write($output);
|
3753 |
+
}
|
3754 |
+
}
|
3755 |
+
$output->writeListEnd();
|
3756 |
+
}
|
3757 |
+
$xfer += $output->writeFieldEnd();
|
3758 |
}
|
3759 |
+
$xfer += $output->writeFieldStop();
|
3760 |
+
$xfer += $output->writeStructEnd();
|
3761 |
+
return $xfer;
|
3762 |
+
}
|
3763 |
|
3764 |
}
|
3765 |
|
3766 |
+
/**
|
3767 |
+
* list of personalized variants. Item's index corresponds to the index of the
|
3768 |
+
* ChoiceInquiry
|
3769 |
+
*/
|
3770 |
class ChoiceResponse {
|
3771 |
+
static $_TSPEC;
|
3772 |
+
|
3773 |
+
/**
|
3774 |
+
* @var \com\boxalino\p13n\api\thrift\Variant[]
|
3775 |
+
*/
|
3776 |
+
public $variants = null;
|
3777 |
+
|
3778 |
+
public function __construct($vals=null) {
|
3779 |
+
if (!isset(self::$_TSPEC)) {
|
3780 |
+
self::$_TSPEC = array(
|
3781 |
+
1 => array(
|
3782 |
+
'var' => 'variants',
|
3783 |
+
'type' => TType::LST,
|
3784 |
+
'etype' => TType::STRUCT,
|
3785 |
+
'elem' => array(
|
3786 |
+
'type' => TType::STRUCT,
|
3787 |
+
'class' => '\com\boxalino\p13n\api\thrift\Variant',
|
3788 |
+
),
|
3789 |
+
),
|
3790 |
+
);
|
|
|
|
|
|
|
3791 |
}
|
3792 |
+
if (is_array($vals)) {
|
3793 |
+
if (isset($vals['variants'])) {
|
3794 |
+
$this->variants = $vals['variants'];
|
3795 |
+
}
|
3796 |
}
|
3797 |
+
}
|
3798 |
+
|
3799 |
+
public function getName() {
|
3800 |
+
return 'ChoiceResponse';
|
3801 |
+
}
|
3802 |
+
|
3803 |
+
public function read($input)
|
3804 |
+
{
|
3805 |
+
$xfer = 0;
|
3806 |
+
$fname = null;
|
3807 |
+
$ftype = 0;
|
3808 |
+
$fid = 0;
|
3809 |
+
$xfer += $input->readStructBegin($fname);
|
3810 |
+
while (true)
|
3811 |
{
|
3812 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
3813 |
+
if ($ftype == TType::STOP) {
|
3814 |
+
break;
|
3815 |
+
}
|
3816 |
+
switch ($fid)
|
3817 |
+
{
|
3818 |
+
case 1:
|
3819 |
+
if ($ftype == TType::LST) {
|
3820 |
+
$this->variants = array();
|
3821 |
+
$_size166 = 0;
|
3822 |
+
$_etype169 = 0;
|
3823 |
+
$xfer += $input->readListBegin($_etype169, $_size166);
|
3824 |
+
for ($_i170 = 0; $_i170 < $_size166; ++$_i170)
|
3825 |
{
|
3826 |
+
$elem171 = null;
|
3827 |
+
$elem171 = new \com\boxalino\p13n\api\thrift\Variant();
|
3828 |
+
$xfer += $elem171->read($input);
|
3829 |
+
$this->variants []= $elem171;
|
3830 |
+
}
|
3831 |
+
$xfer += $input->readListEnd();
|
3832 |
+
} else {
|
3833 |
+
$xfer += $input->skip($ftype);
|
3834 |
+
}
|
3835 |
+
break;
|
3836 |
+
default:
|
3837 |
+
$xfer += $input->skip($ftype);
|
3838 |
+
break;
|
3839 |
+
}
|
3840 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3841 |
}
|
3842 |
+
$xfer += $input->readStructEnd();
|
3843 |
+
return $xfer;
|
3844 |
+
}
|
3845 |
+
|
3846 |
+
public function write($output) {
|
3847 |
+
$xfer = 0;
|
3848 |
+
$xfer += $output->writeStructBegin('ChoiceResponse');
|
3849 |
+
if ($this->variants !== null) {
|
3850 |
+
if (!is_array($this->variants)) {
|
3851 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
3852 |
+
}
|
3853 |
+
$xfer += $output->writeFieldBegin('variants', TType::LST, 1);
|
3854 |
+
{
|
3855 |
+
$output->writeListBegin(TType::STRUCT, count($this->variants));
|
3856 |
+
{
|
3857 |
+
foreach ($this->variants as $iter172)
|
3858 |
+
{
|
3859 |
+
$xfer += $iter172->write($output);
|
3860 |
+
}
|
3861 |
+
}
|
3862 |
+
$output->writeListEnd();
|
3863 |
+
}
|
3864 |
+
$xfer += $output->writeFieldEnd();
|
|
|
3865 |
}
|
3866 |
+
$xfer += $output->writeFieldStop();
|
3867 |
+
$xfer += $output->writeStructEnd();
|
3868 |
+
return $xfer;
|
3869 |
+
}
|
3870 |
|
3871 |
}
|
3872 |
|
3873 |
class ProfilePropertyValue {
|
3874 |
+
static $_TSPEC;
|
3875 |
+
|
3876 |
+
/**
|
3877 |
+
* @var string
|
3878 |
+
*/
|
3879 |
+
public $profileId = null;
|
3880 |
+
/**
|
3881 |
+
* @var string
|
3882 |
+
*/
|
3883 |
+
public $propertyName = null;
|
3884 |
+
/**
|
3885 |
+
* @var string
|
3886 |
+
*/
|
3887 |
+
public $propertyValue = null;
|
3888 |
+
/**
|
3889 |
+
* @var int
|
3890 |
+
*/
|
3891 |
+
public $confidence = null;
|
3892 |
+
|
3893 |
+
public function __construct($vals=null) {
|
3894 |
+
if (!isset(self::$_TSPEC)) {
|
3895 |
+
self::$_TSPEC = array(
|
3896 |
+
1 => array(
|
3897 |
+
'var' => 'profileId',
|
3898 |
+
'type' => TType::STRING,
|
3899 |
+
),
|
3900 |
+
2 => array(
|
3901 |
+
'var' => 'propertyName',
|
3902 |
+
'type' => TType::STRING,
|
3903 |
+
),
|
3904 |
+
3 => array(
|
3905 |
+
'var' => 'propertyValue',
|
3906 |
+
'type' => TType::STRING,
|
3907 |
+
),
|
3908 |
+
4 => array(
|
3909 |
+
'var' => 'confidence',
|
3910 |
+
'type' => TType::I32,
|
3911 |
+
),
|
3912 |
+
);
|
|
|
|
|
|
|
3913 |
}
|
3914 |
+
if (is_array($vals)) {
|
3915 |
+
if (isset($vals['profileId'])) {
|
3916 |
+
$this->profileId = $vals['profileId'];
|
3917 |
+
}
|
3918 |
+
if (isset($vals['propertyName'])) {
|
3919 |
+
$this->propertyName = $vals['propertyName'];
|
3920 |
+
}
|
3921 |
+
if (isset($vals['propertyValue'])) {
|
3922 |
+
$this->propertyValue = $vals['propertyValue'];
|
3923 |
+
}
|
3924 |
+
if (isset($vals['confidence'])) {
|
3925 |
+
$this->confidence = $vals['confidence'];
|
3926 |
+
}
|
3927 |
}
|
3928 |
+
}
|
3929 |
+
|
3930 |
+
public function getName() {
|
3931 |
+
return 'ProfilePropertyValue';
|
3932 |
+
}
|
3933 |
+
|
3934 |
+
public function read($input)
|
3935 |
+
{
|
3936 |
+
$xfer = 0;
|
3937 |
+
$fname = null;
|
3938 |
+
$ftype = 0;
|
3939 |
+
$fid = 0;
|
3940 |
+
$xfer += $input->readStructBegin($fname);
|
3941 |
+
while (true)
|
3942 |
{
|
3943 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
3944 |
+
if ($ftype == TType::STOP) {
|
3945 |
+
break;
|
3946 |
+
}
|
3947 |
+
switch ($fid)
|
3948 |
+
{
|
3949 |
+
case 1:
|
3950 |
+
if ($ftype == TType::STRING) {
|
3951 |
+
$xfer += $input->readString($this->profileId);
|
3952 |
+
} else {
|
3953 |
+
$xfer += $input->skip($ftype);
|
3954 |
+
}
|
3955 |
+
break;
|
3956 |
+
case 2:
|
3957 |
+
if ($ftype == TType::STRING) {
|
3958 |
+
$xfer += $input->readString($this->propertyName);
|
3959 |
+
} else {
|
3960 |
+
$xfer += $input->skip($ftype);
|
3961 |
+
}
|
3962 |
+
break;
|
3963 |
+
case 3:
|
3964 |
+
if ($ftype == TType::STRING) {
|
3965 |
+
$xfer += $input->readString($this->propertyValue);
|
3966 |
+
} else {
|
3967 |
+
$xfer += $input->skip($ftype);
|
3968 |
+
}
|
3969 |
+
break;
|
3970 |
+
case 4:
|
3971 |
+
if ($ftype == TType::I32) {
|
3972 |
+
$xfer += $input->readI32($this->confidence);
|
3973 |
+
} else {
|
3974 |
+
$xfer += $input->skip($ftype);
|
3975 |
+
}
|
3976 |
+
break;
|
3977 |
+
default:
|
3978 |
+
$xfer += $input->skip($ftype);
|
3979 |
+
break;
|
3980 |
+
}
|
3981 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3982 |
}
|
3983 |
+
$xfer += $input->readStructEnd();
|
3984 |
+
return $xfer;
|
3985 |
+
}
|
3986 |
+
|
3987 |
+
public function write($output) {
|
3988 |
+
$xfer = 0;
|
3989 |
+
$xfer += $output->writeStructBegin('ProfilePropertyValue');
|
3990 |
+
if ($this->profileId !== null) {
|
3991 |
+
$xfer += $output->writeFieldBegin('profileId', TType::STRING, 1);
|
3992 |
+
$xfer += $output->writeString($this->profileId);
|
3993 |
+
$xfer += $output->writeFieldEnd();
|
3994 |
+
}
|
3995 |
+
if ($this->propertyName !== null) {
|
3996 |
+
$xfer += $output->writeFieldBegin('propertyName', TType::STRING, 2);
|
3997 |
+
$xfer += $output->writeString($this->propertyName);
|
3998 |
+
$xfer += $output->writeFieldEnd();
|
3999 |
+
}
|
4000 |
+
if ($this->propertyValue !== null) {
|
4001 |
+
$xfer += $output->writeFieldBegin('propertyValue', TType::STRING, 3);
|
4002 |
+
$xfer += $output->writeString($this->propertyValue);
|
4003 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
4004 |
}
|
4005 |
+
if ($this->confidence !== null) {
|
4006 |
+
$xfer += $output->writeFieldBegin('confidence', TType::I32, 4);
|
4007 |
+
$xfer += $output->writeI32($this->confidence);
|
4008 |
+
$xfer += $output->writeFieldEnd();
|
4009 |
+
}
|
4010 |
+
$xfer += $output->writeFieldStop();
|
4011 |
+
$xfer += $output->writeStructEnd();
|
4012 |
+
return $xfer;
|
4013 |
+
}
|
4014 |
|
4015 |
}
|
4016 |
|
4017 |
+
/**
|
4018 |
+
* <dl>
|
4019 |
+
* <dt>choiceInquiry</dt>
|
4020 |
+
* <dd><b>deprecated</b> - use choiceInquiries instead.</dd>
|
4021 |
+
* <dd>If choiceInquiries is given this field will be ignored</dd>
|
4022 |
+
*
|
4023 |
+
* <dt>choiceInquiries</dt>
|
4024 |
+
* <dd>list of ChoiceInquiries to be executed sequentially.</dd>
|
4025 |
+
* <dd>Note that list items can depend of items before in list</dd>
|
4026 |
+
* </dl>
|
4027 |
+
*/
|
4028 |
class BatchChoiceRequest {
|
4029 |
+
static $_TSPEC;
|
4030 |
+
|
4031 |
+
/**
|
4032 |
+
* @var \com\boxalino\p13n\api\thrift\UserRecord
|
4033 |
+
*/
|
4034 |
+
public $userRecord = null;
|
4035 |
+
/**
|
4036 |
+
* @var \com\boxalino\p13n\api\thrift\ChoiceInquiry
|
4037 |
+
*/
|
4038 |
+
public $choiceInquiry = null;
|
4039 |
+
/**
|
4040 |
+
* @var \com\boxalino\p13n\api\thrift\RequestContext
|
4041 |
+
*/
|
4042 |
+
public $requestContext = null;
|
4043 |
+
/**
|
4044 |
+
* @var string[]
|
4045 |
+
*/
|
4046 |
+
public $profileIds = null;
|
4047 |
+
/**
|
4048 |
+
* @var \com\boxalino\p13n\api\thrift\ChoiceInquiry[]
|
4049 |
+
*/
|
4050 |
+
public $choiceInquiries = null;
|
4051 |
+
|
4052 |
+
public function __construct($vals=null) {
|
4053 |
+
if (!isset(self::$_TSPEC)) {
|
4054 |
+
self::$_TSPEC = array(
|
4055 |
+
1 => array(
|
4056 |
+
'var' => 'userRecord',
|
4057 |
+
'type' => TType::STRUCT,
|
4058 |
+
'class' => '\com\boxalino\p13n\api\thrift\UserRecord',
|
4059 |
+
),
|
4060 |
+
2 => array(
|
4061 |
+
'var' => 'choiceInquiry',
|
4062 |
+
'type' => TType::STRUCT,
|
4063 |
+
'class' => '\com\boxalino\p13n\api\thrift\ChoiceInquiry',
|
4064 |
+
),
|
4065 |
+
3 => array(
|
4066 |
+
'var' => 'requestContext',
|
4067 |
+
'type' => TType::STRUCT,
|
4068 |
+
'class' => '\com\boxalino\p13n\api\thrift\RequestContext',
|
4069 |
+
),
|
4070 |
+
4 => array(
|
4071 |
+
'var' => 'profileIds',
|
4072 |
+
'type' => TType::LST,
|
4073 |
+
'etype' => TType::STRING,
|
4074 |
+
'elem' => array(
|
4075 |
+
'type' => TType::STRING,
|
4076 |
+
),
|
4077 |
+
),
|
4078 |
+
5 => array(
|
4079 |
+
'var' => 'choiceInquiries',
|
4080 |
+
'type' => TType::LST,
|
4081 |
+
'etype' => TType::STRUCT,
|
4082 |
+
'elem' => array(
|
4083 |
+
'type' => TType::STRUCT,
|
4084 |
+
'class' => '\com\boxalino\p13n\api\thrift\ChoiceInquiry',
|
4085 |
+
),
|
4086 |
+
),
|
4087 |
+
);
|
|
|
|
|
|
|
4088 |
}
|
4089 |
+
if (is_array($vals)) {
|
4090 |
+
if (isset($vals['userRecord'])) {
|
4091 |
+
$this->userRecord = $vals['userRecord'];
|
4092 |
+
}
|
4093 |
+
if (isset($vals['choiceInquiry'])) {
|
4094 |
+
$this->choiceInquiry = $vals['choiceInquiry'];
|
4095 |
+
}
|
4096 |
+
if (isset($vals['requestContext'])) {
|
4097 |
+
$this->requestContext = $vals['requestContext'];
|
4098 |
+
}
|
4099 |
+
if (isset($vals['profileIds'])) {
|
4100 |
+
$this->profileIds = $vals['profileIds'];
|
4101 |
+
}
|
4102 |
+
if (isset($vals['choiceInquiries'])) {
|
4103 |
+
$this->choiceInquiries = $vals['choiceInquiries'];
|
4104 |
+
}
|
4105 |
}
|
4106 |
+
}
|
4107 |
+
|
4108 |
+
public function getName() {
|
4109 |
+
return 'BatchChoiceRequest';
|
4110 |
+
}
|
4111 |
+
|
4112 |
+
public function read($input)
|
4113 |
+
{
|
4114 |
+
$xfer = 0;
|
4115 |
+
$fname = null;
|
4116 |
+
$ftype = 0;
|
4117 |
+
$fid = 0;
|
4118 |
+
$xfer += $input->readStructBegin($fname);
|
4119 |
+
while (true)
|
4120 |
{
|
4121 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
4122 |
+
if ($ftype == TType::STOP) {
|
4123 |
+
break;
|
4124 |
+
}
|
4125 |
+
switch ($fid)
|
4126 |
+
{
|
4127 |
+
case 1:
|
4128 |
+
if ($ftype == TType::STRUCT) {
|
4129 |
+
$this->userRecord = new \com\boxalino\p13n\api\thrift\UserRecord();
|
4130 |
+
$xfer += $this->userRecord->read($input);
|
4131 |
+
} else {
|
4132 |
+
$xfer += $input->skip($ftype);
|
4133 |
+
}
|
4134 |
+
break;
|
4135 |
+
case 2:
|
4136 |
+
if ($ftype == TType::STRUCT) {
|
4137 |
+
$this->choiceInquiry = new \com\boxalino\p13n\api\thrift\ChoiceInquiry();
|
4138 |
+
$xfer += $this->choiceInquiry->read($input);
|
4139 |
+
} else {
|
4140 |
+
$xfer += $input->skip($ftype);
|
4141 |
+
}
|
4142 |
+
break;
|
4143 |
+
case 3:
|
4144 |
+
if ($ftype == TType::STRUCT) {
|
4145 |
+
$this->requestContext = new \com\boxalino\p13n\api\thrift\RequestContext();
|
4146 |
+
$xfer += $this->requestContext->read($input);
|
4147 |
+
} else {
|
4148 |
+
$xfer += $input->skip($ftype);
|
4149 |
+
}
|
4150 |
+
break;
|
4151 |
+
case 4:
|
4152 |
+
if ($ftype == TType::LST) {
|
4153 |
+
$this->profileIds = array();
|
4154 |
+
$_size173 = 0;
|
4155 |
+
$_etype176 = 0;
|
4156 |
+
$xfer += $input->readListBegin($_etype176, $_size173);
|
4157 |
+
for ($_i177 = 0; $_i177 < $_size173; ++$_i177)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4158 |
{
|
4159 |
+
$elem178 = null;
|
4160 |
+
$xfer += $input->readString($elem178);
|
4161 |
+
$this->profileIds []= $elem178;
|
4162 |
+
}
|
4163 |
+
$xfer += $input->readListEnd();
|
4164 |
+
} else {
|
4165 |
+
$xfer += $input->skip($ftype);
|
4166 |
+
}
|
4167 |
+
break;
|
4168 |
+
case 5:
|
4169 |
+
if ($ftype == TType::LST) {
|
4170 |
+
$this->choiceInquiries = array();
|
4171 |
+
$_size179 = 0;
|
4172 |
+
$_etype182 = 0;
|
4173 |
+
$xfer += $input->readListBegin($_etype182, $_size179);
|
4174 |
+
for ($_i183 = 0; $_i183 < $_size179; ++$_i183)
|
4175 |
{
|
4176 |
+
$elem184 = null;
|
4177 |
+
$elem184 = new \com\boxalino\p13n\api\thrift\ChoiceInquiry();
|
4178 |
+
$xfer += $elem184->read($input);
|
4179 |
+
$this->choiceInquiries []= $elem184;
|
4180 |
+
}
|
4181 |
+
$xfer += $input->readListEnd();
|
4182 |
+
} else {
|
4183 |
+
$xfer += $input->skip($ftype);
|
4184 |
+
}
|
4185 |
+
break;
|
4186 |
+
default:
|
4187 |
+
$xfer += $input->skip($ftype);
|
4188 |
+
break;
|
4189 |
+
}
|
4190 |
+
$xfer += $input->readFieldEnd();
|
4191 |
+
}
|
4192 |
+
$xfer += $input->readStructEnd();
|
4193 |
+
return $xfer;
|
4194 |
+
}
|
4195 |
+
|
4196 |
+
public function write($output) {
|
4197 |
+
$xfer = 0;
|
4198 |
+
$xfer += $output->writeStructBegin('BatchChoiceRequest');
|
4199 |
+
if ($this->userRecord !== null) {
|
4200 |
+
if (!is_object($this->userRecord)) {
|
4201 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
4202 |
+
}
|
4203 |
+
$xfer += $output->writeFieldBegin('userRecord', TType::STRUCT, 1);
|
4204 |
+
$xfer += $this->userRecord->write($output);
|
4205 |
+
$xfer += $output->writeFieldEnd();
|
4206 |
+
}
|
4207 |
+
if ($this->choiceInquiry !== null) {
|
4208 |
+
if (!is_object($this->choiceInquiry)) {
|
4209 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
4210 |
+
}
|
4211 |
+
$xfer += $output->writeFieldBegin('choiceInquiry', TType::STRUCT, 2);
|
4212 |
+
$xfer += $this->choiceInquiry->write($output);
|
4213 |
+
$xfer += $output->writeFieldEnd();
|
4214 |
+
}
|
4215 |
+
if ($this->requestContext !== null) {
|
4216 |
+
if (!is_object($this->requestContext)) {
|
4217 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
4218 |
+
}
|
4219 |
+
$xfer += $output->writeFieldBegin('requestContext', TType::STRUCT, 3);
|
4220 |
+
$xfer += $this->requestContext->write($output);
|
4221 |
+
$xfer += $output->writeFieldEnd();
|
4222 |
+
}
|
4223 |
+
if ($this->profileIds !== null) {
|
4224 |
+
if (!is_array($this->profileIds)) {
|
4225 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
4226 |
+
}
|
4227 |
+
$xfer += $output->writeFieldBegin('profileIds', TType::LST, 4);
|
4228 |
+
{
|
4229 |
+
$output->writeListBegin(TType::STRING, count($this->profileIds));
|
4230 |
+
{
|
4231 |
+
foreach ($this->profileIds as $iter185)
|
4232 |
+
{
|
4233 |
+
$xfer += $output->writeString($iter185);
|
4234 |
+
}
|
4235 |
+
}
|
4236 |
+
$output->writeListEnd();
|
4237 |
+
}
|
4238 |
+
$xfer += $output->writeFieldEnd();
|
4239 |
}
|
4240 |
+
if ($this->choiceInquiries !== null) {
|
4241 |
+
if (!is_array($this->choiceInquiries)) {
|
4242 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
4243 |
+
}
|
4244 |
+
$xfer += $output->writeFieldBegin('choiceInquiries', TType::LST, 5);
|
4245 |
+
{
|
4246 |
+
$output->writeListBegin(TType::STRUCT, count($this->choiceInquiries));
|
4247 |
+
{
|
4248 |
+
foreach ($this->choiceInquiries as $iter186)
|
4249 |
+
{
|
4250 |
+
$xfer += $iter186->write($output);
|
4251 |
+
}
|
4252 |
+
}
|
4253 |
+
$output->writeListEnd();
|
4254 |
+
}
|
4255 |
+
$xfer += $output->writeFieldEnd();
|
4256 |
+
}
|
4257 |
+
$xfer += $output->writeFieldStop();
|
4258 |
+
$xfer += $output->writeStructEnd();
|
4259 |
+
return $xfer;
|
4260 |
+
}
|
4261 |
|
4262 |
}
|
4263 |
|
4264 |
+
/**
|
4265 |
+
* <dl>
|
4266 |
+
* <dt>variants</dt>
|
4267 |
+
* <dd><b>deprecated</b> - contains non-null value only if
|
4268 |
+
* corresponding BatchChoiceRequest had only one ChoiceInquiry</dd>
|
4269 |
+
*
|
4270 |
+
* <dt>selectedVariants</dt>
|
4271 |
+
* <dd>outer list corresponds to profileIds given in BatchChoiceRequest, while
|
4272 |
+
* inner list corresponds to list of ChoiceInquiries from BatchChoiceRequest</dd>
|
4273 |
+
* </dl>
|
4274 |
+
*/
|
4275 |
class BatchChoiceResponse {
|
4276 |
+
static $_TSPEC;
|
4277 |
+
|
4278 |
+
/**
|
4279 |
+
* @var \com\boxalino\p13n\api\thrift\Variant[]
|
4280 |
+
*/
|
4281 |
+
public $variants = null;
|
4282 |
+
/**
|
4283 |
+
* @var (\com\boxalino\p13n\api\thrift\Variant[])[]
|
4284 |
+
*/
|
4285 |
+
public $selectedVariants = null;
|
4286 |
+
|
4287 |
+
public function __construct($vals=null) {
|
4288 |
+
if (!isset(self::$_TSPEC)) {
|
4289 |
+
self::$_TSPEC = array(
|
4290 |
+
1 => array(
|
4291 |
+
'var' => 'variants',
|
4292 |
+
'type' => TType::LST,
|
4293 |
+
'etype' => TType::STRUCT,
|
4294 |
+
'elem' => array(
|
4295 |
+
'type' => TType::STRUCT,
|
4296 |
+
'class' => '\com\boxalino\p13n\api\thrift\Variant',
|
4297 |
+
),
|
4298 |
+
),
|
4299 |
+
2 => array(
|
4300 |
+
'var' => 'selectedVariants',
|
4301 |
+
'type' => TType::LST,
|
4302 |
+
'etype' => TType::LST,
|
4303 |
+
'elem' => array(
|
4304 |
+
'type' => TType::LST,
|
4305 |
+
'etype' => TType::STRUCT,
|
4306 |
+
'elem' => array(
|
4307 |
+
'type' => TType::STRUCT,
|
4308 |
+
'class' => '\com\boxalino\p13n\api\thrift\Variant',
|
4309 |
+
),
|
4310 |
+
),
|
4311 |
+
),
|
4312 |
+
);
|
|
|
|
|
|
|
4313 |
}
|
4314 |
+
if (is_array($vals)) {
|
4315 |
+
if (isset($vals['variants'])) {
|
4316 |
+
$this->variants = $vals['variants'];
|
4317 |
+
}
|
4318 |
+
if (isset($vals['selectedVariants'])) {
|
4319 |
+
$this->selectedVariants = $vals['selectedVariants'];
|
4320 |
+
}
|
4321 |
}
|
4322 |
+
}
|
4323 |
+
|
4324 |
+
public function getName() {
|
4325 |
+
return 'BatchChoiceResponse';
|
4326 |
+
}
|
4327 |
+
|
4328 |
+
public function read($input)
|
4329 |
+
{
|
4330 |
+
$xfer = 0;
|
4331 |
+
$fname = null;
|
4332 |
+
$ftype = 0;
|
4333 |
+
$fid = 0;
|
4334 |
+
$xfer += $input->readStructBegin($fname);
|
4335 |
+
while (true)
|
4336 |
{
|
4337 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
4338 |
+
if ($ftype == TType::STOP) {
|
4339 |
+
break;
|
4340 |
+
}
|
4341 |
+
switch ($fid)
|
4342 |
+
{
|
4343 |
+
case 1:
|
4344 |
+
if ($ftype == TType::LST) {
|
4345 |
+
$this->variants = array();
|
4346 |
+
$_size187 = 0;
|
4347 |
+
$_etype190 = 0;
|
4348 |
+
$xfer += $input->readListBegin($_etype190, $_size187);
|
4349 |
+
for ($_i191 = 0; $_i191 < $_size187; ++$_i191)
|
4350 |
{
|
4351 |
+
$elem192 = null;
|
4352 |
+
$elem192 = new \com\boxalino\p13n\api\thrift\Variant();
|
4353 |
+
$xfer += $elem192->read($input);
|
4354 |
+
$this->variants []= $elem192;
|
4355 |
+
}
|
4356 |
+
$xfer += $input->readListEnd();
|
4357 |
+
} else {
|
4358 |
+
$xfer += $input->skip($ftype);
|
4359 |
+
}
|
4360 |
+
break;
|
4361 |
+
case 2:
|
4362 |
+
if ($ftype == TType::LST) {
|
4363 |
+
$this->selectedVariants = array();
|
4364 |
+
$_size193 = 0;
|
4365 |
+
$_etype196 = 0;
|
4366 |
+
$xfer += $input->readListBegin($_etype196, $_size193);
|
4367 |
+
for ($_i197 = 0; $_i197 < $_size193; ++$_i197)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4368 |
{
|
4369 |
+
$elem198 = null;
|
4370 |
+
$elem198 = array();
|
4371 |
+
$_size199 = 0;
|
4372 |
+
$_etype202 = 0;
|
4373 |
+
$xfer += $input->readListBegin($_etype202, $_size199);
|
4374 |
+
for ($_i203 = 0; $_i203 < $_size199; ++$_i203)
|
4375 |
+
{
|
4376 |
+
$elem204 = null;
|
4377 |
+
$elem204 = new \com\boxalino\p13n\api\thrift\Variant();
|
4378 |
+
$xfer += $elem204->read($input);
|
4379 |
+
$elem198 []= $elem204;
|
4380 |
+
}
|
4381 |
+
$xfer += $input->readListEnd();
|
4382 |
+
$this->selectedVariants []= $elem198;
|
4383 |
+
}
|
4384 |
+
$xfer += $input->readListEnd();
|
4385 |
+
} else {
|
4386 |
+
$xfer += $input->skip($ftype);
|
4387 |
+
}
|
4388 |
+
break;
|
4389 |
+
default:
|
4390 |
+
$xfer += $input->skip($ftype);
|
4391 |
+
break;
|
4392 |
+
}
|
4393 |
+
$xfer += $input->readFieldEnd();
|
4394 |
+
}
|
4395 |
+
$xfer += $input->readStructEnd();
|
4396 |
+
return $xfer;
|
4397 |
+
}
|
4398 |
+
|
4399 |
+
public function write($output) {
|
4400 |
+
$xfer = 0;
|
4401 |
+
$xfer += $output->writeStructBegin('BatchChoiceResponse');
|
4402 |
+
if ($this->variants !== null) {
|
4403 |
+
if (!is_array($this->variants)) {
|
4404 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
4405 |
+
}
|
4406 |
+
$xfer += $output->writeFieldBegin('variants', TType::LST, 1);
|
4407 |
+
{
|
4408 |
+
$output->writeListBegin(TType::STRUCT, count($this->variants));
|
4409 |
+
{
|
4410 |
+
foreach ($this->variants as $iter205)
|
4411 |
+
{
|
4412 |
+
$xfer += $iter205->write($output);
|
4413 |
+
}
|
4414 |
+
}
|
4415 |
+
$output->writeListEnd();
|
4416 |
+
}
|
4417 |
+
$xfer += $output->writeFieldEnd();
|
4418 |
+
}
|
4419 |
+
if ($this->selectedVariants !== null) {
|
4420 |
+
if (!is_array($this->selectedVariants)) {
|
4421 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
4422 |
+
}
|
4423 |
+
$xfer += $output->writeFieldBegin('selectedVariants', TType::LST, 2);
|
4424 |
+
{
|
4425 |
+
$output->writeListBegin(TType::LST, count($this->selectedVariants));
|
4426 |
+
{
|
4427 |
+
foreach ($this->selectedVariants as $iter206)
|
4428 |
+
{
|
4429 |
{
|
4430 |
+
$output->writeListBegin(TType::STRUCT, count($iter206));
|
4431 |
+
{
|
4432 |
+
foreach ($iter206 as $iter207)
|
4433 |
{
|
4434 |
+
$xfer += $iter207->write($output);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4435 |
}
|
4436 |
+
}
|
4437 |
+
$output->writeListEnd();
|
4438 |
}
|
4439 |
+
}
|
4440 |
}
|
4441 |
+
$output->writeListEnd();
|
4442 |
+
}
|
4443 |
+
$xfer += $output->writeFieldEnd();
|
4444 |
}
|
4445 |
+
$xfer += $output->writeFieldStop();
|
4446 |
+
$xfer += $output->writeStructEnd();
|
4447 |
+
return $xfer;
|
4448 |
+
}
|
4449 |
|
4450 |
}
|
4451 |
|
4452 |
class AutocompleteHit {
|
4453 |
+
static $_TSPEC;
|
4454 |
+
|
4455 |
+
/**
|
4456 |
+
* @var string
|
4457 |
+
*/
|
4458 |
+
public $suggestion = null;
|
4459 |
+
/**
|
4460 |
+
* @var string
|
4461 |
+
*/
|
4462 |
+
public $highlighted = null;
|
4463 |
+
/**
|
4464 |
+
* @var \com\boxalino\p13n\api\thrift\SearchResult
|
4465 |
+
*/
|
4466 |
+
public $searchResult = null;
|
4467 |
+
/**
|
4468 |
+
* @var double
|
4469 |
+
*/
|
4470 |
+
public $score = null;
|
4471 |
+
|
4472 |
+
public function __construct($vals=null) {
|
4473 |
+
if (!isset(self::$_TSPEC)) {
|
4474 |
+
self::$_TSPEC = array(
|
4475 |
+
11 => array(
|
4476 |
+
'var' => 'suggestion',
|
4477 |
+
'type' => TType::STRING,
|
4478 |
+
),
|
4479 |
+
21 => array(
|
4480 |
+
'var' => 'highlighted',
|
4481 |
+
'type' => TType::STRING,
|
4482 |
+
),
|
4483 |
+
31 => array(
|
4484 |
+
'var' => 'searchResult',
|
4485 |
+
'type' => TType::STRUCT,
|
4486 |
+
'class' => '\com\boxalino\p13n\api\thrift\SearchResult',
|
4487 |
+
),
|
4488 |
+
41 => array(
|
4489 |
+
'var' => 'score',
|
4490 |
+
'type' => TType::DOUBLE,
|
4491 |
+
),
|
4492 |
+
);
|
|
|
|
|
|
|
4493 |
}
|
4494 |
+
if (is_array($vals)) {
|
4495 |
+
if (isset($vals['suggestion'])) {
|
4496 |
+
$this->suggestion = $vals['suggestion'];
|
4497 |
+
}
|
4498 |
+
if (isset($vals['highlighted'])) {
|
4499 |
+
$this->highlighted = $vals['highlighted'];
|
4500 |
+
}
|
4501 |
+
if (isset($vals['searchResult'])) {
|
4502 |
+
$this->searchResult = $vals['searchResult'];
|
4503 |
+
}
|
4504 |
+
if (isset($vals['score'])) {
|
4505 |
+
$this->score = $vals['score'];
|
4506 |
+
}
|
4507 |
}
|
4508 |
+
}
|
4509 |
+
|
4510 |
+
public function getName() {
|
4511 |
+
return 'AutocompleteHit';
|
4512 |
+
}
|
4513 |
+
|
4514 |
+
public function read($input)
|
4515 |
+
{
|
4516 |
+
$xfer = 0;
|
4517 |
+
$fname = null;
|
4518 |
+
$ftype = 0;
|
4519 |
+
$fid = 0;
|
4520 |
+
$xfer += $input->readStructBegin($fname);
|
4521 |
+
while (true)
|
4522 |
{
|
4523 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
4524 |
+
if ($ftype == TType::STOP) {
|
4525 |
+
break;
|
4526 |
+
}
|
4527 |
+
switch ($fid)
|
4528 |
+
{
|
4529 |
+
case 11:
|
4530 |
+
if ($ftype == TType::STRING) {
|
4531 |
+
$xfer += $input->readString($this->suggestion);
|
4532 |
+
} else {
|
4533 |
+
$xfer += $input->skip($ftype);
|
4534 |
+
}
|
4535 |
+
break;
|
4536 |
+
case 21:
|
4537 |
+
if ($ftype == TType::STRING) {
|
4538 |
+
$xfer += $input->readString($this->highlighted);
|
4539 |
+
} else {
|
4540 |
+
$xfer += $input->skip($ftype);
|
4541 |
+
}
|
4542 |
+
break;
|
4543 |
+
case 31:
|
4544 |
+
if ($ftype == TType::STRUCT) {
|
4545 |
+
$this->searchResult = new \com\boxalino\p13n\api\thrift\SearchResult();
|
4546 |
+
$xfer += $this->searchResult->read($input);
|
4547 |
+
} else {
|
4548 |
+
$xfer += $input->skip($ftype);
|
4549 |
+
}
|
4550 |
+
break;
|
4551 |
+
case 41:
|
4552 |
+
if ($ftype == TType::DOUBLE) {
|
4553 |
+
$xfer += $input->readDouble($this->score);
|
4554 |
+
} else {
|
4555 |
+
$xfer += $input->skip($ftype);
|
4556 |
+
}
|
4557 |
+
break;
|
4558 |
+
default:
|
4559 |
+
$xfer += $input->skip($ftype);
|
4560 |
+
break;
|
4561 |
+
}
|
4562 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4563 |
}
|
4564 |
+
$xfer += $input->readStructEnd();
|
4565 |
+
return $xfer;
|
4566 |
+
}
|
4567 |
+
|
4568 |
+
public function write($output) {
|
4569 |
+
$xfer = 0;
|
4570 |
+
$xfer += $output->writeStructBegin('AutocompleteHit');
|
4571 |
+
if ($this->suggestion !== null) {
|
4572 |
+
$xfer += $output->writeFieldBegin('suggestion', TType::STRING, 11);
|
4573 |
+
$xfer += $output->writeString($this->suggestion);
|
4574 |
+
$xfer += $output->writeFieldEnd();
|
4575 |
+
}
|
4576 |
+
if ($this->highlighted !== null) {
|
4577 |
+
$xfer += $output->writeFieldBegin('highlighted', TType::STRING, 21);
|
4578 |
+
$xfer += $output->writeString($this->highlighted);
|
4579 |
+
$xfer += $output->writeFieldEnd();
|
4580 |
+
}
|
4581 |
+
if ($this->searchResult !== null) {
|
4582 |
+
if (!is_object($this->searchResult)) {
|
4583 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
4584 |
+
}
|
4585 |
+
$xfer += $output->writeFieldBegin('searchResult', TType::STRUCT, 31);
|
4586 |
+
$xfer += $this->searchResult->write($output);
|
4587 |
+
$xfer += $output->writeFieldEnd();
|
4588 |
+
}
|
4589 |
+
if ($this->score !== null) {
|
4590 |
+
$xfer += $output->writeFieldBegin('score', TType::DOUBLE, 41);
|
4591 |
+
$xfer += $output->writeDouble($this->score);
|
4592 |
+
$xfer += $output->writeFieldEnd();
|
|
|
4593 |
}
|
4594 |
+
$xfer += $output->writeFieldStop();
|
4595 |
+
$xfer += $output->writeStructEnd();
|
4596 |
+
return $xfer;
|
4597 |
+
}
|
4598 |
|
4599 |
}
|
4600 |
|
4601 |
class AutocompleteQuery {
|
4602 |
+
static $_TSPEC;
|
4603 |
+
|
4604 |
+
/**
|
4605 |
+
* @var string
|
4606 |
+
*/
|
4607 |
+
public $indexId = null;
|
4608 |
+
/**
|
4609 |
+
* @var string
|
4610 |
+
*/
|
4611 |
+
public $language = null;
|
4612 |
+
/**
|
4613 |
+
* @var string
|
4614 |
+
*/
|
4615 |
+
public $queryText = null;
|
4616 |
+
/**
|
4617 |
+
* @var int
|
4618 |
+
*/
|
4619 |
+
public $suggestionsHitCount = null;
|
4620 |
+
/**
|
4621 |
+
* @var bool
|
4622 |
+
*/
|
4623 |
+
public $highlight = null;
|
4624 |
+
/**
|
4625 |
+
* @var string
|
4626 |
+
*/
|
4627 |
+
public $highlightPre = "<em>";
|
4628 |
+
/**
|
4629 |
+
* @var string
|
4630 |
+
*/
|
4631 |
+
public $highlightPost = "</em>";
|
4632 |
+
|
4633 |
+
public function __construct($vals=null) {
|
4634 |
+
if (!isset(self::$_TSPEC)) {
|
4635 |
+
self::$_TSPEC = array(
|
4636 |
+
11 => array(
|
4637 |
+
'var' => 'indexId',
|
4638 |
+
'type' => TType::STRING,
|
4639 |
+
),
|
4640 |
+
21 => array(
|
4641 |
+
'var' => 'language',
|
4642 |
+
'type' => TType::STRING,
|
4643 |
+
),
|
4644 |
+
31 => array(
|
4645 |
+
'var' => 'queryText',
|
4646 |
+
'type' => TType::STRING,
|
4647 |
+
),
|
4648 |
+
41 => array(
|
4649 |
+
'var' => 'suggestionsHitCount',
|
4650 |
+
'type' => TType::I32,
|
4651 |
+
),
|
4652 |
+
51 => array(
|
4653 |
+
'var' => 'highlight',
|
4654 |
+
'type' => TType::BOOL,
|
4655 |
+
),
|
4656 |
+
61 => array(
|
4657 |
+
'var' => 'highlightPre',
|
4658 |
+
'type' => TType::STRING,
|
4659 |
+
),
|
4660 |
+
71 => array(
|
4661 |
+
'var' => 'highlightPost',
|
4662 |
+
'type' => TType::STRING,
|
4663 |
+
),
|
4664 |
+
);
|
|
|
|
|
|
|
4665 |
}
|
4666 |
+
if (is_array($vals)) {
|
4667 |
+
if (isset($vals['indexId'])) {
|
4668 |
+
$this->indexId = $vals['indexId'];
|
4669 |
+
}
|
4670 |
+
if (isset($vals['language'])) {
|
4671 |
+
$this->language = $vals['language'];
|
4672 |
+
}
|
4673 |
+
if (isset($vals['queryText'])) {
|
4674 |
+
$this->queryText = $vals['queryText'];
|
4675 |
+
}
|
4676 |
+
if (isset($vals['suggestionsHitCount'])) {
|
4677 |
+
$this->suggestionsHitCount = $vals['suggestionsHitCount'];
|
4678 |
+
}
|
4679 |
+
if (isset($vals['highlight'])) {
|
4680 |
+
$this->highlight = $vals['highlight'];
|
4681 |
+
}
|
4682 |
+
if (isset($vals['highlightPre'])) {
|
4683 |
+
$this->highlightPre = $vals['highlightPre'];
|
4684 |
+
}
|
4685 |
+
if (isset($vals['highlightPost'])) {
|
4686 |
+
$this->highlightPost = $vals['highlightPost'];
|
4687 |
+
}
|
4688 |
}
|
4689 |
+
}
|
4690 |
+
|
4691 |
+
public function getName() {
|
4692 |
+
return 'AutocompleteQuery';
|
4693 |
+
}
|
4694 |
+
|
4695 |
+
public function read($input)
|
4696 |
+
{
|
4697 |
+
$xfer = 0;
|
4698 |
+
$fname = null;
|
4699 |
+
$ftype = 0;
|
4700 |
+
$fid = 0;
|
4701 |
+
$xfer += $input->readStructBegin($fname);
|
4702 |
+
while (true)
|
4703 |
{
|
4704 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
4705 |
+
if ($ftype == TType::STOP) {
|
4706 |
+
break;
|
4707 |
+
}
|
4708 |
+
switch ($fid)
|
4709 |
+
{
|
4710 |
+
case 11:
|
4711 |
+
if ($ftype == TType::STRING) {
|
4712 |
+
$xfer += $input->readString($this->indexId);
|
4713 |
+
} else {
|
4714 |
+
$xfer += $input->skip($ftype);
|
4715 |
+
}
|
4716 |
+
break;
|
4717 |
+
case 21:
|
4718 |
+
if ($ftype == TType::STRING) {
|
4719 |
+
$xfer += $input->readString($this->language);
|
4720 |
+
} else {
|
4721 |
+
$xfer += $input->skip($ftype);
|
4722 |
+
}
|
4723 |
+
break;
|
4724 |
+
case 31:
|
4725 |
+
if ($ftype == TType::STRING) {
|
4726 |
+
$xfer += $input->readString($this->queryText);
|
4727 |
+
} else {
|
4728 |
+
$xfer += $input->skip($ftype);
|
4729 |
+
}
|
4730 |
+
break;
|
4731 |
+
case 41:
|
4732 |
+
if ($ftype == TType::I32) {
|
4733 |
+
$xfer += $input->readI32($this->suggestionsHitCount);
|
4734 |
+
} else {
|
4735 |
+
$xfer += $input->skip($ftype);
|
4736 |
+
}
|
4737 |
+
break;
|
4738 |
+
case 51:
|
4739 |
+
if ($ftype == TType::BOOL) {
|
4740 |
+
$xfer += $input->readBool($this->highlight);
|
4741 |
+
} else {
|
4742 |
+
$xfer += $input->skip($ftype);
|
4743 |
+
}
|
4744 |
+
break;
|
4745 |
+
case 61:
|
4746 |
+
if ($ftype == TType::STRING) {
|
4747 |
+
$xfer += $input->readString($this->highlightPre);
|
4748 |
+
} else {
|
4749 |
+
$xfer += $input->skip($ftype);
|
4750 |
+
}
|
4751 |
+
break;
|
4752 |
+
case 71:
|
4753 |
+
if ($ftype == TType::STRING) {
|
4754 |
+
$xfer += $input->readString($this->highlightPost);
|
4755 |
+
} else {
|
4756 |
+
$xfer += $input->skip($ftype);
|
4757 |
+
}
|
4758 |
+
break;
|
4759 |
+
default:
|
4760 |
+
$xfer += $input->skip($ftype);
|
4761 |
+
break;
|
4762 |
+
}
|
4763 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4764 |
}
|
4765 |
+
$xfer += $input->readStructEnd();
|
4766 |
+
return $xfer;
|
4767 |
+
}
|
4768 |
+
|
4769 |
+
public function write($output) {
|
4770 |
+
$xfer = 0;
|
4771 |
+
$xfer += $output->writeStructBegin('AutocompleteQuery');
|
4772 |
+
if ($this->indexId !== null) {
|
4773 |
+
$xfer += $output->writeFieldBegin('indexId', TType::STRING, 11);
|
4774 |
+
$xfer += $output->writeString($this->indexId);
|
4775 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4776 |
}
|
4777 |
+
if ($this->language !== null) {
|
4778 |
+
$xfer += $output->writeFieldBegin('language', TType::STRING, 21);
|
4779 |
+
$xfer += $output->writeString($this->language);
|
4780 |
+
$xfer += $output->writeFieldEnd();
|
4781 |
+
}
|
4782 |
+
if ($this->queryText !== null) {
|
4783 |
+
$xfer += $output->writeFieldBegin('queryText', TType::STRING, 31);
|
4784 |
+
$xfer += $output->writeString($this->queryText);
|
4785 |
+
$xfer += $output->writeFieldEnd();
|
4786 |
+
}
|
4787 |
+
if ($this->suggestionsHitCount !== null) {
|
4788 |
+
$xfer += $output->writeFieldBegin('suggestionsHitCount', TType::I32, 41);
|
4789 |
+
$xfer += $output->writeI32($this->suggestionsHitCount);
|
4790 |
+
$xfer += $output->writeFieldEnd();
|
4791 |
+
}
|
4792 |
+
if ($this->highlight !== null) {
|
4793 |
+
$xfer += $output->writeFieldBegin('highlight', TType::BOOL, 51);
|
4794 |
+
$xfer += $output->writeBool($this->highlight);
|
4795 |
+
$xfer += $output->writeFieldEnd();
|
4796 |
+
}
|
4797 |
+
if ($this->highlightPre !== null) {
|
4798 |
+
$xfer += $output->writeFieldBegin('highlightPre', TType::STRING, 61);
|
4799 |
+
$xfer += $output->writeString($this->highlightPre);
|
4800 |
+
$xfer += $output->writeFieldEnd();
|
4801 |
+
}
|
4802 |
+
if ($this->highlightPost !== null) {
|
4803 |
+
$xfer += $output->writeFieldBegin('highlightPost', TType::STRING, 71);
|
4804 |
+
$xfer += $output->writeString($this->highlightPost);
|
4805 |
+
$xfer += $output->writeFieldEnd();
|
4806 |
+
}
|
4807 |
+
$xfer += $output->writeFieldStop();
|
4808 |
+
$xfer += $output->writeStructEnd();
|
4809 |
+
return $xfer;
|
4810 |
+
}
|
4811 |
|
4812 |
}
|
4813 |
|
4814 |
class AutocompleteRequest {
|
4815 |
+
static $_TSPEC;
|
4816 |
+
|
4817 |
+
/**
|
4818 |
+
* @var \com\boxalino\p13n\api\thrift\UserRecord
|
4819 |
+
*/
|
4820 |
+
public $userRecord = null;
|
4821 |
+
/**
|
4822 |
+
* @var string
|
4823 |
+
*/
|
4824 |
+
public $scope = "system_rec";
|
4825 |
+
/**
|
4826 |
+
* @var string
|
4827 |
+
*/
|
4828 |
+
public $choiceId = null;
|
4829 |
+
/**
|
4830 |
+
* @var string
|
4831 |
+
*/
|
4832 |
+
public $profileId = null;
|
4833 |
+
/**
|
4834 |
+
* @var \com\boxalino\p13n\api\thrift\RequestContext
|
4835 |
+
*/
|
4836 |
+
public $requestContext = null;
|
4837 |
+
/**
|
4838 |
+
* @var string[]
|
4839 |
+
*/
|
4840 |
+
public $excludeVariantIds = null;
|
4841 |
+
/**
|
4842 |
+
* @var \com\boxalino\p13n\api\thrift\AutocompleteQuery
|
4843 |
+
*/
|
4844 |
+
public $autocompleteQuery = null;
|
4845 |
+
/**
|
4846 |
+
* @var string
|
4847 |
+
*/
|
4848 |
+
public $searchChoiceId = null;
|
4849 |
+
/**
|
4850 |
+
* @var \com\boxalino\p13n\api\thrift\SimpleSearchQuery
|
4851 |
+
*/
|
4852 |
+
public $searchQuery = null;
|
4853 |
+
|
4854 |
+
public function __construct($vals=null) {
|
4855 |
+
if (!isset(self::$_TSPEC)) {
|
4856 |
+
self::$_TSPEC = array(
|
4857 |
+
11 => array(
|
4858 |
+
'var' => 'userRecord',
|
4859 |
+
'type' => TType::STRUCT,
|
4860 |
+
'class' => '\com\boxalino\p13n\api\thrift\UserRecord',
|
4861 |
+
),
|
4862 |
+
21 => array(
|
4863 |
+
'var' => 'scope',
|
4864 |
+
'type' => TType::STRING,
|
4865 |
+
),
|
4866 |
+
31 => array(
|
4867 |
+
'var' => 'choiceId',
|
4868 |
+
'type' => TType::STRING,
|
4869 |
+
),
|
4870 |
+
41 => array(
|
4871 |
+
'var' => 'profileId',
|
4872 |
+
'type' => TType::STRING,
|
4873 |
+
),
|
4874 |
+
51 => array(
|
4875 |
+
'var' => 'requestContext',
|
4876 |
+
'type' => TType::STRUCT,
|
4877 |
+
'class' => '\com\boxalino\p13n\api\thrift\RequestContext',
|
4878 |
+
),
|
4879 |
+
61 => array(
|
4880 |
+
'var' => 'excludeVariantIds',
|
4881 |
+
'type' => TType::SET,
|
4882 |
+
'etype' => TType::STRING,
|
4883 |
+
'elem' => array(
|
4884 |
+
'type' => TType::STRING,
|
4885 |
+
),
|
4886 |
+
),
|
4887 |
+
71 => array(
|
4888 |
+
'var' => 'autocompleteQuery',
|
4889 |
+
'type' => TType::STRUCT,
|
4890 |
+
'class' => '\com\boxalino\p13n\api\thrift\AutocompleteQuery',
|
4891 |
+
),
|
4892 |
+
81 => array(
|
4893 |
+
'var' => 'searchChoiceId',
|
4894 |
+
'type' => TType::STRING,
|
4895 |
+
),
|
4896 |
+
91 => array(
|
4897 |
+
'var' => 'searchQuery',
|
4898 |
+
'type' => TType::STRUCT,
|
4899 |
+
'class' => '\com\boxalino\p13n\api\thrift\SimpleSearchQuery',
|
4900 |
+
),
|
4901 |
+
);
|
|
|
|
|
|
|
4902 |
}
|
4903 |
+
if (is_array($vals)) {
|
4904 |
+
if (isset($vals['userRecord'])) {
|
4905 |
+
$this->userRecord = $vals['userRecord'];
|
4906 |
+
}
|
4907 |
+
if (isset($vals['scope'])) {
|
4908 |
+
$this->scope = $vals['scope'];
|
4909 |
+
}
|
4910 |
+
if (isset($vals['choiceId'])) {
|
4911 |
+
$this->choiceId = $vals['choiceId'];
|
4912 |
+
}
|
4913 |
+
if (isset($vals['profileId'])) {
|
4914 |
+
$this->profileId = $vals['profileId'];
|
4915 |
+
}
|
4916 |
+
if (isset($vals['requestContext'])) {
|
4917 |
+
$this->requestContext = $vals['requestContext'];
|
4918 |
+
}
|
4919 |
+
if (isset($vals['excludeVariantIds'])) {
|
4920 |
+
$this->excludeVariantIds = $vals['excludeVariantIds'];
|
4921 |
+
}
|
4922 |
+
if (isset($vals['autocompleteQuery'])) {
|
4923 |
+
$this->autocompleteQuery = $vals['autocompleteQuery'];
|
4924 |
+
}
|
4925 |
+
if (isset($vals['searchChoiceId'])) {
|
4926 |
+
$this->searchChoiceId = $vals['searchChoiceId'];
|
4927 |
+
}
|
4928 |
+
if (isset($vals['searchQuery'])) {
|
4929 |
+
$this->searchQuery = $vals['searchQuery'];
|
4930 |
+
}
|
4931 |
}
|
4932 |
+
}
|
4933 |
+
|
4934 |
+
public function getName() {
|
4935 |
+
return 'AutocompleteRequest';
|
4936 |
+
}
|
4937 |
+
|
4938 |
+
public function read($input)
|
4939 |
+
{
|
4940 |
+
$xfer = 0;
|
4941 |
+
$fname = null;
|
4942 |
+
$ftype = 0;
|
4943 |
+
$fid = 0;
|
4944 |
+
$xfer += $input->readStructBegin($fname);
|
4945 |
+
while (true)
|
4946 |
{
|
4947 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
4948 |
+
if ($ftype == TType::STOP) {
|
4949 |
+
break;
|
4950 |
+
}
|
4951 |
+
switch ($fid)
|
4952 |
+
{
|
4953 |
+
case 11:
|
4954 |
+
if ($ftype == TType::STRUCT) {
|
4955 |
+
$this->userRecord = new \com\boxalino\p13n\api\thrift\UserRecord();
|
4956 |
+
$xfer += $this->userRecord->read($input);
|
4957 |
+
} else {
|
4958 |
+
$xfer += $input->skip($ftype);
|
4959 |
+
}
|
4960 |
+
break;
|
4961 |
+
case 21:
|
4962 |
+
if ($ftype == TType::STRING) {
|
4963 |
+
$xfer += $input->readString($this->scope);
|
4964 |
+
} else {
|
4965 |
+
$xfer += $input->skip($ftype);
|
4966 |
+
}
|
4967 |
+
break;
|
4968 |
+
case 31:
|
4969 |
+
if ($ftype == TType::STRING) {
|
4970 |
+
$xfer += $input->readString($this->choiceId);
|
4971 |
+
} else {
|
4972 |
+
$xfer += $input->skip($ftype);
|
4973 |
+
}
|
4974 |
+
break;
|
4975 |
+
case 41:
|
4976 |
+
if ($ftype == TType::STRING) {
|
4977 |
+
$xfer += $input->readString($this->profileId);
|
4978 |
+
} else {
|
4979 |
+
$xfer += $input->skip($ftype);
|
4980 |
+
}
|
4981 |
+
break;
|
4982 |
+
case 51:
|
4983 |
+
if ($ftype == TType::STRUCT) {
|
4984 |
+
$this->requestContext = new \com\boxalino\p13n\api\thrift\RequestContext();
|
4985 |
+
$xfer += $this->requestContext->read($input);
|
4986 |
+
} else {
|
4987 |
+
$xfer += $input->skip($ftype);
|
4988 |
+
}
|
4989 |
+
break;
|
4990 |
+
case 61:
|
4991 |
+
if ($ftype == TType::SET) {
|
4992 |
+
$this->excludeVariantIds = array();
|
4993 |
+
$_size208 = 0;
|
4994 |
+
$_etype211 = 0;
|
4995 |
+
$xfer += $input->readSetBegin($_etype211, $_size208);
|
4996 |
+
for ($_i212 = 0; $_i212 < $_size208; ++$_i212)
|
4997 |
{
|
4998 |
+
$elem213 = null;
|
4999 |
+
$xfer += $input->readString($elem213);
|
5000 |
+
if (is_scalar($elem213)) {
|
5001 |
+
$this->excludeVariantIds[$elem213] = true;
|
5002 |
+
} else {
|
5003 |
+
$this->excludeVariantIds []= $elem213;
|
5004 |
+
}
|
5005 |
+
}
|
5006 |
+
$xfer += $input->readSetEnd();
|
5007 |
+
} else {
|
5008 |
+
$xfer += $input->skip($ftype);
|
5009 |
+
}
|
5010 |
+
break;
|
5011 |
+
case 71:
|
5012 |
+
if ($ftype == TType::STRUCT) {
|
5013 |
+
$this->autocompleteQuery = new \com\boxalino\p13n\api\thrift\AutocompleteQuery();
|
5014 |
+
$xfer += $this->autocompleteQuery->read($input);
|
5015 |
+
} else {
|
5016 |
+
$xfer += $input->skip($ftype);
|
5017 |
+
}
|
5018 |
+
break;
|
5019 |
+
case 81:
|
5020 |
+
if ($ftype == TType::STRING) {
|
5021 |
+
$xfer += $input->readString($this->searchChoiceId);
|
5022 |
+
} else {
|
5023 |
+
$xfer += $input->skip($ftype);
|
5024 |
+
}
|
5025 |
+
break;
|
5026 |
+
case 91:
|
5027 |
+
if ($ftype == TType::STRUCT) {
|
5028 |
+
$this->searchQuery = new \com\boxalino\p13n\api\thrift\SimpleSearchQuery();
|
5029 |
+
$xfer += $this->searchQuery->read($input);
|
5030 |
+
} else {
|
5031 |
+
$xfer += $input->skip($ftype);
|
5032 |
+
}
|
5033 |
+
break;
|
5034 |
+
default:
|
5035 |
+
$xfer += $input->skip($ftype);
|
5036 |
+
break;
|
5037 |
+
}
|
5038 |
+
$xfer += $input->readFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5039 |
}
|
5040 |
+
$xfer += $input->readStructEnd();
|
5041 |
+
return $xfer;
|
5042 |
+
}
|
5043 |
+
|
5044 |
+
public function write($output) {
|
5045 |
+
$xfer = 0;
|
5046 |
+
$xfer += $output->writeStructBegin('AutocompleteRequest');
|
5047 |
+
if ($this->userRecord !== null) {
|
5048 |
+
if (!is_object($this->userRecord)) {
|
5049 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
5050 |
+
}
|
5051 |
+
$xfer += $output->writeFieldBegin('userRecord', TType::STRUCT, 11);
|
5052 |
+
$xfer += $this->userRecord->write($output);
|
5053 |
+
$xfer += $output->writeFieldEnd();
|
5054 |
+
}
|
5055 |
+
if ($this->scope !== null) {
|
5056 |
+
$xfer += $output->writeFieldBegin('scope', TType::STRING, 21);
|
5057 |
+
$xfer += $output->writeString($this->scope);
|
5058 |
+
$xfer += $output->writeFieldEnd();
|
5059 |
+
}
|
5060 |
+
if ($this->choiceId !== null) {
|
5061 |
+
$xfer += $output->writeFieldBegin('choiceId', TType::STRING, 31);
|
5062 |
+
$xfer += $output->writeString($this->choiceId);
|
5063 |
+
$xfer += $output->writeFieldEnd();
|
5064 |
+
}
|
5065 |
+
if ($this->profileId !== null) {
|
5066 |
+
$xfer += $output->writeFieldBegin('profileId', TType::STRING, 41);
|
5067 |
+
$xfer += $output->writeString($this->profileId);
|
5068 |
+
$xfer += $output->writeFieldEnd();
|
5069 |
+
}
|
5070 |
+
if ($this->requestContext !== null) {
|
5071 |
+
if (!is_object($this->requestContext)) {
|
5072 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
5073 |
+
}
|
5074 |
+
$xfer += $output->writeFieldBegin('requestContext', TType::STRUCT, 51);
|
5075 |
+
$xfer += $this->requestContext->write($output);
|
5076 |
+
$xfer += $output->writeFieldEnd();
|
5077 |
+
}
|
5078 |
+
if ($this->excludeVariantIds !== null) {
|
5079 |
+
if (!is_array($this->excludeVariantIds)) {
|
5080 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
5081 |
+
}
|
5082 |
+
$xfer += $output->writeFieldBegin('excludeVariantIds', TType::SET, 61);
|
5083 |
+
{
|
5084 |
+
$output->writeSetBegin(TType::STRING, count($this->excludeVariantIds));
|
5085 |
+
{
|
5086 |
+
foreach ($this->excludeVariantIds as $iter214 => $iter215)
|
5087 |
+
{
|
5088 |
+
if (is_scalar($iter215)) {
|
5089 |
+
$xfer += $output->writeString($iter214);
|
5090 |
+
} else {
|
5091 |
+
$xfer += $output->writeString($iter215);
|
5092 |
+
}
|
5093 |
+
}
|
5094 |
+
}
|
5095 |
+
$output->writeSetEnd();
|
5096 |
+
}
|
5097 |
+
$xfer += $output->writeFieldEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5098 |
}
|
5099 |
+
if ($this->autocompleteQuery !== null) {
|
5100 |
+
if (!is_object($this->autocompleteQuery)) {
|
5101 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
5102 |
+
}
|
5103 |
+
$xfer += $output->writeFieldBegin('autocompleteQuery', TType::STRUCT, 71);
|
5104 |
+
$xfer += $this->autocompleteQuery->write($output);
|
5105 |
+
$xfer += $output->writeFieldEnd();
|
5106 |
+
}
|
5107 |
+
if ($this->searchChoiceId !== null) {
|
5108 |
+
$xfer += $output->writeFieldBegin('searchChoiceId', TType::STRING, 81);
|
5109 |
+
$xfer += $output->writeString($this->searchChoiceId);
|
5110 |
+
$xfer += $output->writeFieldEnd();
|
5111 |
+
}
|
5112 |
+
if ($this->searchQuery !== null) {
|
5113 |
+
if (!is_object($this->searchQuery)) {
|
5114 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
5115 |
+
}
|
5116 |
+
$xfer += $output->writeFieldBegin('searchQuery', TType::STRUCT, 91);
|
5117 |
+
$xfer += $this->searchQuery->write($output);
|
5118 |
+
$xfer += $output->writeFieldEnd();
|
5119 |
+
}
|
5120 |
+
$xfer += $output->writeFieldStop();
|
5121 |
+
$xfer += $output->writeStructEnd();
|
5122 |
+
return $xfer;
|
5123 |
+
}
|
5124 |
|
5125 |
}
|
5126 |
|
5127 |
class AutocompleteResponse {
|
5128 |
+
static $_TSPEC;
|
5129 |
+
|
5130 |
+
/**
|
5131 |
+
* @var \com\boxalino\p13n\api\thrift\AutocompleteHit[]
|
5132 |
+
*/
|
5133 |
+
public $hits = null;
|
5134 |
+
/**
|
5135 |
+
* @var \com\boxalino\p13n\api\thrift\SearchResult
|
5136 |
+
*/
|
5137 |
+
public $prefixSearchResult = null;
|
5138 |
+
|
5139 |
+
public function __construct($vals=null) {
|
5140 |
+
if (!isset(self::$_TSPEC)) {
|
5141 |
+
self::$_TSPEC = array(
|
5142 |
+
11 => array(
|
5143 |
+
'var' => 'hits',
|
5144 |
+
'type' => TType::LST,
|
5145 |
+
'etype' => TType::STRUCT,
|
5146 |
+
'elem' => array(
|
5147 |
+
'type' => TType::STRUCT,
|
5148 |
+
'class' => '\com\boxalino\p13n\api\thrift\AutocompleteHit',
|
5149 |
+
),
|
5150 |
+
),
|
5151 |
+
21 => array(
|
5152 |
+
'var' => 'prefixSearchResult',
|
5153 |
+
'type' => TType::STRUCT,
|
5154 |
+
'class' => '\com\boxalino\p13n\api\thrift\SearchResult',
|
5155 |
+
),
|
5156 |
+
);
|
|
|
|
|
|
|
5157 |
}
|
5158 |
+
if (is_array($vals)) {
|
5159 |
+
if (isset($vals['hits'])) {
|
5160 |
+
$this->hits = $vals['hits'];
|
5161 |
+
}
|
5162 |
+
if (isset($vals['prefixSearchResult'])) {
|
5163 |
+
$this->prefixSearchResult = $vals['prefixSearchResult'];
|
5164 |
+
}
|
5165 |
}
|
5166 |
+
}
|
5167 |
+
|
5168 |
+
public function getName() {
|
5169 |
+
return 'AutocompleteResponse';
|
5170 |
+
}
|
5171 |
+
|
5172 |
+
public function read($input)
|
5173 |
+
{
|
5174 |
+
$xfer = 0;
|
5175 |
+
$fname = null;
|
5176 |
+
$ftype = 0;
|
5177 |
+
$fid = 0;
|
5178 |
+
$xfer += $input->readStructBegin($fname);
|
5179 |
+
while (true)
|
5180 |
{
|
5181 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
5182 |
+
if ($ftype == TType::STOP) {
|
5183 |
+
break;
|
5184 |
+
}
|
5185 |
+
switch ($fid)
|
5186 |
+
{
|
5187 |
+
case 11:
|
5188 |
+
if ($ftype == TType::LST) {
|
5189 |
+
$this->hits = array();
|
5190 |
+
$_size216 = 0;
|
5191 |
+
$_etype219 = 0;
|
5192 |
+
$xfer += $input->readListBegin($_etype219, $_size216);
|
5193 |
+
for ($_i220 = 0; $_i220 < $_size216; ++$_i220)
|
5194 |
{
|
5195 |
+
$elem221 = null;
|
5196 |
+
$elem221 = new \com\boxalino\p13n\api\thrift\AutocompleteHit();
|
5197 |
+
$xfer += $elem221->read($input);
|
5198 |
+
$this->hits []= $elem221;
|
5199 |
+
}
|
5200 |
+
$xfer += $input->readListEnd();
|
5201 |
+
} else {
|
5202 |
+
$xfer += $input->skip($ftype);
|
5203 |
+
}
|
5204 |
+
break;
|
5205 |
+
case 21:
|
5206 |
+
if ($ftype == TType::STRUCT) {
|
5207 |
+
$this->prefixSearchResult = new \com\boxalino\p13n\api\thrift\SearchResult();
|
5208 |
+
$xfer += $this->prefixSearchResult->read($input);
|
5209 |
+
} else {
|
5210 |
+
$xfer += $input->skip($ftype);
|
5211 |
+
}
|
5212 |
+
break;
|
5213 |
+
default:
|
5214 |
+
$xfer += $input->skip($ftype);
|
5215 |
+
break;
|
5216 |
+
}
|
5217 |
+
$xfer += $input->readFieldEnd();
|
5218 |
+
}
|
5219 |
+
$xfer += $input->readStructEnd();
|
5220 |
+
return $xfer;
|
5221 |
+
}
|
5222 |
+
|
5223 |
+
public function write($output) {
|
5224 |
+
$xfer = 0;
|
5225 |
+
$xfer += $output->writeStructBegin('AutocompleteResponse');
|
5226 |
+
if ($this->hits !== null) {
|
5227 |
+
if (!is_array($this->hits)) {
|
5228 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
5229 |
+
}
|
5230 |
+
$xfer += $output->writeFieldBegin('hits', TType::LST, 11);
|
5231 |
+
{
|
5232 |
+
$output->writeListBegin(TType::STRUCT, count($this->hits));
|
5233 |
+
{
|
5234 |
+
foreach ($this->hits as $iter222)
|
5235 |
+
{
|
5236 |
+
$xfer += $iter222->write($output);
|
5237 |
+
}
|
5238 |
+
}
|
5239 |
+
$output->writeListEnd();
|
5240 |
+
}
|
5241 |
+
$xfer += $output->writeFieldEnd();
|
5242 |
+
}
|
5243 |
+
if ($this->prefixSearchResult !== null) {
|
5244 |
+
if (!is_object($this->prefixSearchResult)) {
|
5245 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
5246 |
+
}
|
5247 |
+
$xfer += $output->writeFieldBegin('prefixSearchResult', TType::STRUCT, 21);
|
5248 |
+
$xfer += $this->prefixSearchResult->write($output);
|
5249 |
+
$xfer += $output->writeFieldEnd();
|
5250 |
}
|
5251 |
+
$xfer += $output->writeFieldStop();
|
5252 |
+
$xfer += $output->writeStructEnd();
|
5253 |
+
return $xfer;
|
5254 |
+
}
|
5255 |
|
5256 |
+
}
|
5257 |
+
|
5258 |
+
/**
|
5259 |
+
* Request object for changing the choice, that is changing possible variants
|
5260 |
+
* or their random distribution
|
5261 |
+
*/
|
5262 |
+
class ChoiceUpdateRequest {
|
5263 |
+
static $_TSPEC;
|
5264 |
+
|
5265 |
+
/**
|
5266 |
+
* user record identifying the client
|
5267 |
+
*
|
5268 |
+
* @var \com\boxalino\p13n\api\thrift\UserRecord
|
5269 |
+
*/
|
5270 |
+
public $userRecord = null;
|
5271 |
+
/**
|
5272 |
+
* Identifier of the choice to be changed. If it is not given, a new choice will be created
|
5273 |
+
*
|
5274 |
+
* @var string
|
5275 |
+
*/
|
5276 |
+
public $choiceId = null;
|
5277 |
+
/**
|
5278 |
+
* Map containing variant identifier and corresponding positive integer weight.
|
5279 |
+
* If for a choice there is no learned rule which can be applied, weights of
|
5280 |
+
* variants will be used for variants random distribution.
|
5281 |
+
* Higher weight makes corresponding variant more probable.
|
5282 |
+
*
|
5283 |
+
* @var array
|
5284 |
+
*/
|
5285 |
+
public $variantIds = null;
|
5286 |
+
|
5287 |
+
public function __construct($vals=null) {
|
5288 |
+
if (!isset(self::$_TSPEC)) {
|
5289 |
+
self::$_TSPEC = array(
|
5290 |
+
11 => array(
|
5291 |
+
'var' => 'userRecord',
|
5292 |
+
'type' => TType::STRUCT,
|
5293 |
+
'class' => '\com\boxalino\p13n\api\thrift\UserRecord',
|
5294 |
+
),
|
5295 |
+
21 => array(
|
5296 |
+
'var' => 'choiceId',
|
5297 |
+
'type' => TType::STRING,
|
5298 |
+
),
|
5299 |
+
31 => array(
|
5300 |
+
'var' => 'variantIds',
|
5301 |
+
'type' => TType::MAP,
|
5302 |
+
'ktype' => TType::STRING,
|
5303 |
+
'vtype' => TType::I32,
|
5304 |
+
'key' => array(
|
5305 |
+
'type' => TType::STRING,
|
5306 |
+
),
|
5307 |
+
'val' => array(
|
5308 |
+
'type' => TType::I32,
|
5309 |
+
),
|
5310 |
+
),
|
5311 |
+
);
|
5312 |
+
}
|
5313 |
+
if (is_array($vals)) {
|
5314 |
+
if (isset($vals['userRecord'])) {
|
5315 |
+
$this->userRecord = $vals['userRecord'];
|
5316 |
+
}
|
5317 |
+
if (isset($vals['choiceId'])) {
|
5318 |
+
$this->choiceId = $vals['choiceId'];
|
5319 |
+
}
|
5320 |
+
if (isset($vals['variantIds'])) {
|
5321 |
+
$this->variantIds = $vals['variantIds'];
|
5322 |
+
}
|
5323 |
+
}
|
5324 |
+
}
|
5325 |
+
|
5326 |
+
public function getName() {
|
5327 |
+
return 'ChoiceUpdateRequest';
|
5328 |
+
}
|
5329 |
+
|
5330 |
+
public function read($input)
|
5331 |
+
{
|
5332 |
+
$xfer = 0;
|
5333 |
+
$fname = null;
|
5334 |
+
$ftype = 0;
|
5335 |
+
$fid = 0;
|
5336 |
+
$xfer += $input->readStructBegin($fname);
|
5337 |
+
while (true)
|
5338 |
+
{
|
5339 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
5340 |
+
if ($ftype == TType::STOP) {
|
5341 |
+
break;
|
5342 |
+
}
|
5343 |
+
switch ($fid)
|
5344 |
+
{
|
5345 |
+
case 11:
|
5346 |
+
if ($ftype == TType::STRUCT) {
|
5347 |
+
$this->userRecord = new \com\boxalino\p13n\api\thrift\UserRecord();
|
5348 |
+
$xfer += $this->userRecord->read($input);
|
5349 |
+
} else {
|
5350 |
+
$xfer += $input->skip($ftype);
|
5351 |
+
}
|
5352 |
+
break;
|
5353 |
+
case 21:
|
5354 |
+
if ($ftype == TType::STRING) {
|
5355 |
+
$xfer += $input->readString($this->choiceId);
|
5356 |
+
} else {
|
5357 |
+
$xfer += $input->skip($ftype);
|
5358 |
+
}
|
5359 |
+
break;
|
5360 |
+
case 31:
|
5361 |
+
if ($ftype == TType::MAP) {
|
5362 |
+
$this->variantIds = array();
|
5363 |
+
$_size223 = 0;
|
5364 |
+
$_ktype224 = 0;
|
5365 |
+
$_vtype225 = 0;
|
5366 |
+
$xfer += $input->readMapBegin($_ktype224, $_vtype225, $_size223);
|
5367 |
+
for ($_i227 = 0; $_i227 < $_size223; ++$_i227)
|
5368 |
{
|
5369 |
+
$key228 = '';
|
5370 |
+
$val229 = 0;
|
5371 |
+
$xfer += $input->readString($key228);
|
5372 |
+
$xfer += $input->readI32($val229);
|
5373 |
+
$this->variantIds[$key228] = $val229;
|
5374 |
+
}
|
5375 |
+
$xfer += $input->readMapEnd();
|
5376 |
+
} else {
|
5377 |
+
$xfer += $input->skip($ftype);
|
5378 |
+
}
|
5379 |
+
break;
|
5380 |
+
default:
|
5381 |
+
$xfer += $input->skip($ftype);
|
5382 |
+
break;
|
5383 |
+
}
|
5384 |
+
$xfer += $input->readFieldEnd();
|
5385 |
+
}
|
5386 |
+
$xfer += $input->readStructEnd();
|
5387 |
+
return $xfer;
|
5388 |
+
}
|
5389 |
+
|
5390 |
+
public function write($output) {
|
5391 |
+
$xfer = 0;
|
5392 |
+
$xfer += $output->writeStructBegin('ChoiceUpdateRequest');
|
5393 |
+
if ($this->userRecord !== null) {
|
5394 |
+
if (!is_object($this->userRecord)) {
|
5395 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
5396 |
+
}
|
5397 |
+
$xfer += $output->writeFieldBegin('userRecord', TType::STRUCT, 11);
|
5398 |
+
$xfer += $this->userRecord->write($output);
|
5399 |
+
$xfer += $output->writeFieldEnd();
|
5400 |
+
}
|
5401 |
+
if ($this->choiceId !== null) {
|
5402 |
+
$xfer += $output->writeFieldBegin('choiceId', TType::STRING, 21);
|
5403 |
+
$xfer += $output->writeString($this->choiceId);
|
5404 |
+
$xfer += $output->writeFieldEnd();
|
5405 |
}
|
5406 |
+
if ($this->variantIds !== null) {
|
5407 |
+
if (!is_array($this->variantIds)) {
|
5408 |
+
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
|
5409 |
+
}
|
5410 |
+
$xfer += $output->writeFieldBegin('variantIds', TType::MAP, 31);
|
5411 |
+
{
|
5412 |
+
$output->writeMapBegin(TType::STRING, TType::I32, count($this->variantIds));
|
5413 |
+
{
|
5414 |
+
foreach ($this->variantIds as $kiter230 => $viter231)
|
5415 |
+
{
|
5416 |
+
$xfer += $output->writeString($kiter230);
|
5417 |
+
$xfer += $output->writeI32($viter231);
|
5418 |
+
}
|
5419 |
+
}
|
5420 |
+
$output->writeMapEnd();
|
5421 |
+
}
|
5422 |
+
$xfer += $output->writeFieldEnd();
|
5423 |
+
}
|
5424 |
+
$xfer += $output->writeFieldStop();
|
5425 |
+
$xfer += $output->writeStructEnd();
|
5426 |
+
return $xfer;
|
5427 |
+
}
|
5428 |
|
5429 |
}
|
5430 |
|
5431 |
+
/**
|
5432 |
+
* Server response for one ChoiceUpdateRequest
|
5433 |
+
*/
|
5434 |
+
class ChoiceUpdateResponse {
|
5435 |
+
static $_TSPEC;
|
5436 |
+
|
5437 |
+
/**
|
5438 |
+
* Identifier of the changed choice. If no id is given in corresponding
|
5439 |
+
* ChoiceUpdateRequest, new choice (and new id) will be created and retuned.
|
5440 |
+
*
|
5441 |
+
* @var string
|
5442 |
+
*/
|
5443 |
+
public $choiceId = null;
|
5444 |
+
|
5445 |
+
public function __construct($vals=null) {
|
5446 |
+
if (!isset(self::$_TSPEC)) {
|
5447 |
+
self::$_TSPEC = array(
|
5448 |
+
11 => array(
|
5449 |
+
'var' => 'choiceId',
|
5450 |
+
'type' => TType::STRING,
|
5451 |
+
),
|
5452 |
+
);
|
5453 |
}
|
5454 |
+
if (is_array($vals)) {
|
5455 |
+
if (isset($vals['choiceId'])) {
|
5456 |
+
$this->choiceId = $vals['choiceId'];
|
5457 |
+
}
|
5458 |
}
|
5459 |
+
}
|
5460 |
+
|
5461 |
+
public function getName() {
|
5462 |
+
return 'ChoiceUpdateResponse';
|
5463 |
+
}
|
5464 |
+
|
5465 |
+
public function read($input)
|
5466 |
+
{
|
5467 |
+
$xfer = 0;
|
5468 |
+
$fname = null;
|
5469 |
+
$ftype = 0;
|
5470 |
+
$fid = 0;
|
5471 |
+
$xfer += $input->readStructBegin($fname);
|
5472 |
+
while (true)
|
5473 |
{
|
5474 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
5475 |
+
if ($ftype == TType::STOP) {
|
5476 |
+
break;
|
5477 |
+
}
|
5478 |
+
switch ($fid)
|
5479 |
+
{
|
5480 |
+
case 11:
|
5481 |
+
if ($ftype == TType::STRING) {
|
5482 |
+
$xfer += $input->readString($this->choiceId);
|
5483 |
+
} else {
|
5484 |
+
$xfer += $input->skip($ftype);
|
5485 |
+
}
|
5486 |
+
break;
|
5487 |
+
default:
|
5488 |
+
$xfer += $input->skip($ftype);
|
5489 |
+
break;
|
5490 |
+
}
|
5491 |
+
$xfer += $input->readFieldEnd();
|
5492 |
+
}
|
5493 |
+
$xfer += $input->readStructEnd();
|
5494 |
+
return $xfer;
|
5495 |
+
}
|
5496 |
+
|
5497 |
+
public function write($output) {
|
5498 |
+
$xfer = 0;
|
5499 |
+
$xfer += $output->writeStructBegin('ChoiceUpdateResponse');
|
5500 |
+
if ($this->choiceId !== null) {
|
5501 |
+
$xfer += $output->writeFieldBegin('choiceId', TType::STRING, 11);
|
5502 |
+
$xfer += $output->writeString($this->choiceId);
|
5503 |
+
$xfer += $output->writeFieldEnd();
|
5504 |
}
|
5505 |
+
$xfer += $output->writeFieldStop();
|
5506 |
+
$xfer += $output->writeStructEnd();
|
5507 |
+
return $xfer;
|
5508 |
+
}
|
5509 |
|
5510 |
+
}
|
5511 |
+
|
5512 |
+
class P13nServiceException extends TException {
|
5513 |
+
static $_TSPEC;
|
5514 |
+
|
5515 |
+
/**
|
5516 |
+
* @var string
|
5517 |
+
*/
|
5518 |
+
public $message = null;
|
5519 |
+
|
5520 |
+
public function __construct($vals=null) {
|
5521 |
+
if (!isset(self::$_TSPEC)) {
|
5522 |
+
self::$_TSPEC = array(
|
5523 |
+
1 => array(
|
5524 |
+
'var' => 'message',
|
5525 |
+
'type' => TType::STRING,
|
5526 |
+
),
|
5527 |
+
);
|
5528 |
+
}
|
5529 |
+
if (is_array($vals)) {
|
5530 |
+
if (isset($vals['message'])) {
|
5531 |
+
$this->message = $vals['message'];
|
5532 |
+
}
|
5533 |
+
}
|
5534 |
+
}
|
5535 |
+
|
5536 |
+
public function getName() {
|
5537 |
+
return 'P13nServiceException';
|
5538 |
+
}
|
5539 |
+
|
5540 |
+
public function read($input)
|
5541 |
+
{
|
5542 |
+
$xfer = 0;
|
5543 |
+
$fname = null;
|
5544 |
+
$ftype = 0;
|
5545 |
+
$fid = 0;
|
5546 |
+
$xfer += $input->readStructBegin($fname);
|
5547 |
+
while (true)
|
5548 |
+
{
|
5549 |
+
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
5550 |
+
if ($ftype == TType::STOP) {
|
5551 |
+
break;
|
5552 |
+
}
|
5553 |
+
switch ($fid)
|
5554 |
+
{
|
5555 |
+
case 1:
|
5556 |
+
if ($ftype == TType::STRING) {
|
5557 |
+
$xfer += $input->readString($this->message);
|
5558 |
+
} else {
|
5559 |
+
$xfer += $input->skip($ftype);
|
5560 |
+
}
|
5561 |
+
break;
|
5562 |
+
default:
|
5563 |
+
$xfer += $input->skip($ftype);
|
5564 |
+
break;
|
5565 |
+
}
|
5566 |
+
$xfer += $input->readFieldEnd();
|
5567 |
+
}
|
5568 |
+
$xfer += $input->readStructEnd();
|
5569 |
+
return $xfer;
|
5570 |
+
}
|
5571 |
+
|
5572 |
+
public function write($output) {
|
5573 |
+
$xfer = 0;
|
5574 |
+
$xfer += $output->writeStructBegin('P13nServiceException');
|
5575 |
+
if ($this->message !== null) {
|
5576 |
+
$xfer += $output->writeFieldBegin('message', TType::STRING, 1);
|
5577 |
+
$xfer += $output->writeString($this->message);
|
5578 |
+
$xfer += $output->writeFieldEnd();
|
5579 |
}
|
5580 |
+
$xfer += $output->writeFieldStop();
|
5581 |
+
$xfer += $output->writeStructEnd();
|
5582 |
+
return $xfer;
|
5583 |
+
}
|
5584 |
|
5585 |
}
|
5586 |
|
app/code/local/Boxalino/CemSearch/Lib/vendor/Thrift/HttpP13n.php
CHANGED
@@ -158,6 +158,13 @@ class HttpP13n
|
|
158 |
'User-URL' => array($this->getCurrentURL())
|
159 |
);
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
return $requestContext;
|
162 |
}
|
163 |
|
@@ -236,7 +243,7 @@ class HttpP13n
|
|
236 |
* @param \com\boxalino\p13n\api\thrift\AutocompleteRequest|\com\boxalino\p13n\api\thrift\ChoiceRequest|\com\boxalino\p13n\api\thrift\BatchChoiceRequest $request
|
237 |
* @return \com\boxalino\p13n\api\thrift\AutocompleteRequest|\com\boxalino\p13n\api\thrift\ChoiceRequest|\com\boxalino\p13n\api\thrift\BatchChoiceRequest
|
238 |
*/
|
239 |
-
|
240 |
{
|
241 |
if (
|
242 |
$request instanceof \com\boxalino\p13n\api\thrift\AutocompleteRequest ||
|
158 |
'User-URL' => array($this->getCurrentURL())
|
159 |
);
|
160 |
|
161 |
+
if (isset($_REQUEST['p13nRequestContext']) && is_array($_REQUEST['p13nRequestContext'])) {
|
162 |
+
$requestContext->parameters = array_merge(
|
163 |
+
$_REQUEST['p13nRequestContext'],
|
164 |
+
$requestContext->parameters
|
165 |
+
);
|
166 |
+
}
|
167 |
+
|
168 |
return $requestContext;
|
169 |
}
|
170 |
|
243 |
* @param \com\boxalino\p13n\api\thrift\AutocompleteRequest|\com\boxalino\p13n\api\thrift\ChoiceRequest|\com\boxalino\p13n\api\thrift\BatchChoiceRequest $request
|
244 |
* @return \com\boxalino\p13n\api\thrift\AutocompleteRequest|\com\boxalino\p13n\api\thrift\ChoiceRequest|\com\boxalino\p13n\api\thrift\BatchChoiceRequest
|
245 |
*/
|
246 |
+
public function addRequestContext($request)
|
247 |
{
|
248 |
if (
|
249 |
$request instanceof \com\boxalino\p13n\api\thrift\AutocompleteRequest ||
|
app/code/local/Boxalino/CemSearch/Lib/vendor/Thrift/Protocol/TCompactProtocol.php
CHANGED
@@ -335,7 +335,7 @@ class TCompactProtocol extends TProtocol {
|
|
335 |
$field_id = $this->lastFid + $delta;
|
336 |
}
|
337 |
$this->lastFid = $field_id;
|
338 |
-
|
339 |
if ($field_type == TCompactProtocol::COMPACT_TRUE) {
|
340 |
$this->state = TCompactProtocol::STATE_BOOL_READ;
|
341 |
$this->boolValue = true;
|
@@ -345,6 +345,7 @@ class TCompactProtocol extends TProtocol {
|
|
345 |
} else {
|
346 |
$this->state = TCompactProtocol::STATE_VALUE_READ;
|
347 |
}
|
|
|
348 |
return $result;
|
349 |
}
|
350 |
|
335 |
$field_id = $this->lastFid + $delta;
|
336 |
}
|
337 |
$this->lastFid = $field_id;
|
338 |
+
$field_type &= 0x0f;
|
339 |
if ($field_type == TCompactProtocol::COMPACT_TRUE) {
|
340 |
$this->state = TCompactProtocol::STATE_BOOL_READ;
|
341 |
$this->boolValue = true;
|
345 |
} else {
|
346 |
$this->state = TCompactProtocol::STATE_VALUE_READ;
|
347 |
}
|
348 |
+
$field_type = $this->getTType($field_type);
|
349 |
return $result;
|
350 |
}
|
351 |
|
app/code/local/Boxalino/CemSearch/Model/Advanced.php
CHANGED
@@ -44,7 +44,7 @@ class Boxalino_CemSearch_Model_Advanced extends Mage_CatalogSearch_Model_Advance
|
|
44 |
public function addFilters($values, $ids = null)
|
45 |
{
|
46 |
|
47 |
-
if (Mage::getStoreConfig('Boxalino_General/general/enabled'
|
48 |
return parent::addFilters($values, $ids);
|
49 |
}
|
50 |
|
44 |
public function addFilters($values, $ids = null)
|
45 |
{
|
46 |
|
47 |
+
if (Mage::getStoreConfig('Boxalino_General/general/enabled') == 0) {
|
48 |
return parent::addFilters($values, $ids);
|
49 |
}
|
50 |
|
app/code/local/Boxalino/CemSearch/Model/Category.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by: Simon Rupf <simon.rupf@boxalino.com>
|
4 |
+
* Created at: 15.04.2015 14:47
|
5 |
+
*/
|
6 |
+
|
7 |
+
require_once 'Mage/Catalog/Model/Category.php';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Catalog category
|
11 |
+
*
|
12 |
+
* @category Boxalino
|
13 |
+
* @package Boxalino_CemSearch
|
14 |
+
* @author Simon Rupf <simon.rupf@boxalino.com>
|
15 |
+
*/
|
16 |
+
class Boxalino_CemSearch_Model_Category extends Mage_Catalog_Model_Category
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Retrieve Available Product Listing Sort By
|
20 |
+
* code as key, value - name
|
21 |
+
*
|
22 |
+
* @return array
|
23 |
+
*/
|
24 |
+
public function getAvailableSortByOptions() {
|
25 |
+
$availableSortBy = array();
|
26 |
+
$defaultSortBy = Mage::getSingleton('catalog/config')
|
27 |
+
->getAttributeUsedForSortByArray();
|
28 |
+
if ($this->getAvailableSortBy()) {
|
29 |
+
foreach ($this->getAvailableSortBy() as $sortBy) {
|
30 |
+
if (isset($defaultSortBy[$sortBy])) {
|
31 |
+
$availableSortBy[$sortBy] = $defaultSortBy[$sortBy];
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
if (!$availableSortBy) {
|
37 |
+
$availableSortBy = $defaultSortBy;
|
38 |
+
}
|
39 |
+
|
40 |
+
// force ordering of results by position returned by p13n
|
41 |
+
$availableSortBy = array_merge(array('relevance'=>'Relevance'), $availableSortBy);
|
42 |
+
unset($availableSortBy['position']);
|
43 |
+
|
44 |
+
return $availableSortBy;
|
45 |
+
}
|
46 |
+
}
|
app/code/local/Boxalino/CemSearch/Model/Logger.php
CHANGED
@@ -12,7 +12,7 @@ class Boxalino_CemSearch_Model_Logger
|
|
12 |
*/
|
13 |
static public function saveMemoryTracking($type, $loggedAction, array $data)
|
14 |
{
|
15 |
-
if(Mage::getStoreConfig('Boxalino_General/general/logs_saving')) {
|
16 |
if (self::$_startLogging == null) {
|
17 |
self::$_startLogging = date('d-m-Y_H:i:s');
|
18 |
}
|
@@ -20,15 +20,55 @@ class Boxalino_CemSearch_Model_Logger
|
|
20 |
self::initFile($loggedAction . '-' . self::$_startLogging . '.txt');
|
21 |
}
|
22 |
$difference = $data['memory_usage'] - self::$_lastMemory;
|
23 |
-
$line = date('d-m-Y H:i:s').' '.strtoupper($type).': '
|
24 |
file_put_contents(self::$_fileName, $line, FILE_APPEND);
|
25 |
self::$_lastMemory = $data['memory_usage'];
|
26 |
}
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
static private function initFile($name)
|
30 |
{
|
31 |
-
$logDir
|
32 |
self::$_fileName = $logDir . DS . $name;
|
33 |
|
34 |
if (!is_dir($logDir)) {
|
@@ -41,4 +81,4 @@ class Boxalino_CemSearch_Model_Logger
|
|
41 |
chmod(self::$_fileName, 0777);
|
42 |
}
|
43 |
}
|
44 |
-
}
|
12 |
*/
|
13 |
static public function saveMemoryTracking($type, $loggedAction, array $data)
|
14 |
{
|
15 |
+
if (Mage::getStoreConfig('Boxalino_General/general/logs_saving')) {
|
16 |
if (self::$_startLogging == null) {
|
17 |
self::$_startLogging = date('d-m-Y_H:i:s');
|
18 |
}
|
20 |
self::initFile($loggedAction . '-' . self::$_startLogging . '.txt');
|
21 |
}
|
22 |
$difference = $data['memory_usage'] - self::$_lastMemory;
|
23 |
+
$line = date('d-m-Y H:i:s') . ' ' . strtoupper($type) . ': ' . $loggedAction . ' / ' . $data['method'] . ' / ' . $data['description'] . '. Memory usage: ' . $data['memory_usage'] . ' - Difference=' . $difference . "\n";
|
24 |
file_put_contents(self::$_fileName, $line, FILE_APPEND);
|
25 |
self::$_lastMemory = $data['memory_usage'];
|
26 |
}
|
27 |
}
|
28 |
|
29 |
+
static public function saveFrontActions($type, $data, $separator = false)
|
30 |
+
{
|
31 |
+
|
32 |
+
if (!Mage::getStoreConfig('Boxalino_General/general/logs_saving_frontend')) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
$date = date('Y-m-d H:i:s');
|
37 |
+
|
38 |
+
if (isset($_REQUEST['dev_bx_disp']) && $_REQUEST['dev_bx_disp'] == 'true') {
|
39 |
+
print_r('<pre>');
|
40 |
+
print_r($date . ' ' . strtoupper($type) . '<br/>');
|
41 |
+
print_r($data);
|
42 |
+
print_r('</pre>');
|
43 |
+
|
44 |
+
print_r($separator ? "<br/>========================================================<br/>" : "<br/>");
|
45 |
+
}
|
46 |
+
|
47 |
+
$day = date('Y-m-d_H:i');
|
48 |
+
|
49 |
+
|
50 |
+
// Create file if not exist
|
51 |
+
$logDir = Mage::getBaseDir('var') . DS . 'boxalino_logs';
|
52 |
+
$file = $logDir . DS . 'request_' . $day;
|
53 |
+
|
54 |
+
if (!is_dir($logDir)) {
|
55 |
+
mkdir($logDir);
|
56 |
+
chmod($logDir, 0777);
|
57 |
+
}
|
58 |
+
|
59 |
+
if (!file_exists($file)) {
|
60 |
+
file_put_contents($file, '');
|
61 |
+
chmod($file, 0777);
|
62 |
+
}
|
63 |
+
|
64 |
+
//Save information into file
|
65 |
+
$line = $date . ' ' . strtoupper($type) . "\n" . print_r($data, true) . ($separator ? "\n=========================================================================\n" : "\n");
|
66 |
+
file_put_contents($file, $line, FILE_APPEND);
|
67 |
+
}
|
68 |
+
|
69 |
static private function initFile($name)
|
70 |
{
|
71 |
+
$logDir = Mage::getBaseDir('var') . DS . 'boxalino_logs';
|
72 |
self::$_fileName = $logDir . DS . $name;
|
73 |
|
74 |
if (!is_dir($logDir)) {
|
81 |
chmod(self::$_fileName, 0777);
|
82 |
}
|
83 |
}
|
84 |
+
}
|
app/code/local/Boxalino/CemSearch/Model/Observer.php
CHANGED
@@ -30,7 +30,7 @@ class Boxalino_CemSearch_Model_Observer
|
|
30 |
{
|
31 |
try {
|
32 |
$orders = Mage::getModel('sales/order')->getCollection()
|
33 |
-
->setOrder('entity_id','DESC')
|
34 |
->setPageSize(1)
|
35 |
->setCurPage(1);
|
36 |
$order = $orders->getFirstItem();
|
30 |
{
|
31 |
try {
|
32 |
$orders = Mage::getModel('sales/order')->getCollection()
|
33 |
+
->setOrder('entity_id', 'DESC')
|
34 |
->setPageSize(1)
|
35 |
->setCurPage(1);
|
36 |
$order = $orders->getFirstItem();
|
app/code/local/Boxalino/CemSearch/Model/Resource/Advanced.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Created at: 05.06.14 13:57
|
5 |
*/
|
6 |
|
7 |
-
require_once
|
8 |
|
9 |
class Boxalino_CemSearch_Model_Resource_Advanced extends Mage_CatalogSearch_Model_Resource_Advanced
|
10 |
{
|
4 |
* Created at: 05.06.14 13:57
|
5 |
*/
|
6 |
|
7 |
+
require_once 'Mage/CatalogSearch/Model/Resource/Advanced.php';
|
8 |
|
9 |
class Boxalino_CemSearch_Model_Resource_Advanced extends Mage_CatalogSearch_Model_Resource_Advanced
|
10 |
{
|
app/code/local/Boxalino/CemSearch/Model/Resource/Advanced/Collection.php
CHANGED
@@ -7,9 +7,9 @@
|
|
7 |
/**
|
8 |
* Collection Advanced
|
9 |
*
|
10 |
-
* @category
|
11 |
-
* @package
|
12 |
-
* @author
|
13 |
*/
|
14 |
class Boxalino_CemSearch_Model_Resource_Advanced_Collection extends Mage_Catalog_Model_Resource_Product_Collection
|
15 |
{
|
7 |
/**
|
8 |
* Collection Advanced
|
9 |
*
|
10 |
+
* @category Boxalino
|
11 |
+
* @package Boxalino_CemSearch
|
12 |
+
* @author Szymon Nosal <szymon.nosal@codete.com>
|
13 |
*/
|
14 |
class Boxalino_CemSearch_Model_Resource_Advanced_Collection extends Mage_Catalog_Model_Resource_Product_Collection
|
15 |
{
|
app/code/local/Boxalino/CemSearch/Model/Resource/Fulltext.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
3 |
|
4 |
class Boxalino_CemSearch_Model_Resource_Fulltext extends Mage_CatalogSearch_Model_Resource_Fulltext
|
5 |
{
|
@@ -7,52 +8,163 @@ class Boxalino_CemSearch_Model_Resource_Fulltext extends Mage_CatalogSearch_Mode
|
|
7 |
public function prepareResult($object, $queryText, $query)
|
8 |
{
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
return parent::prepareResult($object, $queryText, $query);
|
12 |
}
|
13 |
|
14 |
-
$
|
15 |
-
|
16 |
-
$p13nConfig = new Boxalino_CemSearch_Helper_P13n_Config(
|
17 |
-
$storeConfig['host'],
|
18 |
-
Mage::helper('Boxalino_CemSearch')->getAccount(),
|
19 |
-
$storeConfig['p13n_username'],
|
20 |
-
$storeConfig['p13n_password'],
|
21 |
-
$storeConfig['domain']
|
22 |
-
);
|
23 |
-
$p13nSort = new Boxalino_CemSearch_Helper_P13n_Sort();
|
24 |
-
$p13nSort->push('score', true); // score / discountedPrice / title_en
|
25 |
-
$p13n = new Boxalino_CemSearch_Helper_P13n_Adapter($p13nConfig);
|
26 |
-
|
27 |
-
$generalConfig = Mage::getStoreConfig('Boxalino_General/search');
|
28 |
-
$lang = substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2);
|
29 |
-
|
30 |
-
$limit = $generalConfig['quick_search_limit'] == 0 ? 1000 : $generalConfig['quick_search_limit'];
|
31 |
-
|
32 |
-
$p13n->setupInquiry(
|
33 |
-
$generalConfig['quick_search'],
|
34 |
-
$query->getQueryText(),
|
35 |
-
$lang,
|
36 |
-
array($generalConfig['entity_id'], 'categories'),
|
37 |
-
$p13nSort,
|
38 |
-
0, $limit
|
39 |
-
);
|
40 |
-
|
41 |
-
if (isset($_GET['cat'])) {
|
42 |
-
$p13n->addFilterCategory($_GET['cat']);
|
43 |
}
|
44 |
-
$p13n->search();
|
45 |
-
$entity_ids = $p13n->getEntitiesIds();
|
46 |
-
unset($p13n); // !!!!!
|
47 |
|
48 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
$this->resetSearchResults($query);
|
51 |
|
52 |
-
if($entity_ids === null || count($entity_ids) < 1){
|
53 |
return $this;
|
54 |
}
|
55 |
|
|
|
|
|
56 |
if (!$query->getIsProcessed() || true) {
|
57 |
|
58 |
$searchType = $object->getSearchType($query->getStoreId());
|
@@ -62,19 +174,6 @@ class Boxalino_CemSearch_Model_Resource_Fulltext extends Mage_CatalogSearch_Mode
|
|
62 |
|
63 |
$bind = array();
|
64 |
$like = array();
|
65 |
-
$likeCond = '';
|
66 |
-
if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE
|
67 |
-
|| $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
|
68 |
-
) {
|
69 |
-
$helper = Mage::getResourceHelper('core');
|
70 |
-
$words = Mage::helper('core/string')->splitWords($queryText, true, $query->getMaxQueryWords());
|
71 |
-
foreach ($words as $word) {
|
72 |
-
$like[] = $helper->getCILike('s.data_index', $word, array('position' => 'any'));
|
73 |
-
}
|
74 |
-
if ($like) {
|
75 |
-
$likeCond = '(' . join(' OR ', $like) . ')';
|
76 |
-
}
|
77 |
-
}
|
78 |
$mainTableAlias = 's';
|
79 |
$fields = array(
|
80 |
'query_id' => new Zend_Db_Expr($query->getId()),
|
@@ -91,29 +190,46 @@ class Boxalino_CemSearch_Model_Resource_Fulltext extends Mage_CatalogSearch_Mode
|
|
91 |
|| $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
|
92 |
) {
|
93 |
$bind[':query'] = implode(' ', $preparedTerms[0]);
|
94 |
-
$where = Mage::getResourceHelper('catalogsearch')
|
95 |
-
->chooseFulltext($this->getMainTable(), $mainTableAlias, $select);
|
96 |
}
|
97 |
|
98 |
-
if ($
|
99 |
-
$where
|
100 |
-
} elseif ($likeCond != '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE) {
|
101 |
-
$select->columns(array('relevance' => new Zend_Db_Expr(0)));
|
102 |
-
$where = $likeCond;
|
103 |
}
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
|
|
|
110 |
$sql = $adapter->insertFromSelect($select,
|
111 |
$this->getTable('catalogsearch/result'),
|
112 |
array(),
|
113 |
Varien_Db_Adapter_Interface::INSERT_ON_DUPLICATE);
|
|
|
114 |
$adapter->query($sql, $bind);
|
115 |
-
}
|
116 |
|
|
|
|
|
117 |
|
118 |
return $this;
|
119 |
|
@@ -131,4 +247,12 @@ class Boxalino_CemSearch_Model_Resource_Fulltext extends Mage_CatalogSearch_Mode
|
|
131 |
|
132 |
return $this;
|
133 |
}
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/CatalogSearch/Model/Resource/Fulltext.php';
|
4 |
|
5 |
class Boxalino_CemSearch_Model_Resource_Fulltext extends Mage_CatalogSearch_Model_Resource_Fulltext
|
6 |
{
|
8 |
public function prepareResult($object, $queryText, $query)
|
9 |
{
|
10 |
|
11 |
+
$session = Mage::getSingleton('core/session');
|
12 |
+
$session->unsetData('relax');
|
13 |
+
$session->unsetData('relax_products');
|
14 |
+
$session->unsetData('relax_products_extra');
|
15 |
+
|
16 |
+
if (Mage::getStoreConfig('Boxalino_General/general/enabled') == 0) {
|
17 |
return parent::prepareResult($object, $queryText, $query);
|
18 |
}
|
19 |
|
20 |
+
if($queryText == ''){
|
21 |
+
return $this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
|
|
|
|
|
|
23 |
|
24 |
+
$searchAdapter = Mage::helper('Boxalino_CemSearch')->getSearchAdapter();
|
25 |
+
$entity_ids = $searchAdapter->getEntitiesIds();
|
26 |
+
|
27 |
+
//prepare suggestion
|
28 |
+
$relaxations = array();
|
29 |
+
$searchRelaxation = $searchAdapter->getChoiceRelaxation();
|
30 |
+
$suggestionConfig = Mage::getStoreConfig('Boxalino_General/search_suggestions');
|
31 |
+
|
32 |
+
if (
|
33 |
+
$suggestionConfig['enabled'] &&
|
34 |
+
is_object($searchRelaxation) &&
|
35 |
+
is_array($searchRelaxation->suggestionsResults) &&
|
36 |
+
count($searchRelaxation->suggestionsResults) > 0 &&
|
37 |
+
(
|
38 |
+
count($entity_ids) <= $suggestionConfig['min'] ||
|
39 |
+
count($entity_ids) >= $suggestionConfig['max']
|
40 |
+
)
|
41 |
+
) {
|
42 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('prepareResult', 'suggestions detected');
|
43 |
+
|
44 |
+
foreach ($searchRelaxation->suggestionsResults as $suggestion) {
|
45 |
+
$relaxations[] = array(
|
46 |
+
'hits' => $suggestion->totalHitCount,
|
47 |
+
'text' => $suggestion->queryText,
|
48 |
+
'href' => urlencode($suggestion->queryText)
|
49 |
+
);
|
50 |
+
}
|
51 |
+
|
52 |
+
if ($suggestionConfig['sort']) {
|
53 |
+
usort($relaxations, array($this, 'cmp'));
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
$session->setData('relax', array_slice($relaxations, 0, $suggestionConfig['display']));
|
58 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('prepareResult relax', $session->getData('relax'));
|
59 |
+
|
60 |
+
|
61 |
+
$this->resetSearchResults($query);
|
62 |
+
|
63 |
+
//relaxation
|
64 |
+
$relaxations_extra = array();
|
65 |
+
$relaxationConfig = Mage::getStoreConfig('Boxalino_General/search_relaxation');
|
66 |
+
|
67 |
+
if (
|
68 |
+
(
|
69 |
+
$entity_ids === null ||
|
70 |
+
count($entity_ids) <= $relaxationConfig['max']
|
71 |
+
) &&
|
72 |
+
is_object($searchRelaxation) &&
|
73 |
+
( count($searchRelaxation->subphrasesResults) > 0) &&
|
74 |
+
$relaxationConfig['enabled']
|
75 |
+
) {
|
76 |
+
|
77 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('prepareResult', 'relaxations detected');
|
78 |
+
|
79 |
+
//display current products
|
80 |
+
$session = Mage::getSingleton('core/session');
|
81 |
+
$session->setData('relax_products', $entity_ids);
|
82 |
+
|
83 |
+
if (count($searchRelaxation->subphrasesResults) > 0) {
|
84 |
+
if (count($relaxations) == 0) {
|
85 |
+
$relaxations_extra = array();
|
86 |
+
}
|
87 |
+
|
88 |
+
foreach ($searchRelaxation->subphrasesResults as $subphrase) {
|
89 |
+
|
90 |
+
if (count($relaxations_extra) >= $relaxationConfig['relaxations']) {
|
91 |
+
continue;
|
92 |
+
}
|
93 |
+
|
94 |
+
$relaxations_extra[$subphrase->queryText] = array();
|
95 |
+
foreach ($subphrase->hits as $hit) {
|
96 |
+
$relaxations_extra[$subphrase->queryText][] = $hit->values['id'][0];
|
97 |
+
if (count($relaxations_extra[$subphrase->queryText]) >= $relaxationConfig['products']) {
|
98 |
+
break;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
//display currently products
|
107 |
+
$session->setData('relax_products_extra', $relaxations_extra);
|
108 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('prepareResult relax_products_extra', $session->getData('relax_products_extra'));
|
109 |
+
|
110 |
+
$this->resetSearchResults($query);
|
111 |
+
|
112 |
+
return $this;
|
113 |
+
|
114 |
+
} elseif (
|
115 |
+
count($entity_ids) == 0 &&
|
116 |
+
is_object($searchRelaxation) &&
|
117 |
+
count($searchRelaxation->subphrasesResults) == 0 &&
|
118 |
+
count($relaxations) > 0) {
|
119 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('prepareResult', 'no relaxations');
|
120 |
+
|
121 |
+
$q = $relaxations[0];
|
122 |
+
$this->resetSearchResults($query);
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Magento EE works peculiarly.
|
126 |
+
* Magento EE loads facets before execute search one more time.
|
127 |
+
* Magento CE works correctly.
|
128 |
+
*/
|
129 |
+
try {
|
130 |
+
if (Mage::getEdition() != 'Community') {
|
131 |
+
|
132 |
+
$params = $_GET;
|
133 |
+
$params['q'] = $q['text'];
|
134 |
+
$paramString = http_build_query($params);
|
135 |
+
|
136 |
+
$currentUrl = urldecode(Mage::helper('core/url')->getCurrentUrl());
|
137 |
+
$currentUrl = substr($currentUrl, 0, strpos($currentUrl, '?'));
|
138 |
+
|
139 |
+
header('Location: ' . $currentUrl . '?' . $paramString);
|
140 |
+
exit();
|
141 |
+
}
|
142 |
+
}catch (Exception $e){
|
143 |
+
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
Mage::helper('Boxalino_CemSearch')->resetSearchAdapter();
|
148 |
+
|
149 |
+
Mage::helper('catalogsearch')->setQueryText($q['text']);
|
150 |
+
|
151 |
+
$searchAdapter = Mage::helper('Boxalino_CemSearch')->getSearchAdapter();
|
152 |
+
$entity_ids = $searchAdapter->getEntitiesIds();
|
153 |
+
|
154 |
+
$session->unsetData('relax');
|
155 |
+
$session->unsetData('relax_products');
|
156 |
+
$session->unsetData('relax_products_extra');
|
157 |
+
|
158 |
+
}
|
159 |
|
160 |
$this->resetSearchResults($query);
|
161 |
|
162 |
+
if ($entity_ids === null || count($entity_ids) < 1) {
|
163 |
return $this;
|
164 |
}
|
165 |
|
166 |
+
$adapter = $this->_getWriteAdapter();
|
167 |
+
|
168 |
if (!$query->getIsProcessed() || true) {
|
169 |
|
170 |
$searchType = $object->getSearchType($query->getStoreId());
|
174 |
|
175 |
$bind = array();
|
176 |
$like = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
$mainTableAlias = 's';
|
178 |
$fields = array(
|
179 |
'query_id' => new Zend_Db_Expr($query->getId()),
|
190 |
|| $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
|
191 |
) {
|
192 |
$bind[':query'] = implode(' ', $preparedTerms[0]);
|
|
|
|
|
193 |
}
|
194 |
|
195 |
+
if (count($entity_ids) > 0) {
|
196 |
+
$select->where('(e.entity_id IN (' . implode(',', $entity_ids) . '))');
|
|
|
|
|
|
|
197 |
}
|
198 |
|
199 |
+
// enforce boxalino ranking
|
200 |
+
$select->order(new Zend_Db_Expr('FIELD(e.entity_id,' . implode(',', $entity_ids).')'));
|
201 |
+
|
202 |
+
if (
|
203 |
+
$searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE ||
|
204 |
+
$searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_FULLTEXT ||
|
205 |
+
$searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
|
206 |
+
) {
|
207 |
+
$innerSelect = (string) $select;
|
208 |
+
$select = $adapter->select()
|
209 |
+
->from(array(
|
210 |
+
'a' => new Zend_Db_Expr('(' . $innerSelect . ')')
|
211 |
+
), array(
|
212 |
+
'query_id',
|
213 |
+
'product_id'
|
214 |
+
))
|
215 |
+
->join(array(
|
216 |
+
'b' => new Zend_Db_Expr('(SELECT @s:= 0)')
|
217 |
+
), '', array(
|
218 |
+
'relevance' => new Zend_Db_Expr('@s:=@s+1')
|
219 |
+
))
|
220 |
+
->where('1=1'); // added to avoid collision with appended ON DUPLICATE
|
221 |
}
|
222 |
|
223 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('Fulltext_PrepareResult', 'storing catalogsearch/result for entities with id: ' . implode(', ', $entity_ids));
|
224 |
$sql = $adapter->insertFromSelect($select,
|
225 |
$this->getTable('catalogsearch/result'),
|
226 |
array(),
|
227 |
Varien_Db_Adapter_Interface::INSERT_ON_DUPLICATE);
|
228 |
+
|
229 |
$adapter->query($sql, $bind);
|
|
|
230 |
|
231 |
+
$query->setIsProcessed(1);
|
232 |
+
}
|
233 |
|
234 |
return $this;
|
235 |
|
247 |
|
248 |
return $this;
|
249 |
}
|
250 |
+
|
251 |
+
private function cmp($a, $b)
|
252 |
+
{
|
253 |
+
if ($a['hits'] == $b['hits']) {
|
254 |
+
return 0;
|
255 |
+
}
|
256 |
+
return ($a['hits'] > $b['hits']) ? -1 : 1;
|
257 |
+
}
|
258 |
+
}
|
app/code/local/Boxalino/CemSearch/controllers/AdvancedController.php
CHANGED
@@ -28,7 +28,7 @@ class Boxalino_CemSearch_AdvancedController extends Mage_CatalogSearch_AdvancedC
|
|
28 |
|
29 |
$queryAttribute = array();
|
30 |
|
31 |
-
if (Mage::getStoreConfig('Boxalino_General/general/enabled'
|
32 |
return parent::resultAction();
|
33 |
}
|
34 |
|
@@ -48,7 +48,7 @@ class Boxalino_CemSearch_AdvancedController extends Mage_CatalogSearch_AdvancedC
|
|
48 |
);
|
49 |
}
|
50 |
|
51 |
-
foreach($tmp->getAttributes() as $at){
|
52 |
$queryAttribute[$at->getStoreLabel()] = $at->getAttributeCode();
|
53 |
}
|
54 |
|
@@ -68,7 +68,6 @@ class Boxalino_CemSearch_AdvancedController extends Mage_CatalogSearch_AdvancedC
|
|
68 |
$storeConfig['domain']
|
69 |
);
|
70 |
$p13nSort = new Boxalino_CemSearch_Helper_P13n_Sort();
|
71 |
-
$p13nSort->push('score', true);
|
72 |
|
73 |
$p13n = new Boxalino_CemSearch_Helper_P13n_Adapter($p13nConfig);
|
74 |
|
@@ -135,10 +134,12 @@ class Boxalino_CemSearch_AdvancedController extends Mage_CatalogSearch_AdvancedC
|
|
135 |
|
136 |
//get result from boxalino
|
137 |
$p13n->search();
|
|
|
138 |
$entity_ids = $p13n->getEntitiesIds();
|
139 |
unset($p13n);
|
140 |
|
141 |
try {
|
|
|
142 |
Mage::getSingleton('catalogsearch/advanced')->addFilters($params, $entity_ids);
|
143 |
} catch (Mage_Core_Exception $e) {
|
144 |
Mage::getSingleton('catalogsearch/session')->addError($e->getMessage());
|
@@ -154,4 +155,4 @@ class Boxalino_CemSearch_AdvancedController extends Mage_CatalogSearch_AdvancedC
|
|
154 |
|
155 |
}
|
156 |
|
157 |
-
}
|
28 |
|
29 |
$queryAttribute = array();
|
30 |
|
31 |
+
if (Mage::getStoreConfig('Boxalino_General/general/enabled') == 0) {
|
32 |
return parent::resultAction();
|
33 |
}
|
34 |
|
48 |
);
|
49 |
}
|
50 |
|
51 |
+
foreach ($tmp->getAttributes() as $at) {
|
52 |
$queryAttribute[$at->getStoreLabel()] = $at->getAttributeCode();
|
53 |
}
|
54 |
|
68 |
$storeConfig['domain']
|
69 |
);
|
70 |
$p13nSort = new Boxalino_CemSearch_Helper_P13n_Sort();
|
|
|
71 |
|
72 |
$p13n = new Boxalino_CemSearch_Helper_P13n_Adapter($p13nConfig);
|
73 |
|
134 |
|
135 |
//get result from boxalino
|
136 |
$p13n->search();
|
137 |
+
$p13n->prepareAdditionalDataFromP13n();
|
138 |
$entity_ids = $p13n->getEntitiesIds();
|
139 |
unset($p13n);
|
140 |
|
141 |
try {
|
142 |
+
Boxalino_CemSearch_Model_Logger::saveFrontActions('AdvancedController_ResultAction', 'storing catalogsearch/advanced for entities with id: ' . implode(', ', $entity_ids));
|
143 |
Mage::getSingleton('catalogsearch/advanced')->addFilters($params, $entity_ids);
|
144 |
} catch (Mage_Core_Exception $e) {
|
145 |
Mage::getSingleton('catalogsearch/session')->addError($e->getMessage());
|
155 |
|
156 |
}
|
157 |
|
158 |
+
}
|
app/code/local/Boxalino/CemSearch/etc/config.xml
CHANGED
@@ -88,12 +88,26 @@
|
|
88 |
</observers>
|
89 |
</customer_login>
|
90 |
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
</frontend>
|
92 |
<global>
|
93 |
<helpers>
|
94 |
<Boxalino_CemSearch>
|
95 |
<class>Boxalino_CemSearch_Helper</class>
|
96 |
</Boxalino_CemSearch>
|
|
|
|
|
|
|
|
|
|
|
97 |
</helpers>
|
98 |
<models>
|
99 |
<boxalino_cemsearch>
|
@@ -107,12 +121,16 @@
|
|
107 |
<advanced_collection>Boxalino_CemSearch_Model_Resource_Advanced_Collection</advanced_collection>
|
108 |
</rewrite>
|
109 |
</catalogsearch_resource>
|
110 |
-
|
111 |
<catalogsearch>
|
112 |
<rewrite>
|
113 |
<advanced>Boxalino_CemSearch_Model_Advanced</advanced>
|
114 |
</rewrite>
|
115 |
</catalogsearch>
|
|
|
|
|
|
|
|
|
|
|
116 |
</models>
|
117 |
<resources>
|
118 |
<test_write>
|
@@ -146,6 +164,12 @@
|
|
146 |
<product_list_upsell>Boxalino_CemSearch_Block_Product_List_Upsell</product_list_upsell>
|
147 |
</rewrite>
|
148 |
</catalog>
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
</blocks>
|
150 |
</global>
|
151 |
<default>
|
@@ -166,6 +190,36 @@
|
|
166 |
<autocomplete_products_limit>3</autocomplete_products_limit>
|
167 |
<entity_id>id</entity_id>
|
168 |
</search>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
<tracker>
|
170 |
<charset>UTF-8</charset>
|
171 |
<enabled>1</enabled>
|
88 |
</observers>
|
89 |
</customer_login>
|
90 |
</events>
|
91 |
+
<translate>
|
92 |
+
<modules>
|
93 |
+
<Boxalino_CemSearch>
|
94 |
+
<files>
|
95 |
+
<default>Boxalino.csv</default>
|
96 |
+
</files>
|
97 |
+
</Boxalino_CemSearch>
|
98 |
+
</modules>
|
99 |
+
</translate>
|
100 |
</frontend>
|
101 |
<global>
|
102 |
<helpers>
|
103 |
<Boxalino_CemSearch>
|
104 |
<class>Boxalino_CemSearch_Helper</class>
|
105 |
</Boxalino_CemSearch>
|
106 |
+
<catalogsearch>
|
107 |
+
<rewrite>
|
108 |
+
<data>Boxalino_CemSearch_CatalogSearch_Helper_Data</data>
|
109 |
+
</rewrite>
|
110 |
+
</catalogsearch>
|
111 |
</helpers>
|
112 |
<models>
|
113 |
<boxalino_cemsearch>
|
121 |
<advanced_collection>Boxalino_CemSearch_Model_Resource_Advanced_Collection</advanced_collection>
|
122 |
</rewrite>
|
123 |
</catalogsearch_resource>
|
|
|
124 |
<catalogsearch>
|
125 |
<rewrite>
|
126 |
<advanced>Boxalino_CemSearch_Model_Advanced</advanced>
|
127 |
</rewrite>
|
128 |
</catalogsearch>
|
129 |
+
<catalog>
|
130 |
+
<rewrite>
|
131 |
+
<category>Boxalino_CemSearch_Model_Category</category>
|
132 |
+
</rewrite>
|
133 |
+
</catalog>
|
134 |
</models>
|
135 |
<resources>
|
136 |
<test_write>
|
164 |
<product_list_upsell>Boxalino_CemSearch_Block_Product_List_Upsell</product_list_upsell>
|
165 |
</rewrite>
|
166 |
</catalog>
|
167 |
+
<!--<enterprise_targetrule>-->
|
168 |
+
<!--<rewrite>-->
|
169 |
+
<!--<catalog_product_list_related>Boxalino_CemSearch_Block_Product_List_Related</catalog_product_list_related>-->
|
170 |
+
<!--<catalog_product_list_upsell>Boxalino_CemSearch_Block_Product_List_Upsell</catalog_product_list_upsell>-->
|
171 |
+
<!--</rewrite>-->
|
172 |
+
<!--</enterprise_targetrule>-->
|
173 |
</blocks>
|
174 |
</global>
|
175 |
<default>
|
190 |
<autocomplete_products_limit>3</autocomplete_products_limit>
|
191 |
<entity_id>id</entity_id>
|
192 |
</search>
|
193 |
+
<autocomplete_html>
|
194 |
+
<enabled>1</enabled>
|
195 |
+
<items>title:title,url:products_default_url,image:products_cache_image_url</items>
|
196 |
+
</autocomplete_html>
|
197 |
+
<autocomplete_extra>
|
198 |
+
<enabled>1</enabled>
|
199 |
+
<enabled_for_all>0</enabled_for_all>
|
200 |
+
<items>4</items>
|
201 |
+
<sort>1</sort>
|
202 |
+
<products>1</products>
|
203 |
+
</autocomplete_extra>
|
204 |
+
<search_suggestions>
|
205 |
+
<enabled>1</enabled>
|
206 |
+
<min>3</min>
|
207 |
+
<max>50</max>
|
208 |
+
<display>6</display>
|
209 |
+
<sort>1</sort>
|
210 |
+
</search_suggestions>
|
211 |
+
<search_relaxation>
|
212 |
+
<enabled>1</enabled>
|
213 |
+
<max>3</max>
|
214 |
+
<relaxations>3</relaxations>
|
215 |
+
<products>3</products>
|
216 |
+
</search_relaxation>
|
217 |
+
<filter>
|
218 |
+
<left_filters_enable>0</left_filters_enable>
|
219 |
+
<top_filters_enable>0</top_filters_enable>
|
220 |
+
<left_filters_multiselect>0</left_filters_multiselect>
|
221 |
+
<top_filters_multiselect>0</top_filters_multiselect>
|
222 |
+
</filter>
|
223 |
<tracker>
|
224 |
<charset>UTF-8</charset>
|
225 |
<enabled>1</enabled>
|
app/code/local/Boxalino/CemSearch/etc/system.xml
CHANGED
@@ -29,11 +29,10 @@
|
|
29 |
<!-- ENABLED -->
|
30 |
<enabled translate="label">
|
31 |
<label>Enabled plugin</label>
|
32 |
-
<frontend_type>text</frontend_type>
|
33 |
<sort_order>1</sort_order>
|
34 |
<show_in_default>1</show_in_default>
|
35 |
<show_in_website>1</show_in_website>
|
36 |
-
<show_in_store>
|
37 |
<frontend_type>select</frontend_type>
|
38 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
39 |
</enabled>
|
@@ -48,6 +47,16 @@
|
|
48 |
<frontend_type>select</frontend_type>
|
49 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
50 |
</logs_saving>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
<!-- ACCOUNT DEV -->
|
52 |
<account_dev translate="label">
|
53 |
<label>Development environment</label>
|
@@ -127,6 +136,16 @@
|
|
127 |
<show_in_store>0</show_in_store>
|
128 |
<validate>required-entry</validate>
|
129 |
</p13n_password>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
</fields>
|
131 |
</general>
|
132 |
|
@@ -134,7 +153,7 @@
|
|
134 |
<!--<label>Recommendations Widgets</label>-->
|
135 |
<label>Search Configuration</label>
|
136 |
<frontend_type>text</frontend_type>
|
137 |
-
<sort_order>
|
138 |
<show_in_default>1</show_in_default>
|
139 |
<show_in_website>1</show_in_website>
|
140 |
<show_in_store>0</show_in_store>
|
@@ -213,10 +232,278 @@
|
|
213 |
</entity_id>
|
214 |
</fields>
|
215 |
</search>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
<tracker translate="label" module="Boxalino_CemSearch">
|
217 |
<label>Tracking</label>
|
218 |
<frontend_type>text</frontend_type>
|
219 |
-
<sort_order>
|
220 |
<show_in_default>1</show_in_default>
|
221 |
<show_in_website>1</show_in_website>
|
222 |
<show_in_store>1</show_in_store>
|
@@ -261,7 +548,7 @@
|
|
261 |
<jquery translate="label" module="Boxalino_CemSearch">
|
262 |
<label>jQuery Configuration</label>
|
263 |
<frontend_type>text</frontend_type>
|
264 |
-
<sort_order>
|
265 |
<show_in_default>1</show_in_default>
|
266 |
<show_in_website>1</show_in_website>
|
267 |
<show_in_store>0</show_in_store>
|
29 |
<!-- ENABLED -->
|
30 |
<enabled translate="label">
|
31 |
<label>Enabled plugin</label>
|
|
|
32 |
<sort_order>1</sort_order>
|
33 |
<show_in_default>1</show_in_default>
|
34 |
<show_in_website>1</show_in_website>
|
35 |
+
<show_in_store>1</show_in_store>
|
36 |
<frontend_type>select</frontend_type>
|
37 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
38 |
</enabled>
|
47 |
<frontend_type>select</frontend_type>
|
48 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
49 |
</logs_saving>
|
50 |
+
<logs_saving_frontend translate="label">
|
51 |
+
<label>Frontend Logs Saving</label>
|
52 |
+
<frontend_type>text</frontend_type>
|
53 |
+
<sort_order>1</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>0</show_in_website>
|
56 |
+
<show_in_store>0</show_in_store>
|
57 |
+
<frontend_type>select</frontend_type>
|
58 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
59 |
+
</logs_saving_frontend>
|
60 |
<!-- ACCOUNT DEV -->
|
61 |
<account_dev translate="label">
|
62 |
<label>Development environment</label>
|
136 |
<show_in_store>0</show_in_store>
|
137 |
<validate>required-entry</validate>
|
138 |
</p13n_password>
|
139 |
+
<additional_fields>
|
140 |
+
<label>Return additional fields</label>
|
141 |
+
<frontend_type>text</frontend_type>
|
142 |
+
<comment><![CDATA[ Write here comma-separated names of fields from the Data Intelligence which should be returned with P13n response<br />
|
143 |
+
Colon separate option: global (without language version), local (with language version)]]></comment>
|
144 |
+
<sort_order>90</sort_order>
|
145 |
+
<show_in_default>1</show_in_default>
|
146 |
+
<show_in_website>1</show_in_website>
|
147 |
+
<show_in_store>0</show_in_store>
|
148 |
+
</additional_fields>
|
149 |
</fields>
|
150 |
</general>
|
151 |
|
153 |
<!--<label>Recommendations Widgets</label>-->
|
154 |
<label>Search Configuration</label>
|
155 |
<frontend_type>text</frontend_type>
|
156 |
+
<sort_order>41</sort_order>
|
157 |
<show_in_default>1</show_in_default>
|
158 |
<show_in_website>1</show_in_website>
|
159 |
<show_in_store>0</show_in_store>
|
232 |
</entity_id>
|
233 |
</fields>
|
234 |
</search>
|
235 |
+
<autocomplete_html translate="label" module="Boxalino_CemSearch">
|
236 |
+
<label>Autocomplete View</label>
|
237 |
+
<frontend_type>text</frontend_type>
|
238 |
+
<sort_order>45</sort_order>
|
239 |
+
<show_in_default>1</show_in_default>
|
240 |
+
<show_in_website>1</show_in_website>
|
241 |
+
<show_in_store>0</show_in_store>
|
242 |
+
<fields>
|
243 |
+
<enabled translate="label">
|
244 |
+
<label>Enable Magento logic</label>
|
245 |
+
<frontend_type>select</frontend_type>
|
246 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
247 |
+
<sort_order>10</sort_order>
|
248 |
+
<show_in_default>1</show_in_default>
|
249 |
+
<show_in_website>1</show_in_website>
|
250 |
+
<show_in_store>0</show_in_store>
|
251 |
+
</enabled>
|
252 |
+
<items translate="label">
|
253 |
+
<label>Mapping fields</label>
|
254 |
+
<frontend_type>text</frontend_type>
|
255 |
+
<comment><![CDATA[ Write here comma-separated names of fields which you want to use in autocomplete (for example: title)<br />
|
256 |
+
Colon separate name of attribute (left), from field name (right). <br/> Example: color:product_color<br />
|
257 |
+
<strong>Important</strong>: fields for product name and product url can't be change (title for product name, and url for product url ]]></comment>
|
258 |
+
<sort_order>20</sort_order>
|
259 |
+
<show_in_default>1</show_in_default>
|
260 |
+
<show_in_website>1</show_in_website>
|
261 |
+
<show_in_store>0</show_in_store>
|
262 |
+
</items>
|
263 |
+
</fields>
|
264 |
+
</autocomplete_html>
|
265 |
+
<autocomplete_extra translate="label" module="Boxalino_CemSearch">
|
266 |
+
<label>Autocomplete Categories Configuration</label>
|
267 |
+
<frontend_type>text</frontend_type>
|
268 |
+
<sort_order>50</sort_order>
|
269 |
+
<show_in_default>1</show_in_default>
|
270 |
+
<show_in_website>1</show_in_website>
|
271 |
+
<show_in_store>0</show_in_store>
|
272 |
+
<fields>
|
273 |
+
<enabled translate="label">
|
274 |
+
<label>Enable autocomplete categories</label>
|
275 |
+
<frontend_type>select</frontend_type>
|
276 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
277 |
+
<sort_order>10</sort_order>
|
278 |
+
<show_in_default>1</show_in_default>
|
279 |
+
<show_in_website>1</show_in_website>
|
280 |
+
<show_in_store>0</show_in_store>
|
281 |
+
</enabled>
|
282 |
+
<enabled_for_all translate="label">
|
283 |
+
<label>Display for all term</label>
|
284 |
+
<frontend_type>select</frontend_type>
|
285 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
286 |
+
<comment><![CDATA[ If no, then display categories for the first term only. <br /> If yes, then display categories for all terms. ]]></comment>
|
287 |
+
<sort_order>20</sort_order>
|
288 |
+
<show_in_default>1</show_in_default>
|
289 |
+
<show_in_website>1</show_in_website>
|
290 |
+
<show_in_store>0</show_in_store>
|
291 |
+
</enabled_for_all>
|
292 |
+
<items translate="label">
|
293 |
+
<label>Number of categories per term</label>
|
294 |
+
<frontend_type>text</frontend_type>
|
295 |
+
<sort_order>30</sort_order>
|
296 |
+
<show_in_default>1</show_in_default>
|
297 |
+
<show_in_website>1</show_in_website>
|
298 |
+
<show_in_store>0</show_in_store>
|
299 |
+
</items>
|
300 |
+
<sort translate="label">
|
301 |
+
<label>Sorting by products quantity</label>
|
302 |
+
<frontend_type>select</frontend_type>
|
303 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
304 |
+
<comment><![CDATA[ If yes, then sort by number of products. ]]></comment>
|
305 |
+
<sort_order>40</sort_order>
|
306 |
+
<show_in_default>1</show_in_default>
|
307 |
+
<show_in_website>1</show_in_website>
|
308 |
+
<show_in_store>0</show_in_store>
|
309 |
+
</sort>
|
310 |
+
<products translate="label">
|
311 |
+
<label>Enable product preview for categories</label>
|
312 |
+
<frontend_type>select</frontend_type>
|
313 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
314 |
+
<sort_order>50</sort_order>
|
315 |
+
<show_in_default>1</show_in_default>
|
316 |
+
<show_in_website>1</show_in_website>
|
317 |
+
<show_in_store>0</show_in_store>
|
318 |
+
</products>
|
319 |
+
</fields>
|
320 |
+
</autocomplete_extra>
|
321 |
+
<search_suggestions translate="label" module="Boxalino_CemSearch">
|
322 |
+
<label>Search Suggestions Configuration</label>
|
323 |
+
<frontend_type>text</frontend_type>
|
324 |
+
<sort_order>52</sort_order>
|
325 |
+
<show_in_default>1</show_in_default>
|
326 |
+
<show_in_website>1</show_in_website>
|
327 |
+
<show_in_store>0</show_in_store>
|
328 |
+
<fields>
|
329 |
+
<enabled translate="label">
|
330 |
+
<label>Enable search suggestion</label>
|
331 |
+
<frontend_type>select</frontend_type>
|
332 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
333 |
+
<sort_order>10</sort_order>
|
334 |
+
<show_in_default>1</show_in_default>
|
335 |
+
<show_in_website>1</show_in_website>
|
336 |
+
<show_in_store>0</show_in_store>
|
337 |
+
</enabled>
|
338 |
+
<min translate="label">
|
339 |
+
<label>Minimum for range</label>
|
340 |
+
<frontend_type>text</frontend_type>
|
341 |
+
<comment><![CDATA[ Display suggestion, when quantity of products is fewer than this value ]]></comment>
|
342 |
+
<sort_order>20</sort_order>
|
343 |
+
<show_in_default>1</show_in_default>
|
344 |
+
<show_in_website>1</show_in_website>
|
345 |
+
<show_in_store>0</show_in_store>
|
346 |
+
</min>
|
347 |
+
<max translate="label">
|
348 |
+
<label>Maximum for range</label>
|
349 |
+
<frontend_type>text</frontend_type>
|
350 |
+
<comment><![CDATA[ Display suggestion, when quantity of products is more than this value ]]></comment>
|
351 |
+
<sort_order>30</sort_order>
|
352 |
+
<show_in_default>1</show_in_default>
|
353 |
+
<show_in_website>1</show_in_website>
|
354 |
+
<show_in_store>0</show_in_store>
|
355 |
+
</max>
|
356 |
+
<display translate="label">
|
357 |
+
<label>Maximum number of suggestions</label>
|
358 |
+
<frontend_type>text</frontend_type>
|
359 |
+
<sort_order>40</sort_order>
|
360 |
+
<show_in_default>1</show_in_default>
|
361 |
+
<show_in_website>1</show_in_website>
|
362 |
+
<show_in_store>0</show_in_store>
|
363 |
+
</display>
|
364 |
+
<sort translate="label">
|
365 |
+
<label>Sorting by products quantity</label>
|
366 |
+
<frontend_type>select</frontend_type>
|
367 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
368 |
+
<comment><![CDATA[ If no, then sort by name ]]></comment>
|
369 |
+
<sort_order>50</sort_order>
|
370 |
+
<show_in_default>1</show_in_default>
|
371 |
+
<show_in_website>1</show_in_website>
|
372 |
+
<show_in_store>0</show_in_store>
|
373 |
+
</sort>
|
374 |
+
</fields>
|
375 |
+
</search_suggestions>
|
376 |
+
<search_relaxation translate="label" module="Boxalino_CemSearch">
|
377 |
+
<label>Search Relaxation Configuration</label>
|
378 |
+
<frontend_type>text</frontend_type>
|
379 |
+
<sort_order>55</sort_order>
|
380 |
+
<show_in_default>1</show_in_default>
|
381 |
+
<show_in_website>1</show_in_website>
|
382 |
+
<show_in_store>0</show_in_store>
|
383 |
+
<fields>
|
384 |
+
<enabled translate="label">
|
385 |
+
<label>Enable search relaxation</label>
|
386 |
+
<frontend_type>select</frontend_type>
|
387 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
388 |
+
<sort_order>1</sort_order>
|
389 |
+
<show_in_default>1</show_in_default>
|
390 |
+
<show_in_website>1</show_in_website>
|
391 |
+
<show_in_store>0</show_in_store>
|
392 |
+
</enabled>
|
393 |
+
<max translate="label">
|
394 |
+
<label>Maximum for quantity of products</label>
|
395 |
+
<frontend_type>text</frontend_type>
|
396 |
+
<comment><![CDATA[ Display relaxation, when quantity of products is less than this value ]]></comment>
|
397 |
+
<sort_order>10</sort_order>
|
398 |
+
<show_in_default>1</show_in_default>
|
399 |
+
<show_in_website>1</show_in_website>
|
400 |
+
<show_in_store>0</show_in_store>
|
401 |
+
</max>
|
402 |
+
<relaxations>
|
403 |
+
<label>Maximum of relaxations</label>
|
404 |
+
<frontend_type>text</frontend_type>
|
405 |
+
<sort_order>20</sort_order>
|
406 |
+
<show_in_default>1</show_in_default>
|
407 |
+
<show_in_website>1</show_in_website>
|
408 |
+
<show_in_store>0</show_in_store>
|
409 |
+
</relaxations>
|
410 |
+
<products>
|
411 |
+
<label>Maximum of products for relaxation</label>
|
412 |
+
<frontend_type>text</frontend_type>
|
413 |
+
<sort_order>30</sort_order>
|
414 |
+
<show_in_default>1</show_in_default>
|
415 |
+
<show_in_website>1</show_in_website>
|
416 |
+
<show_in_store>0</show_in_store>
|
417 |
+
</products>
|
418 |
+
</fields>
|
419 |
+
</search_relaxation>
|
420 |
+
<filter translate="label" module="Boxalino_CemSearch">
|
421 |
+
<label>Filters Configuration</label>
|
422 |
+
<frontend_type>text</frontend_type>
|
423 |
+
<sort_order>60</sort_order>
|
424 |
+
<show_in_default>1</show_in_default>
|
425 |
+
<show_in_website>1</show_in_website>
|
426 |
+
<show_in_store>1</show_in_store>
|
427 |
+
<fields>
|
428 |
+
<left_filters_enable translate="label">
|
429 |
+
<label>Enable filters (left side)</label>
|
430 |
+
<frontend_type>select</frontend_type>
|
431 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
432 |
+
<sort_order>39</sort_order>
|
433 |
+
<show_in_default>1</show_in_default>
|
434 |
+
<show_in_website>1</show_in_website>
|
435 |
+
<show_in_store>0</show_in_store>
|
436 |
+
</left_filters_enable>
|
437 |
+
<left_filters_multioption translate="label">
|
438 |
+
<label>Left filters multioption</label>
|
439 |
+
<frontend_type>select</frontend_type>
|
440 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
441 |
+
<sort_order>40</sort_order>
|
442 |
+
<show_in_default>1</show_in_default>
|
443 |
+
<show_in_website>1</show_in_website>
|
444 |
+
<show_in_store>0</show_in_store>
|
445 |
+
</left_filters_multioption>
|
446 |
+
<left_filters_normal translate="label">
|
447 |
+
<label>Normal filters (left side)</label>
|
448 |
+
<frontend_type>text</frontend_type>
|
449 |
+
<comment><![CDATA[ Write here comma-separated names of fields which you want to use as filters (for example: manufacturer)<br />
|
450 |
+
Colon separate name of field (left) from option (middle), and order (right). <br/> For order: 0 - alphabetical, 1 - count ]]></comment>
|
451 |
+
<sort_order>50</sort_order>
|
452 |
+
<show_in_default>1</show_in_default>
|
453 |
+
<show_in_website>1</show_in_website>
|
454 |
+
<show_in_store>0</show_in_store>
|
455 |
+
</left_filters_normal>
|
456 |
+
<left_filters_normal_title translate="label">
|
457 |
+
<label>Normal filters titles (left side)</label>
|
458 |
+
<frontend_type>text</frontend_type>
|
459 |
+
<comment>Write here comma-separated titles which should be displayed on page (in same order as names of fields)</comment>
|
460 |
+
<sort_order>51</sort_order>
|
461 |
+
<show_in_default>1</show_in_default>
|
462 |
+
<show_in_website>1</show_in_website>
|
463 |
+
<show_in_store>1</show_in_store>
|
464 |
+
</left_filters_normal_title>
|
465 |
+
<top_filters_enable translate="label">
|
466 |
+
<label>Enable top filters</label>
|
467 |
+
<frontend_type>select</frontend_type>
|
468 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
469 |
+
<sort_order>58</sort_order>
|
470 |
+
<show_in_default>1</show_in_default>
|
471 |
+
<show_in_website>1</show_in_website>
|
472 |
+
<show_in_store>0</show_in_store>
|
473 |
+
</top_filters_enable>
|
474 |
+
<top_filters_multioption translate="label">
|
475 |
+
<label>Top filters multioption</label>
|
476 |
+
<frontend_type>select</frontend_type>
|
477 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
478 |
+
<sort_order>59</sort_order>
|
479 |
+
<show_in_default>1</show_in_default>
|
480 |
+
<show_in_website>1</show_in_website>
|
481 |
+
<show_in_store>0</show_in_store>
|
482 |
+
</top_filters_multioption>
|
483 |
+
<top_filters translate="label">
|
484 |
+
<label>Top filters</label>
|
485 |
+
<frontend_type>text</frontend_type>
|
486 |
+
<comment>Write here comma-separated names of fields which you want to use as top filters</comment>
|
487 |
+
<sort_order>60</sort_order>
|
488 |
+
<show_in_default>1</show_in_default>
|
489 |
+
<show_in_website>1</show_in_website>
|
490 |
+
<show_in_store>0</show_in_store>
|
491 |
+
</top_filters>
|
492 |
+
<top_filters_title translate="label">
|
493 |
+
<label>Top filters titles</label>
|
494 |
+
<frontend_type>text</frontend_type>
|
495 |
+
<comment>Write here comma-separated titles which should be displayed on page (in same order as names of fields)</comment>
|
496 |
+
<sort_order>61</sort_order>
|
497 |
+
<show_in_default>1</show_in_default>
|
498 |
+
<show_in_website>1</show_in_website>
|
499 |
+
<show_in_store>1</show_in_store>
|
500 |
+
</top_filters_title>
|
501 |
+
</fields>
|
502 |
+
</filter>
|
503 |
<tracker translate="label" module="Boxalino_CemSearch">
|
504 |
<label>Tracking</label>
|
505 |
<frontend_type>text</frontend_type>
|
506 |
+
<sort_order>70</sort_order>
|
507 |
<show_in_default>1</show_in_default>
|
508 |
<show_in_website>1</show_in_website>
|
509 |
<show_in_store>1</show_in_store>
|
548 |
<jquery translate="label" module="Boxalino_CemSearch">
|
549 |
<label>jQuery Configuration</label>
|
550 |
<frontend_type>text</frontend_type>
|
551 |
+
<sort_order>80</sort_order>
|
552 |
<show_in_default>1</show_in_default>
|
553 |
<show_in_website>1</show_in_website>
|
554 |
<show_in_store>0</show_in_store>
|
app/code/local/Boxalino/Exporter/Helper/Data.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
|
3 |
class Boxalino_Exporter_Helper_Data extends Mage_Core_Helper_Data
|
4 |
{
|
5 |
-
const URL_XML = '
|
6 |
-
const URL_XML_DEV = '
|
7 |
-
const URL_ZIP = '
|
8 |
-
const URL_ZIP_DEV = '
|
9 |
-
|
10 |
public $XML_DELIMITER = ',';
|
11 |
public $XML_ENCLOSURE = '"';
|
12 |
public $XML_ENCLOSURE_TEXT = """; // it's $XML_ENCLOSURE
|
@@ -40,6 +40,15 @@ class Boxalino_Exporter_Helper_Data extends Mage_Core_Helper_Data
|
|
40 |
return false;
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* @return array Return array with attributes which have connect optionId = optionValue
|
45 |
*/
|
@@ -81,10 +90,11 @@ class Boxalino_Exporter_Helper_Data extends Mage_Core_Helper_Data
|
|
81 |
*/
|
82 |
public function getZIPSyncUrl($dev = false)
|
83 |
{
|
|
|
84 |
if ($dev) {
|
85 |
-
return self::URL_ZIP_DEV;
|
86 |
} else {
|
87 |
-
return self::URL_ZIP;
|
88 |
}
|
89 |
}
|
90 |
|
@@ -94,10 +104,11 @@ class Boxalino_Exporter_Helper_Data extends Mage_Core_Helper_Data
|
|
94 |
*/
|
95 |
public function getXMLSyncUrl($dev = false)
|
96 |
{
|
|
|
97 |
if ($dev) {
|
98 |
-
return self::URL_XML_DEV;
|
99 |
} else {
|
100 |
-
return self::URL_XML;
|
101 |
}
|
102 |
|
103 |
}
|
@@ -117,7 +128,7 @@ class Boxalino_Exporter_Helper_Data extends Mage_Core_Helper_Data
|
|
117 |
public function getCountry($countryCode)
|
118 |
{
|
119 |
|
120 |
-
if(!isset($this->_countries[$countryCode])) {
|
121 |
$country = Mage::getModel('directory/country')->loadByCode($countryCode);
|
122 |
$this->_countries[$countryCode] = $country;
|
123 |
}
|
@@ -141,8 +152,7 @@ class Boxalino_Exporter_Helper_Data extends Mage_Core_Helper_Data
|
|
141 |
$text = trim($text, $delimiter);
|
142 |
|
143 |
// transliterate
|
144 |
-
if (function_exists('iconv'))
|
145 |
-
{
|
146 |
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
|
147 |
}
|
148 |
|
@@ -152,8 +162,7 @@ class Boxalino_Exporter_Helper_Data extends Mage_Core_Helper_Data
|
|
152 |
// remove unwanted characters
|
153 |
$text = preg_replace('~[^_\w]+~', '', $text);
|
154 |
|
155 |
-
if (empty($text))
|
156 |
-
{
|
157 |
return null;
|
158 |
}
|
159 |
|
@@ -171,18 +180,31 @@ class Boxalino_Exporter_Helper_Data extends Mage_Core_Helper_Data
|
|
171 |
|
172 |
public function delTree($dir)
|
173 |
{
|
174 |
-
if(!file_exists($dir)){
|
175 |
return;
|
176 |
}
|
177 |
-
$files = array_diff(scandir($dir), array('.','..'));
|
178 |
foreach ($files as $file) {
|
179 |
-
if(is_dir("$dir/$file")){
|
180 |
self::delTree("$dir/$file");
|
181 |
-
} else if(file_exists("$dir/$file")){
|
182 |
@unlink("$dir/$file");
|
183 |
}
|
184 |
}
|
185 |
return rmdir($dir);
|
186 |
}
|
187 |
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
class Boxalino_Exporter_Helper_Data extends Mage_Core_Helper_Data
|
4 |
{
|
5 |
+
const URL_XML = '/frontend/dbmind/en/dbmind/api/data/source/update';
|
6 |
+
const URL_XML_DEV = '/frontend/dbmind/en/dbmind/api/data/source/update?dev=true';
|
7 |
+
const URL_ZIP = '/frontend/dbmind/en/dbmind/api/data/push';
|
8 |
+
const URL_ZIP_DEV = '/frontend/dbmind/en/dbmind/api/data/push?dev=true';
|
9 |
+
public $exportServer = '';
|
10 |
public $XML_DELIMITER = ',';
|
11 |
public $XML_ENCLOSURE = '"';
|
12 |
public $XML_ENCLOSURE_TEXT = """; // it's $XML_ENCLOSURE
|
40 |
return false;
|
41 |
}
|
42 |
|
43 |
+
public function getExportServer()
|
44 |
+
{
|
45 |
+
if (empty($this->exportServer)) {
|
46 |
+
$this->exportServer = Mage::getStoreConfig('boxalinoexporter/export_data/export_server');
|
47 |
+
}
|
48 |
+
|
49 |
+
return $this->exportServer;
|
50 |
+
}
|
51 |
+
|
52 |
/**
|
53 |
* @return array Return array with attributes which have connect optionId = optionValue
|
54 |
*/
|
90 |
*/
|
91 |
public function getZIPSyncUrl($dev = false)
|
92 |
{
|
93 |
+
$exportServer = $this->getExportServer();
|
94 |
if ($dev) {
|
95 |
+
return $exportServer . self::URL_ZIP_DEV;
|
96 |
} else {
|
97 |
+
return $exportServer . self::URL_ZIP;
|
98 |
}
|
99 |
}
|
100 |
|
104 |
*/
|
105 |
public function getXMLSyncUrl($dev = false)
|
106 |
{
|
107 |
+
$exportServer = $this->getExportServer();
|
108 |
if ($dev) {
|
109 |
+
return $exportServer . self::URL_XML_DEV;
|
110 |
} else {
|
111 |
+
return $exportServer . self::URL_XML;
|
112 |
}
|
113 |
|
114 |
}
|
128 |
public function getCountry($countryCode)
|
129 |
{
|
130 |
|
131 |
+
if (!isset($this->_countries[$countryCode])) {
|
132 |
$country = Mage::getModel('directory/country')->loadByCode($countryCode);
|
133 |
$this->_countries[$countryCode] = $country;
|
134 |
}
|
152 |
$text = trim($text, $delimiter);
|
153 |
|
154 |
// transliterate
|
155 |
+
if (function_exists('iconv')) {
|
|
|
156 |
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
|
157 |
}
|
158 |
|
162 |
// remove unwanted characters
|
163 |
$text = preg_replace('~[^_\w]+~', '', $text);
|
164 |
|
165 |
+
if (empty($text)) {
|
|
|
166 |
return null;
|
167 |
}
|
168 |
|
180 |
|
181 |
public function delTree($dir)
|
182 |
{
|
183 |
+
if (!file_exists($dir)) {
|
184 |
return;
|
185 |
}
|
186 |
+
$files = array_diff(scandir($dir), array('.', '..'));
|
187 |
foreach ($files as $file) {
|
188 |
+
if (is_dir("$dir/$file")) {
|
189 |
self::delTree("$dir/$file");
|
190 |
+
} else if (file_exists("$dir/$file")) {
|
191 |
@unlink("$dir/$file");
|
192 |
}
|
193 |
}
|
194 |
return rmdir($dir);
|
195 |
}
|
196 |
|
197 |
+
public function rewrittenProductUrl($productId, $categoryId, $storeId)
|
198 |
+
{
|
199 |
+
$coreUrl = Mage::getModel('core/url_rewrite');
|
200 |
+
$idPath = sprintf('product/%d', $productId);
|
201 |
+
if ($categoryId) {
|
202 |
+
$idPath = sprintf('%s/%d', $idPath, $categoryId);
|
203 |
+
}
|
204 |
+
$coreUrl->setStoreId($storeId);
|
205 |
+
$coreUrl->loadByIdPath($idPath);
|
206 |
+
|
207 |
+
return $coreUrl->getRequestPath();
|
208 |
+
}
|
209 |
+
|
210 |
+
}
|
app/code/local/Boxalino/Exporter/Model/Mysql4/Indexer.php
CHANGED
@@ -31,6 +31,9 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
31 |
|
32 |
protected $_attributesValuesByName = array();
|
33 |
|
|
|
|
|
|
|
34 |
protected $_files = array();
|
35 |
|
36 |
protected $_count = 0;
|
@@ -40,23 +43,32 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
40 |
/** @var int Actually used storeId */
|
41 |
protected $_storeId = 0;
|
42 |
|
43 |
-
protected $
|
|
|
44 |
|
45 |
protected $group = null;
|
46 |
|
47 |
protected $_helperExporter = null;
|
48 |
protected $_helperSearch = null;
|
|
|
49 |
|
50 |
protected $_entityIds = null;
|
|
|
51 |
|
52 |
/**
|
53 |
* @description Start of reindex
|
54 |
*/
|
55 |
public function reindexAll()
|
56 |
{
|
|
|
|
|
|
|
|
|
57 |
self::logMem('Indexer init');
|
|
|
|
|
|
|
58 |
$this->_websiteExport();
|
59 |
-
$this->_helperExporter->delTree($this->_dir);
|
60 |
return $this;
|
61 |
}
|
62 |
|
@@ -68,17 +80,18 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
68 |
{
|
69 |
$this->_helperExporter = Mage::helper('boxalinoexporter');
|
70 |
$this->_helperSearch = Mage::helper('boxalinoexporter');
|
71 |
-
|
72 |
-
foreach (Mage::app()->getWebsites() as $website) {
|
73 |
-
|
74 |
-
$this->_helperExporter->delTree($this->_dir);
|
75 |
-
self::logMem('After delTree');
|
76 |
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
79 |
}
|
|
|
80 |
|
81 |
-
$data = $this->_storeExport($
|
82 |
|
83 |
self::logMem('something with attributes - before');
|
84 |
|
@@ -96,12 +109,14 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
96 |
}
|
97 |
|
98 |
self::logMem('something with attributes - after');
|
99 |
-
$file = $this->prepareFiles($
|
100 |
self::logMem('Push files');
|
101 |
|
102 |
$this->pushXML($file);
|
103 |
$this->pushZip($file);
|
104 |
|
|
|
|
|
105 |
$this->_transformedCategories = array();
|
106 |
$this->_transformedTags = array();
|
107 |
$this->_transformedProducts = array();
|
@@ -114,41 +129,29 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
114 |
}
|
115 |
|
116 |
/**
|
117 |
-
* @description
|
118 |
-
* @param $
|
119 |
* @return array Data prepared for save to file
|
120 |
*/
|
121 |
-
protected function _storeExport($
|
122 |
{
|
123 |
-
$products = array();
|
124 |
$categories = array();
|
125 |
$tags = array();
|
126 |
self::logMem('Preparing data for website start');
|
127 |
-
foreach ($
|
128 |
-
|
129 |
-
$this->group = $group;
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
$tags = $this->_exportTags();
|
138 |
-
self::logMem('Without available languages');
|
139 |
-
$this->_availableLanguages[] = $this->_storeConfig['language'];
|
140 |
-
self::logMem('With available languages');
|
141 |
-
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
if ($this->_isEnabled()) {
|
146 |
-
$this->_exportCustomers();
|
147 |
-
$this->_exportTransactions();
|
148 |
-
$this->_exportProducts();
|
149 |
-
}
|
150 |
|
151 |
}
|
|
|
|
|
|
|
152 |
|
153 |
return array(
|
154 |
'categories' => $categories,
|
@@ -156,19 +159,53 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
156 |
);
|
157 |
}
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
/**
|
160 |
* @description Get configs for store by storeId
|
161 |
* @param int $storeId
|
162 |
* @return void
|
163 |
*/
|
164 |
-
protected function _prepareStoreConfig($storeId)
|
165 |
{
|
166 |
$this->_storeId = $storeId;
|
167 |
-
$this->_storeConfig =
|
168 |
|
169 |
-
$tmp = Mage::app()->getStore($this->_storeId)->getConfig('Boxalino_CemSearch/backend');
|
170 |
-
$this->_storeConfig['username'] = $tmp['username'];
|
171 |
-
$this->_storeConfig['password'] = $tmp['password'];
|
172 |
if (!$this->_helperExporter->isAvailableLanguages($this->_storeConfig['language'])) {
|
173 |
Mage::throwException($this->_helperExporter->__('Language "' . $this->_storeConfig['language'] . '" is not available.'));
|
174 |
}
|
@@ -190,8 +227,11 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
190 |
'sku',
|
191 |
'price',
|
192 |
'special_price',
|
|
|
|
|
193 |
'visibility',
|
194 |
'category_ids',
|
|
|
195 |
);
|
196 |
|
197 |
$attributes = array();
|
@@ -258,21 +298,6 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
258 |
unset($attributesWithId);
|
259 |
}
|
260 |
|
261 |
-
/**
|
262 |
-
* @description check if export is enabled for website
|
263 |
-
* @return bool
|
264 |
-
*/
|
265 |
-
protected function _isEnabled()
|
266 |
-
{
|
267 |
-
if (isset($this->_storeConfig['enabled']) && $this->_storeConfig['enabled']) {
|
268 |
-
return true;
|
269 |
-
} else if (!isset($this->_storeConfig['enabled']) && Mage::getStoreConfig('Boxalino_General/general/enabled')) {
|
270 |
-
return true;
|
271 |
-
}
|
272 |
-
|
273 |
-
return false;
|
274 |
-
}
|
275 |
-
|
276 |
/**
|
277 |
* @description Preparing categories to export
|
278 |
* @return array Categories
|
@@ -347,9 +372,11 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
347 |
|
348 |
/**
|
349 |
* @description Preparing products to export
|
|
|
|
|
350 |
* @return void
|
351 |
*/
|
352 |
-
protected function _exportProducts()
|
353 |
{
|
354 |
self::logMem('Products - start of export');
|
355 |
$attrs = $this->_listOfAttributes;
|
@@ -358,7 +385,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
358 |
$db = $this->_getReadAdapter();
|
359 |
$select = $db->select()
|
360 |
->from(
|
361 |
-
array('main_table' => 'eav_attribute'),
|
362 |
array(
|
363 |
'attribute_id',
|
364 |
'attribute_code',
|
@@ -366,7 +393,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
366 |
)
|
367 |
)
|
368 |
->joinInner(
|
369 |
-
array('additional_table' => 'catalog_eav_attribute'),
|
370 |
'additional_table.attribute_id = main_table.attribute_id'
|
371 |
)
|
372 |
->where('main_table.entity_type_id = ?', $this->getEntityIdFor('catalog_product'))
|
@@ -375,10 +402,11 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
375 |
self::logMem('Products - connected to DB, built attribute info query');
|
376 |
|
377 |
$attrsFromDb = array(
|
378 |
-
'int'
|
379 |
'varchar' => array(),
|
380 |
-
'text'
|
381 |
'decimal' => array(),
|
|
|
382 |
);
|
383 |
|
384 |
foreach ($db->fetchAll($select) as $r) {
|
@@ -397,19 +425,11 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
397 |
$page = 1;
|
398 |
$header = true;
|
399 |
|
400 |
-
$stores = array();
|
401 |
-
foreach ($this->group->getStores() as $store){
|
402 |
-
|
403 |
-
$stores[$store->getId()]['id'] = $store->getId();
|
404 |
-
$stores[$store->getId()]['lang'] = Mage::app()->getStore($store->getId())->getConfig('boxalinoexporter/export_data/language');
|
405 |
-
|
406 |
-
}
|
407 |
-
|
408 |
//prepare files
|
409 |
$filesMtM = array();
|
410 |
-
$tmp =array_keys($this->_attributesValuesByName);
|
411 |
$tmp[] = 'categories';
|
412 |
-
foreach($tmp as $attr){
|
413 |
|
414 |
$key = $attr;
|
415 |
|
@@ -417,8 +437,8 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
417 |
$key = 'category';
|
418 |
}
|
419 |
|
420 |
-
if (!file_exists(
|
421 |
-
mkdir(
|
422 |
}
|
423 |
|
424 |
$file = 'product_' . $attr . '.csv';
|
@@ -434,22 +454,42 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
434 |
$filesMtM[$attr] = $fh;
|
435 |
|
436 |
}
|
437 |
-
$tmp = null;
|
438 |
|
439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
if ($countMax > 0 && $this->_count >= $countMax) {
|
441 |
break;
|
442 |
}
|
443 |
|
444 |
-
foreach ($
|
445 |
-
|
446 |
-
$storeId = $
|
447 |
-
$
|
|
|
448 |
|
449 |
self::logMem('Products - fetch products - before');
|
450 |
$select = $db->select()
|
451 |
->from(
|
452 |
-
array('e' => 'catalog_product_entity')
|
453 |
)
|
454 |
->limit($limit, ($page - 1) * $limit);
|
455 |
|
@@ -477,58 +517,69 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
477 |
$joinColumns = array('value' => 'IF(t_s.value_id IS NULL, t_d.value, t_s.value)');
|
478 |
|
479 |
$select1 = $db->select()
|
480 |
-
->joinLeft(array('ea' => 'eav_attribute'), 't_d.attribute_id = ea.attribute_id', 'ea.attribute_code')
|
481 |
->where('t_d.store_id = ?', 0)
|
482 |
->where('t_d.entity_type_id = ?', $this->getEntityIdFor('catalog_product'))
|
483 |
->where('t_d.entity_id IN(?)', $ids);
|
484 |
$select2 = clone $select1;
|
485 |
$select3 = clone $select1;
|
486 |
$select4 = clone $select1;
|
|
|
487 |
|
488 |
$select1->from(
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
->joinLeft(
|
493 |
-
array('t_s' => 'catalog_product_entity_varchar'),
|
494 |
$joinCondition,
|
495 |
$joinColumns
|
496 |
)
|
497 |
->where('t_d.attribute_id IN(?)', $attrsFromDb['varchar']);
|
498 |
$select2->from(
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
->joinLeft(
|
503 |
-
array('t_s' => 'catalog_product_entity_text'),
|
504 |
$joinCondition,
|
505 |
$joinColumns
|
506 |
)
|
507 |
->where('t_d.attribute_id IN(?)', $attrsFromDb['text']);
|
508 |
$select3->from(
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
->joinLeft(
|
513 |
-
array('t_s' => 'catalog_product_entity_decimal'),
|
514 |
$joinCondition,
|
515 |
$joinColumns
|
516 |
)
|
517 |
->where('t_d.attribute_id IN(?)', $attrsFromDb['decimal']);
|
518 |
$select4->from(
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
->joinLeft(
|
523 |
-
array('t_s' => 'catalog_product_entity_int'),
|
524 |
$joinCondition,
|
525 |
$joinColumns
|
526 |
)
|
527 |
->where('t_d.attribute_id IN(?)', $attrsFromDb['int']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
|
529 |
$select = $db->select()
|
530 |
->union(
|
531 |
-
array($select1, $select2, $select3, $select4),
|
532 |
Zend_Db_Select::SQL_UNION_ALL
|
533 |
);
|
534 |
|
@@ -536,6 +587,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
536 |
$select2 = null;
|
537 |
$select3 = null;
|
538 |
$select4 = null;
|
|
|
539 |
foreach ($db->fetchAll($select) as $r) {
|
540 |
$products[$r['entity_id']][$r['attribute_code']] = $r['value'];
|
541 |
}
|
@@ -544,7 +596,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
544 |
self::logMem('Products - get stock - before');
|
545 |
$select = $db->select()
|
546 |
->from(
|
547 |
-
'cataloginventory_stock_status',
|
548 |
array(
|
549 |
'product_id',
|
550 |
'stock_status',
|
@@ -561,7 +613,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
561 |
self::logMem('Products - get products from website - before');
|
562 |
$select = $db->select()
|
563 |
->from(
|
564 |
-
'catalog_product_website',
|
565 |
array(
|
566 |
'product_id',
|
567 |
'website_id',
|
@@ -576,7 +628,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
576 |
self::logMem('Products - get products connections - before');
|
577 |
$select = $db->select()
|
578 |
->from(
|
579 |
-
'catalog_product_super_link',
|
580 |
array(
|
581 |
'product_id',
|
582 |
'parent_id',
|
@@ -591,7 +643,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
591 |
self::logMem('Products - get categories - before');
|
592 |
$select = $db->select()
|
593 |
->from(
|
594 |
-
'catalog_category_product',
|
595 |
array(
|
596 |
'product_id',
|
597 |
'category_id',
|
@@ -608,7 +660,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
608 |
foreach ($products as $product) {
|
609 |
self::logMem('Products - start transform');
|
610 |
|
611 |
-
if (count($product['website']) == 0) {
|
612 |
$product = null;
|
613 |
continue;
|
614 |
}
|
@@ -621,9 +673,23 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
621 |
if (array_key_exists('parent_id', $product)) {
|
622 |
$id = $product['parent_id'];
|
623 |
$haveParent = true;
|
624 |
-
}
|
625 |
-
|
626 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
627 |
}
|
628 |
|
629 |
foreach ($attrs as $attr) {
|
@@ -640,12 +706,16 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
640 |
|
641 |
$this->_attrProdCount[$attr] = true;
|
642 |
|
643 |
-
//
|
644 |
-
//
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
|
|
|
|
|
|
|
|
649 |
} else {
|
650 |
fputcsv($filesMtM[$attr], array($id, $val), $this->_helperExporter->XML_DELIMITER, $this->_helperExporter->XML_ENCLOSURE);
|
651 |
}
|
@@ -663,6 +733,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
663 |
case 'description':
|
664 |
case 'short_description':
|
665 |
case 'name':
|
|
|
666 |
$productParam[$attr . '_' . $lang] = $val;
|
667 |
break;
|
668 |
default:
|
@@ -687,7 +758,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
687 |
$productParam['entity_id'] = $id;
|
688 |
$this->_transformedProducts['products'][$id] = $productParam;
|
689 |
|
690 |
-
//Add categories
|
691 |
if (isset($product['categories']) && count($product['categories']) > 0) {
|
692 |
foreach ($product['categories'] as $cat) {
|
693 |
|
@@ -704,10 +775,39 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
704 |
$this->_count++;
|
705 |
$localeCount++;
|
706 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
707 |
} elseif (isset($this->_transformedProducts['products'][$id])) {
|
708 |
$this->_transformedProducts['products'][$id] = array_merge($this->_transformedProducts['products'][$id], $productParam);
|
709 |
}
|
710 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
711 |
$productParam = null;
|
712 |
$product = null;
|
713 |
|
@@ -733,6 +833,20 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
733 |
$this->_transformedProducts['products'] = null;
|
734 |
$this->_transformedProducts['products'] = array();
|
735 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
}
|
737 |
|
738 |
$page++;
|
@@ -748,7 +862,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
748 |
$db = null;
|
749 |
|
750 |
//close file
|
751 |
-
foreach($filesMtM as $f){
|
752 |
fclose($f);
|
753 |
}
|
754 |
|
@@ -757,10 +871,11 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
757 |
|
758 |
/**
|
759 |
* @description Preparing customers to export
|
|
|
760 |
* @return void
|
761 |
*
|
762 |
*/
|
763 |
-
protected function _exportCustomers()
|
764 |
{
|
765 |
|
766 |
if (!$this->_storeConfig['export_customers']) {
|
@@ -792,7 +907,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
792 |
$db = $this->_getReadAdapter();
|
793 |
$select = $db->select()
|
794 |
->from(
|
795 |
-
array('main_table' => 'eav_attribute'),
|
796 |
array(
|
797 |
'aid' => 'attribute_id',
|
798 |
'attribute_code',
|
@@ -800,13 +915,13 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
800 |
)
|
801 |
)
|
802 |
->joinInner(
|
803 |
-
array('additional_table' => 'customer_eav_attribute'),
|
804 |
'additional_table.attribute_id = main_table.attribute_id'
|
805 |
)
|
806 |
->joinLeft( // @todo is this left join still necessary?
|
807 |
-
array('scope_table' => 'customer_eav_attribute_website'),
|
808 |
'scope_table.attribute_id = main_table.attribute_id AND ' .
|
809 |
-
'scope_table.website_id = ' . $
|
810 |
)
|
811 |
->where('main_table.entity_type_id = ?', $this->getEntityIdFor('customer'))
|
812 |
->where('attribute_code IN ("dob", "gender")');
|
@@ -825,7 +940,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
825 |
|
826 |
$select = $db->select()
|
827 |
->from(
|
828 |
-
'customer_entity',
|
829 |
array('entity_id', 'created_at', 'updated_at')
|
830 |
)
|
831 |
->where('entity_type_id = ?', '1')->limit($limit, ($page - 1) * $limit);
|
@@ -844,7 +959,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
844 |
);
|
845 |
|
846 |
$select = $db->select()
|
847 |
-
->joinLeft(array('ea' => 'eav_attribute'), 'ce.attribute_id = ea.attribute_id', 'ea.attribute_code')
|
848 |
->where('ce.entity_type_id = ?', 1)
|
849 |
->where('ce.entity_id IN(?)', $ids);
|
850 |
|
@@ -854,23 +969,23 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
854 |
|
855 |
$selects = array();
|
856 |
|
857 |
-
if(count($attrsFromDb['varchar']) > 0){
|
858 |
$select1 = clone $select;
|
859 |
-
$select1->from(array('ce' => 'customer_entity_varchar'), $columns)
|
860 |
->where('ce.attribute_id IN(?)', $attrsFromDb['varchar']);
|
861 |
$selects[] = $select1;
|
862 |
}
|
863 |
|
864 |
-
if(count($attrsFromDb['int']) > 0){
|
865 |
$select2 = clone $select;
|
866 |
-
$select2->from(array('ce' => 'customer_entity_int'), $columns)
|
867 |
->where('ce.attribute_id IN(?)', $attrsFromDb['int']);
|
868 |
$selects[] = $select2;
|
869 |
}
|
870 |
|
871 |
-
if(count($attrsFromDb['datetime']) > 0){
|
872 |
$select3 = clone $select;
|
873 |
-
$select3->from(array('ce' => 'customer_entity_datetime'), $columns)
|
874 |
->where('ce.attribute_id IN(?)', $attrsFromDb['datetime']);
|
875 |
$selects[] = $select3;
|
876 |
}
|
@@ -893,7 +1008,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
893 |
|
894 |
$select = $db->select()
|
895 |
->from(
|
896 |
-
'eav_attribute',
|
897 |
array(
|
898 |
'attribute_id',
|
899 |
'attribute_code',
|
@@ -916,15 +1031,17 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
916 |
|
917 |
$select = $db->select()
|
918 |
->from(
|
919 |
-
'customer_address_entity',
|
920 |
array('entity_id')
|
921 |
)
|
922 |
-
->where('entity_type_id = ?',
|
923 |
-
->where('parent_id = ?', $id)
|
|
|
|
|
924 |
|
925 |
$select = $db->select()
|
926 |
->from(
|
927 |
-
'customer_address_entity_varchar',
|
928 |
array('attribute_id', 'value')
|
929 |
)
|
930 |
->where('entity_type_id = ?', $this->getEntityIdFor('customer_address'))
|
@@ -1012,7 +1129,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
1012 |
$select = $db
|
1013 |
->select()
|
1014 |
->from(
|
1015 |
-
array('order' => 'sales_flat_order'),
|
1016 |
array(
|
1017 |
'entity_id',
|
1018 |
'status',
|
@@ -1024,7 +1141,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
1024 |
)
|
1025 |
)
|
1026 |
->joinLeft(
|
1027 |
-
array('item' => 'sales_flat_order_item'),
|
1028 |
'order.entity_id = item.order_id',
|
1029 |
array(
|
1030 |
'product_id',
|
@@ -1093,18 +1210,18 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
1093 |
}
|
1094 |
|
1095 |
$transactions_to_save[] = array(
|
1096 |
-
'order_id'
|
1097 |
-
'entity_id'
|
1098 |
-
'customer_id'
|
1099 |
-
'price'
|
1100 |
-
'discounted_price'
|
1101 |
-
'quantity'
|
1102 |
'total_order_value' => ($transaction['base_subtotal'] + $transaction['shipping_amount']),
|
1103 |
-
'shipping_costs'
|
1104 |
-
'order_date'
|
1105 |
'confirmation_date' => $status == 1 ? $transaction['updated_at'] : null,
|
1106 |
-
'shipping_date'
|
1107 |
-
'status'
|
1108 |
);
|
1109 |
}
|
1110 |
|
@@ -1145,13 +1262,13 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
1145 |
/**
|
1146 |
* @description Preparing files to send
|
1147 |
*/
|
1148 |
-
protected function prepareFiles(
|
1149 |
{
|
1150 |
|
1151 |
//Prepare attributes
|
1152 |
$csvFiles = array();
|
1153 |
-
if (!file_exists(
|
1154 |
-
mkdir(
|
1155 |
}
|
1156 |
|
1157 |
//create csvs
|
@@ -1180,7 +1297,7 @@ abstract class Boxalino_Exporter_Model_Mysql4_Indexer extends Mage_Core_Model_My
|
|
1180 |
//csvs done
|
1181 |
|
1182 |
//Create name for file
|
1183 |
-
$exportFile = '/
|
1184 |
$csvFiles = array_filter($csvFiles);
|
1185 |
|
1186 |
//Create xml
|
@@ -1373,7 +1490,9 @@ XML;
|
|
1373 |
}
|
1374 |
|
1375 |
foreach ($attrs as $attr) {
|
1376 |
-
|
|
|
|
|
1377 |
$attr = $this->_helperSearch->sanitizeFieldName($attr);
|
1378 |
|
1379 |
//attribute
|
@@ -1440,6 +1559,34 @@ XML;
|
|
1440 |
}
|
1441 |
//#########################################################################
|
1442 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1443 |
//property
|
1444 |
$properties = $products->addChild('properties');
|
1445 |
$props = $this->prepareProperties($withTag);
|
@@ -1532,6 +1679,10 @@ XML;
|
|
1532 |
|
1533 |
$attrs = $this->_listOfAttributes;
|
1534 |
|
|
|
|
|
|
|
|
|
1535 |
foreach ($attrs as $attr) {
|
1536 |
$ptype = 'string';
|
1537 |
// set property type
|
@@ -1552,6 +1703,9 @@ XML;
|
|
1552 |
$ptype = 'id';
|
1553 |
break;
|
1554 |
case 'short_description':
|
|
|
|
|
|
|
1555 |
$ptype = 'text';
|
1556 |
break;
|
1557 |
case 'weight':
|
@@ -1562,14 +1716,14 @@ XML;
|
|
1562 |
break;
|
1563 |
}
|
1564 |
|
1565 |
-
if (isset($this->_attributesValuesByName[$attr])) {
|
1566 |
$properties[] = array(
|
1567 |
-
'id'
|
1568 |
-
'name'
|
1569 |
-
'ptype'
|
1570 |
-
'type'
|
1571 |
-
'field'
|
1572 |
-
'has_lang'
|
1573 |
'reference' => $attr
|
1574 |
);
|
1575 |
} elseif ($attr == 'category_ids') {
|
@@ -1581,7 +1735,10 @@ XML;
|
|
1581 |
switch ($attr) {
|
1582 |
case 'description':
|
1583 |
case 'short_description':
|
|
|
|
|
1584 |
case 'name':
|
|
|
1585 |
$lang = true;
|
1586 |
break;
|
1587 |
default:
|
@@ -1589,12 +1746,12 @@ XML;
|
|
1589 |
break;
|
1590 |
}
|
1591 |
$properties[] = array(
|
1592 |
-
'id'
|
1593 |
-
'name'
|
1594 |
-
'ptype'
|
1595 |
-
'type'
|
1596 |
-
'field'
|
1597 |
-
'has_lang'
|
1598 |
'reference' => $ref
|
1599 |
);
|
1600 |
}
|
@@ -1602,12 +1759,12 @@ XML;
|
|
1602 |
//tag
|
1603 |
if ($this->_storeConfig['export_tags'] && $withTag) {
|
1604 |
$properties[] = array(
|
1605 |
-
'id'
|
1606 |
-
'name'
|
1607 |
-
'ptype'
|
1608 |
-
'type'
|
1609 |
-
'field'
|
1610 |
-
'has_lang'
|
1611 |
'reference' => 'tag'
|
1612 |
);
|
1613 |
}
|
@@ -1615,22 +1772,48 @@ XML;
|
|
1615 |
//categories
|
1616 |
if ($this->_storeConfig['export_categories']) {
|
1617 |
$properties[] = array(
|
1618 |
-
'id'
|
1619 |
-
'name'
|
1620 |
-
'ptype'
|
1621 |
-
'type'
|
1622 |
-
'field'
|
1623 |
-
'has_lang'
|
1624 |
'reference' => 'categories'
|
1625 |
);
|
1626 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1627 |
$properties[] = array(
|
1628 |
-
'id'
|
1629 |
-
'name'
|
1630 |
-
'ptype'
|
1631 |
-
'type'
|
1632 |
-
'field'
|
1633 |
-
'has_lang'
|
1634 |
'reference' => null
|
1635 |
);
|
1636 |
|
@@ -1647,48 +1830,66 @@ XML;
|
|
1647 |
@unlink($name);
|
1648 |
};
|
1649 |
|
|
|
|
|
1650 |
$zip = new ZipArchive();
|
1651 |
if ($zip->open($name, ZIPARCHIVE::CREATE)) {
|
1652 |
|
1653 |
foreach ($csvFiles as $f) {
|
1654 |
-
if (!$zip->addFile('/
|
1655 |
-
throw new Exception(
|
|
|
|
|
|
|
|
|
1656 |
}
|
1657 |
}
|
1658 |
|
1659 |
if (!$zip->addFile($xml, 'properties.xml')) {
|
1660 |
-
throw new Exception(
|
|
|
|
|
|
|
|
|
1661 |
}
|
1662 |
|
1663 |
if (!$zip->close()) {
|
1664 |
-
throw new Exception(
|
|
|
|
|
|
|
1665 |
}
|
1666 |
|
1667 |
} else {
|
1668 |
-
throw new Exception(
|
|
|
|
|
|
|
1669 |
}
|
1670 |
}
|
1671 |
|
1672 |
protected function pushXML($file)
|
1673 |
{
|
1674 |
-
|
1675 |
$fields = array(
|
1676 |
'username' => $this->_storeConfig['di_username'],
|
1677 |
'password' => $this->_storeConfig['di_password'],
|
1678 |
-
'account'
|
1679 |
'template' => 'standard_source',
|
1680 |
-
'xml'
|
1681 |
);
|
1682 |
|
1683 |
$url = $this->_helperExporter->getXMLSyncUrl($this->_storeConfig['account_dev']);
|
1684 |
-
|
1685 |
return $this->pushFile($fields, $url, 'xml');
|
1686 |
|
1687 |
}
|
1688 |
|
1689 |
protected function pushFile($fields, $url, $type)
|
1690 |
{
|
|
|
|
|
|
|
1691 |
|
|
|
1692 |
$s = curl_init();
|
1693 |
|
1694 |
curl_setopt($s, CURLOPT_URL, $url);
|
@@ -1701,8 +1902,10 @@ XML;
|
|
1701 |
$responseBody = curl_exec($s);
|
1702 |
curl_close($s);
|
1703 |
if (strpos($responseBody, 'Internal Server Error') !== false) {
|
|
|
1704 |
Mage::throwException($this->_helperExporter->getError($responseBody));;
|
1705 |
}
|
|
|
1706 |
return $responseBody;
|
1707 |
}
|
1708 |
|
@@ -1714,10 +1917,10 @@ XML;
|
|
1714 |
$fields = array(
|
1715 |
'username' => $this->_storeConfig['di_username'],
|
1716 |
'password' => $this->_storeConfig['di_password'],
|
1717 |
-
'account'
|
1718 |
-
'dev'
|
1719 |
-
'delta'
|
1720 |
-
'data'
|
1721 |
);
|
1722 |
|
1723 |
$url = $this->_helperExporter->getZIPSyncUrl($this->_storeConfig['account_dev']);
|
@@ -1725,11 +1928,23 @@ XML;
|
|
1725 |
return $this->pushFile($fields, $url, 'zip');
|
1726 |
}
|
1727 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1728 |
protected function savePartToCsv($file, &$data)
|
1729 |
{
|
1730 |
|
1731 |
-
if (!file_exists(
|
1732 |
-
mkdir(
|
1733 |
}
|
1734 |
|
1735 |
//save
|
@@ -1776,7 +1991,7 @@ XML;
|
|
1776 |
$db = $this->_getReadAdapter();
|
1777 |
$select = $db->select()
|
1778 |
->from(
|
1779 |
-
'eav_entity_type',
|
1780 |
array('entity_type_id', 'entity_type_code')
|
1781 |
);
|
1782 |
$this->_entityIds = array();
|
@@ -1786,5 +2001,4 @@ XML;
|
|
1786 |
}
|
1787 |
return array_key_exists($entityType, $this->_entityIds) ? $this->_entityIds[$entityType] : null;
|
1788 |
}
|
1789 |
-
|
1790 |
-
}
|
31 |
|
32 |
protected $_attributesValuesByName = array();
|
33 |
|
34 |
+
protected $_productsImages = array();
|
35 |
+
protected $_productsThumbnails = array();
|
36 |
+
|
37 |
protected $_files = array();
|
38 |
|
39 |
protected $_count = 0;
|
43 |
/** @var int Actually used storeId */
|
44 |
protected $_storeId = 0;
|
45 |
|
46 |
+
protected $_mainDir = '/tmp/boxalino';
|
47 |
+
protected $_dir = '';
|
48 |
|
49 |
protected $group = null;
|
50 |
|
51 |
protected $_helperExporter = null;
|
52 |
protected $_helperSearch = null;
|
53 |
+
protected $_helperImage = null;
|
54 |
|
55 |
protected $_entityIds = null;
|
56 |
+
protected $_prefix = '';
|
57 |
|
58 |
/**
|
59 |
* @description Start of reindex
|
60 |
*/
|
61 |
public function reindexAll()
|
62 |
{
|
63 |
+
|
64 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
65 |
+
$this->_prefix = $prefix;
|
66 |
+
|
67 |
self::logMem('Indexer init');
|
68 |
+
if (!file_exists($this->_mainDir)) {
|
69 |
+
mkdir($this->_mainDir);
|
70 |
+
}
|
71 |
$this->_websiteExport();
|
|
|
72 |
return $this;
|
73 |
}
|
74 |
|
80 |
{
|
81 |
$this->_helperExporter = Mage::helper('boxalinoexporter');
|
82 |
$this->_helperSearch = Mage::helper('boxalinoexporter');
|
83 |
+
$this->_helperImage = Mage::helper('catalog/image');
|
|
|
|
|
|
|
|
|
84 |
|
85 |
+
self::logMem('Helpers init');
|
86 |
+
$indexStructure = $this->_getIndexStructure();
|
87 |
+
foreach ($indexStructure as $index => $languages) {
|
88 |
+
$this->_dir = $this->_mainDir . '/' . $index;
|
89 |
+
if (file_exists($this->_dir)) {
|
90 |
+
$this->_helperExporter->delTree($this->_dir);
|
91 |
}
|
92 |
+
self::logMem('After delTree');
|
93 |
|
94 |
+
$data = $this->_storeExport($languages);
|
95 |
|
96 |
self::logMem('something with attributes - before');
|
97 |
|
109 |
}
|
110 |
|
111 |
self::logMem('something with attributes - after');
|
112 |
+
$file = $this->prepareFiles($data['categories'], $data['tags']);
|
113 |
self::logMem('Push files');
|
114 |
|
115 |
$this->pushXML($file);
|
116 |
$this->pushZip($file);
|
117 |
|
118 |
+
self::logMem('Files pushed');
|
119 |
+
|
120 |
$this->_transformedCategories = array();
|
121 |
$this->_transformedTags = array();
|
122 |
$this->_transformedProducts = array();
|
129 |
}
|
130 |
|
131 |
/**
|
132 |
+
* @description generate the data for the language scope
|
133 |
+
* @param array $languages Array of languages to generate for this index
|
134 |
* @return array Data prepared for save to file
|
135 |
*/
|
136 |
+
protected function _storeExport($languages)
|
137 |
{
|
|
|
138 |
$categories = array();
|
139 |
$tags = array();
|
140 |
self::logMem('Preparing data for website start');
|
141 |
+
foreach ($languages as $language => $info) {
|
142 |
+
$storeId = $info['store']->getId();
|
|
|
143 |
|
144 |
+
self::logMem('Start store:' . $storeId);
|
145 |
+
$this->_prepareStoreConfig($storeId, $info['config']);
|
146 |
+
self::logMem('Configuration for store loaded');
|
147 |
+
$categories = $this->_exportCategories();
|
148 |
+
$tags = $this->_exportTags();
|
149 |
+
$this->_availableLanguages[] = $language;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
}
|
152 |
+
$this->_exportCustomers($info['website']);
|
153 |
+
$this->_exportTransactions();
|
154 |
+
$this->_exportProducts($languages);
|
155 |
|
156 |
return array(
|
157 |
'categories' => $categories,
|
159 |
);
|
160 |
}
|
161 |
|
162 |
+
/**
|
163 |
+
* @description generate the index structure to iterate on
|
164 |
+
* @return array Index structure
|
165 |
+
*/
|
166 |
+
protected function _getIndexStructure()
|
167 |
+
{
|
168 |
+
$indexStructure = array();
|
169 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
170 |
+
foreach ($website->getGroups() as $group) {
|
171 |
+
foreach ($group->getStores() as $store) {
|
172 |
+
$config = array_merge(
|
173 |
+
$store->getConfig('boxalinoexporter/export_data'),
|
174 |
+
$store->getConfig('Boxalino_General/general')
|
175 |
+
);
|
176 |
+
if ($config['enabled'] == '1') {
|
177 |
+
$index = $config['di_account'];
|
178 |
+
$lang = $config['language'];
|
179 |
+
$config['groupId'] = $store->getGroupId();
|
180 |
+
|
181 |
+
if (!array_key_exists($index, $indexStructure)) {
|
182 |
+
$indexStructure[$index] = array();
|
183 |
+
}
|
184 |
+
if (!array_key_exists($lang, $indexStructure[$index])) {
|
185 |
+
$indexStructure[$index][$lang] = array();
|
186 |
+
}
|
187 |
+
$indexStructure[$index][$lang] = array(
|
188 |
+
'config' => $config,
|
189 |
+
'website' => $website,
|
190 |
+
'store' => $store,
|
191 |
+
);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
}
|
196 |
+
return $indexStructure;
|
197 |
+
}
|
198 |
+
|
199 |
/**
|
200 |
* @description Get configs for store by storeId
|
201 |
* @param int $storeId
|
202 |
* @return void
|
203 |
*/
|
204 |
+
protected function _prepareStoreConfig($storeId, $config)
|
205 |
{
|
206 |
$this->_storeId = $storeId;
|
207 |
+
$this->_storeConfig = $config;
|
208 |
|
|
|
|
|
|
|
209 |
if (!$this->_helperExporter->isAvailableLanguages($this->_storeConfig['language'])) {
|
210 |
Mage::throwException($this->_helperExporter->__('Language "' . $this->_storeConfig['language'] . '" is not available.'));
|
211 |
}
|
227 |
'sku',
|
228 |
'price',
|
229 |
'special_price',
|
230 |
+
'special_from_date',
|
231 |
+
'special_to_date',
|
232 |
'visibility',
|
233 |
'category_ids',
|
234 |
+
'status'
|
235 |
);
|
236 |
|
237 |
$attributes = array();
|
298 |
unset($attributesWithId);
|
299 |
}
|
300 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
/**
|
302 |
* @description Preparing categories to export
|
303 |
* @return array Categories
|
372 |
|
373 |
/**
|
374 |
* @description Preparing products to export
|
375 |
+
* @param array $languages language structure
|
376 |
+
* @param Mage_Core_Model_Store $storeObject
|
377 |
* @return void
|
378 |
*/
|
379 |
+
protected function _exportProducts($languages)
|
380 |
{
|
381 |
self::logMem('Products - start of export');
|
382 |
$attrs = $this->_listOfAttributes;
|
385 |
$db = $this->_getReadAdapter();
|
386 |
$select = $db->select()
|
387 |
->from(
|
388 |
+
array('main_table' => $this->_prefix . 'eav_attribute'),
|
389 |
array(
|
390 |
'attribute_id',
|
391 |
'attribute_code',
|
393 |
)
|
394 |
)
|
395 |
->joinInner(
|
396 |
+
array('additional_table' => $this->_prefix . 'catalog_eav_attribute'),
|
397 |
'additional_table.attribute_id = main_table.attribute_id'
|
398 |
)
|
399 |
->where('main_table.entity_type_id = ?', $this->getEntityIdFor('catalog_product'))
|
402 |
self::logMem('Products - connected to DB, built attribute info query');
|
403 |
|
404 |
$attrsFromDb = array(
|
405 |
+
'int' => array(),
|
406 |
'varchar' => array(),
|
407 |
+
'text' => array(),
|
408 |
'decimal' => array(),
|
409 |
+
'datetime' => array(),
|
410 |
);
|
411 |
|
412 |
foreach ($db->fetchAll($select) as $r) {
|
425 |
$page = 1;
|
426 |
$header = true;
|
427 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
//prepare files
|
429 |
$filesMtM = array();
|
430 |
+
$tmp = array_keys($this->_attributesValuesByName);
|
431 |
$tmp[] = 'categories';
|
432 |
+
foreach ($tmp as $attr) {
|
433 |
|
434 |
$key = $attr;
|
435 |
|
437 |
$key = 'category';
|
438 |
}
|
439 |
|
440 |
+
if (!file_exists($this->_dir)) {
|
441 |
+
mkdir($this->_dir);
|
442 |
}
|
443 |
|
444 |
$file = 'product_' . $attr . '.csv';
|
454 |
$filesMtM[$attr] = $fh;
|
455 |
|
456 |
}
|
|
|
457 |
|
458 |
+
if ($this->_storeConfig['export_product_images']) {
|
459 |
+
$file = 'product_cache_image_url.csv';
|
460 |
+
if (!in_array($file, $this->_files)) {
|
461 |
+
$this->_files[] = $file;
|
462 |
+
}
|
463 |
+
$fh = fopen($this->_dir . '/' . $file, 'a');
|
464 |
+
$h = array('entity_id', 'cache_image_url');
|
465 |
+
fputcsv($fh, $h, $this->_helperExporter->XML_DELIMITER, $this->_helperExporter->XML_ENCLOSURE);
|
466 |
+
}
|
467 |
+
|
468 |
+
if ($this->_storeConfig['export_product_images_thumbnail']) {
|
469 |
+
$file = 'product_cache_image_thumbnail_url.csv';
|
470 |
+
if (!in_array($file, $this->_files)) {
|
471 |
+
$this->_files[] = $file;
|
472 |
+
}
|
473 |
+
$fh = fopen($this->_dir . '/' . $file, 'a');
|
474 |
+
$h = array('entity_id', 'cache_image_thumbnail_url');
|
475 |
+
fputcsv($fh, $h, $this->_helperExporter->XML_DELIMITER, $this->_helperExporter->XML_ENCLOSURE);
|
476 |
+
}
|
477 |
+
|
478 |
+
while ($count >= $limit) {
|
479 |
if ($countMax > 0 && $this->_count >= $countMax) {
|
480 |
break;
|
481 |
}
|
482 |
|
483 |
+
foreach ($languages as $lang => $info) {
|
484 |
+
$storeObject = $info['store'];
|
485 |
+
$storeId = $storeObject->getId();
|
486 |
+
$storeBaseUrl = $storeObject->getBaseUrl();
|
487 |
+
$storeCode = $storeObject->getCode();
|
488 |
|
489 |
self::logMem('Products - fetch products - before');
|
490 |
$select = $db->select()
|
491 |
->from(
|
492 |
+
array('e' => $this->_prefix . 'catalog_product_entity')
|
493 |
)
|
494 |
->limit($limit, ($page - 1) * $limit);
|
495 |
|
517 |
$joinColumns = array('value' => 'IF(t_s.value_id IS NULL, t_d.value, t_s.value)');
|
518 |
|
519 |
$select1 = $db->select()
|
520 |
+
->joinLeft(array('ea' => $this->_prefix . 'eav_attribute'), 't_d.attribute_id = ea.attribute_id', 'ea.attribute_code')
|
521 |
->where('t_d.store_id = ?', 0)
|
522 |
->where('t_d.entity_type_id = ?', $this->getEntityIdFor('catalog_product'))
|
523 |
->where('t_d.entity_id IN(?)', $ids);
|
524 |
$select2 = clone $select1;
|
525 |
$select3 = clone $select1;
|
526 |
$select4 = clone $select1;
|
527 |
+
$select5 = clone $select1;
|
528 |
|
529 |
$select1->from(
|
530 |
+
array('t_d' => $this->_prefix . 'catalog_product_entity_varchar'),
|
531 |
+
$columns
|
532 |
+
)
|
533 |
->joinLeft(
|
534 |
+
array('t_s' => $this->_prefix . 'catalog_product_entity_varchar'),
|
535 |
$joinCondition,
|
536 |
$joinColumns
|
537 |
)
|
538 |
->where('t_d.attribute_id IN(?)', $attrsFromDb['varchar']);
|
539 |
$select2->from(
|
540 |
+
array('t_d' => $this->_prefix . 'catalog_product_entity_text'),
|
541 |
+
$columns
|
542 |
+
)
|
543 |
->joinLeft(
|
544 |
+
array('t_s' => $this->_prefix . 'catalog_product_entity_text'),
|
545 |
$joinCondition,
|
546 |
$joinColumns
|
547 |
)
|
548 |
->where('t_d.attribute_id IN(?)', $attrsFromDb['text']);
|
549 |
$select3->from(
|
550 |
+
array('t_d' => $this->_prefix . 'catalog_product_entity_decimal'),
|
551 |
+
$columns
|
552 |
+
)
|
553 |
->joinLeft(
|
554 |
+
array('t_s' => $this->_prefix . 'catalog_product_entity_decimal'),
|
555 |
$joinCondition,
|
556 |
$joinColumns
|
557 |
)
|
558 |
->where('t_d.attribute_id IN(?)', $attrsFromDb['decimal']);
|
559 |
$select4->from(
|
560 |
+
array('t_d' => $this->_prefix . 'catalog_product_entity_int'),
|
561 |
+
$columns
|
562 |
+
)
|
563 |
->joinLeft(
|
564 |
+
array('t_s' => $this->_prefix . 'catalog_product_entity_int'),
|
565 |
$joinCondition,
|
566 |
$joinColumns
|
567 |
)
|
568 |
->where('t_d.attribute_id IN(?)', $attrsFromDb['int']);
|
569 |
+
$select5->from(
|
570 |
+
array('t_d' => $this->_prefix . 'catalog_product_entity_datetime'),
|
571 |
+
$columns
|
572 |
+
)
|
573 |
+
->joinLeft(
|
574 |
+
array('t_s' => $this->_prefix . 'catalog_product_entity_datetime'),
|
575 |
+
$joinCondition,
|
576 |
+
$joinColumns
|
577 |
+
)
|
578 |
+
->where('t_d.attribute_id IN(?)', $attrsFromDb['datetime']);
|
579 |
|
580 |
$select = $db->select()
|
581 |
->union(
|
582 |
+
array($select1, $select2, $select3, $select4, $select5),
|
583 |
Zend_Db_Select::SQL_UNION_ALL
|
584 |
);
|
585 |
|
587 |
$select2 = null;
|
588 |
$select3 = null;
|
589 |
$select4 = null;
|
590 |
+
$select5 = null;
|
591 |
foreach ($db->fetchAll($select) as $r) {
|
592 |
$products[$r['entity_id']][$r['attribute_code']] = $r['value'];
|
593 |
}
|
596 |
self::logMem('Products - get stock - before');
|
597 |
$select = $db->select()
|
598 |
->from(
|
599 |
+
$this->_prefix . 'cataloginventory_stock_status',
|
600 |
array(
|
601 |
'product_id',
|
602 |
'stock_status',
|
613 |
self::logMem('Products - get products from website - before');
|
614 |
$select = $db->select()
|
615 |
->from(
|
616 |
+
$this->_prefix . 'catalog_product_website',
|
617 |
array(
|
618 |
'product_id',
|
619 |
'website_id',
|
628 |
self::logMem('Products - get products connections - before');
|
629 |
$select = $db->select()
|
630 |
->from(
|
631 |
+
$this->_prefix . 'catalog_product_super_link',
|
632 |
array(
|
633 |
'product_id',
|
634 |
'parent_id',
|
643 |
self::logMem('Products - get categories - before');
|
644 |
$select = $db->select()
|
645 |
->from(
|
646 |
+
$this->_prefix . 'catalog_category_product',
|
647 |
array(
|
648 |
'product_id',
|
649 |
'category_id',
|
660 |
foreach ($products as $product) {
|
661 |
self::logMem('Products - start transform');
|
662 |
|
663 |
+
if (count($product['website']) == 0 || !in_array($this->_storeConfig['groupId'], $product['website'])) {
|
664 |
$product = null;
|
665 |
continue;
|
666 |
}
|
673 |
if (array_key_exists('parent_id', $product)) {
|
674 |
$id = $product['parent_id'];
|
675 |
$haveParent = true;
|
676 |
+
}
|
677 |
+
|
678 |
+
// apply special price time range
|
679 |
+
if (
|
680 |
+
!empty($product['special_price']) &&
|
681 |
+
$product['price'] > $product['special_price'] && (
|
682 |
+
!empty($product['special_from_date']) ||
|
683 |
+
!empty($product['special_to_date'])
|
684 |
+
)
|
685 |
+
) {
|
686 |
+
$product['special_price'] = Mage_Catalog_Model_Product_Type_Price::calculateSpecialPrice(
|
687 |
+
$product['price'],
|
688 |
+
$product['special_price'],
|
689 |
+
$product['special_from_date'],
|
690 |
+
$product['special_to_date'],
|
691 |
+
$storeObject
|
692 |
+
);
|
693 |
}
|
694 |
|
695 |
foreach ($attrs as $attr) {
|
706 |
|
707 |
$this->_attrProdCount[$attr] = true;
|
708 |
|
709 |
+
// visibility as defined in Mage_Catalog_Model_Product_Visibility:
|
710 |
+
// 4 - VISIBILITY_BOTH
|
711 |
+
// 3 - VISIBILITY_IN_SEARCH
|
712 |
+
// 2 - VISIBILITY_IN_CATALOG
|
713 |
+
// 1 - VISIBILITY_NOT_VISIBLE
|
714 |
+
// status as defined in Mage_Catalog_Model_Product_Status:
|
715 |
+
// 2 - STATUS_DISABLED
|
716 |
+
// 1 - STATUS_ENABLED
|
717 |
+
if ($attr == 'visibility' || $attr == 'status') {
|
718 |
+
$productParam[$attr . '_' . $lang] = $val;
|
719 |
} else {
|
720 |
fputcsv($filesMtM[$attr], array($id, $val), $this->_helperExporter->XML_DELIMITER, $this->_helperExporter->XML_ENCLOSURE);
|
721 |
}
|
733 |
case 'description':
|
734 |
case 'short_description':
|
735 |
case 'name':
|
736 |
+
case 'status':
|
737 |
$productParam[$attr . '_' . $lang] = $val;
|
738 |
break;
|
739 |
default:
|
758 |
$productParam['entity_id'] = $id;
|
759 |
$this->_transformedProducts['products'][$id] = $productParam;
|
760 |
|
761 |
+
// Add categories
|
762 |
if (isset($product['categories']) && count($product['categories']) > 0) {
|
763 |
foreach ($product['categories'] as $cat) {
|
764 |
|
775 |
$this->_count++;
|
776 |
$localeCount++;
|
777 |
|
778 |
+
/**
|
779 |
+
* Add special fields
|
780 |
+
*/
|
781 |
+
//Add url to image cache
|
782 |
+
if ($this->_storeConfig['export_product_images']) {
|
783 |
+
$_product = Mage::getModel('catalog/product')->load($id);
|
784 |
+
$media_gallery = $_product->getMediaGallery();
|
785 |
+
foreach ($media_gallery['images'] as $_image) {
|
786 |
+
$url = $this->_helperImage->init($_product, 'image', $_image['file'])->__toString();
|
787 |
+
$url_tbm = $this->_helperImage->init($_product, 'thumbnail', $_image['file'])->resize(100)->__toString();
|
788 |
+
|
789 |
+
$this->_productsImages[] = array($id, $url);
|
790 |
+
$this->_productsThumbnails[] = array($id, $url_tbm);
|
791 |
+
}
|
792 |
+
}
|
793 |
+
|
794 |
} elseif (isset($this->_transformedProducts['products'][$id])) {
|
795 |
$this->_transformedProducts['products'][$id] = array_merge($this->_transformedProducts['products'][$id], $productParam);
|
796 |
}
|
797 |
|
798 |
+
/**
|
799 |
+
* Add url to product for each languages
|
800 |
+
*/
|
801 |
+
if ($this->_storeConfig['export_product_url']) {
|
802 |
+
$this->_transformedProducts['products'][$id] =
|
803 |
+
array_merge(
|
804 |
+
$this->_transformedProducts['products'][$id],
|
805 |
+
array(
|
806 |
+
'default_url_' . $lang => $storeBaseUrl . $this->_helperExporter->rewrittenProductUrl($id, null, $storeId) . '?___store=' . $storeCode
|
807 |
+
)
|
808 |
+
);
|
809 |
+
}
|
810 |
+
|
811 |
$productParam = null;
|
812 |
$product = null;
|
813 |
|
833 |
$this->_transformedProducts['products'] = null;
|
834 |
$this->_transformedProducts['products'] = array();
|
835 |
|
836 |
+
if ($this->_storeConfig['export_product_images']) {
|
837 |
+
self::logMem('Products - save images');
|
838 |
+
|
839 |
+
$d = $this->_productsImages;
|
840 |
+
$this->savePartToCsv('product_cache_image_url.csv', $d);
|
841 |
+
$d = null;
|
842 |
+
|
843 |
+
$d = $this->_productsThumbnails;
|
844 |
+
$this->savePartToCsv('product_cache_image_thumbnail_url.csv', $d);
|
845 |
+
$d = null;
|
846 |
+
$this->_productsImages = array();
|
847 |
+
$this->_productsThumbnails = array();
|
848 |
+
}
|
849 |
+
|
850 |
}
|
851 |
|
852 |
$page++;
|
862 |
$db = null;
|
863 |
|
864 |
//close file
|
865 |
+
foreach ($filesMtM as $f) {
|
866 |
fclose($f);
|
867 |
}
|
868 |
|
871 |
|
872 |
/**
|
873 |
* @description Preparing customers to export
|
874 |
+
* @param Mage_Core_Model_Website $website
|
875 |
* @return void
|
876 |
*
|
877 |
*/
|
878 |
+
protected function _exportCustomers(Mage_Core_Model_Website $website)
|
879 |
{
|
880 |
|
881 |
if (!$this->_storeConfig['export_customers']) {
|
907 |
$db = $this->_getReadAdapter();
|
908 |
$select = $db->select()
|
909 |
->from(
|
910 |
+
array('main_table' => $this->_prefix . 'eav_attribute'),
|
911 |
array(
|
912 |
'aid' => 'attribute_id',
|
913 |
'attribute_code',
|
915 |
)
|
916 |
)
|
917 |
->joinInner(
|
918 |
+
array('additional_table' => $this->_prefix . 'customer_eav_attribute'),
|
919 |
'additional_table.attribute_id = main_table.attribute_id'
|
920 |
)
|
921 |
->joinLeft( // @todo is this left join still necessary?
|
922 |
+
array('scope_table' => $this->_prefix . 'customer_eav_attribute_website'),
|
923 |
'scope_table.attribute_id = main_table.attribute_id AND ' .
|
924 |
+
'scope_table.website_id = ' . $website->getId()
|
925 |
)
|
926 |
->where('main_table.entity_type_id = ?', $this->getEntityIdFor('customer'))
|
927 |
->where('attribute_code IN ("dob", "gender")');
|
940 |
|
941 |
$select = $db->select()
|
942 |
->from(
|
943 |
+
$this->_prefix . 'customer_entity',
|
944 |
array('entity_id', 'created_at', 'updated_at')
|
945 |
)
|
946 |
->where('entity_type_id = ?', '1')->limit($limit, ($page - 1) * $limit);
|
959 |
);
|
960 |
|
961 |
$select = $db->select()
|
962 |
+
->joinLeft(array('ea' => $this->_prefix . 'eav_attribute'), 'ce.attribute_id = ea.attribute_id', 'ea.attribute_code')
|
963 |
->where('ce.entity_type_id = ?', 1)
|
964 |
->where('ce.entity_id IN(?)', $ids);
|
965 |
|
969 |
|
970 |
$selects = array();
|
971 |
|
972 |
+
if (count($attrsFromDb['varchar']) > 0) {
|
973 |
$select1 = clone $select;
|
974 |
+
$select1->from(array('ce' => $this->_prefix . 'customer_entity_varchar'), $columns)
|
975 |
->where('ce.attribute_id IN(?)', $attrsFromDb['varchar']);
|
976 |
$selects[] = $select1;
|
977 |
}
|
978 |
|
979 |
+
if (count($attrsFromDb['int']) > 0) {
|
980 |
$select2 = clone $select;
|
981 |
+
$select2->from(array('ce' => $this->_prefix . 'customer_entity_int'), $columns)
|
982 |
->where('ce.attribute_id IN(?)', $attrsFromDb['int']);
|
983 |
$selects[] = $select2;
|
984 |
}
|
985 |
|
986 |
+
if (count($attrsFromDb['datetime']) > 0) {
|
987 |
$select3 = clone $select;
|
988 |
+
$select3->from(array('ce' => $this->_prefix . 'customer_entity_datetime'), $columns)
|
989 |
->where('ce.attribute_id IN(?)', $attrsFromDb['datetime']);
|
990 |
$selects[] = $select3;
|
991 |
}
|
1008 |
|
1009 |
$select = $db->select()
|
1010 |
->from(
|
1011 |
+
$this->_prefix . 'eav_attribute',
|
1012 |
array(
|
1013 |
'attribute_id',
|
1014 |
'attribute_code',
|
1031 |
|
1032 |
$select = $db->select()
|
1033 |
->from(
|
1034 |
+
$this->_prefix . 'customer_address_entity',
|
1035 |
array('entity_id')
|
1036 |
)
|
1037 |
+
->where('entity_type_id = ?', $this->getEntityIdFor('customer_address'))
|
1038 |
+
->where('parent_id = ?', $id)
|
1039 |
+
->order('entity_id DESC')
|
1040 |
+
->limit(1);
|
1041 |
|
1042 |
$select = $db->select()
|
1043 |
->from(
|
1044 |
+
$this->_prefix . 'customer_address_entity_varchar',
|
1045 |
array('attribute_id', 'value')
|
1046 |
)
|
1047 |
->where('entity_type_id = ?', $this->getEntityIdFor('customer_address'))
|
1129 |
$select = $db
|
1130 |
->select()
|
1131 |
->from(
|
1132 |
+
array('order' => $this->_prefix . 'sales_flat_order'),
|
1133 |
array(
|
1134 |
'entity_id',
|
1135 |
'status',
|
1141 |
)
|
1142 |
)
|
1143 |
->joinLeft(
|
1144 |
+
array('item' => $this->_prefix . 'sales_flat_order_item'),
|
1145 |
'order.entity_id = item.order_id',
|
1146 |
array(
|
1147 |
'product_id',
|
1210 |
}
|
1211 |
|
1212 |
$transactions_to_save[] = array(
|
1213 |
+
'order_id' => $transaction['entity_id'],
|
1214 |
+
'entity_id' => $transaction['product_id'],
|
1215 |
+
'customer_id' => array_key_exists('customer_id', $transaction) ? $transaction['customer_id'] : '',
|
1216 |
+
'price' => $transaction['original_price'],
|
1217 |
+
'discounted_price' => $transaction['price'],
|
1218 |
+
'quantity' => $transaction['qty_ordered'],
|
1219 |
'total_order_value' => ($transaction['base_subtotal'] + $transaction['shipping_amount']),
|
1220 |
+
'shipping_costs' => $transaction['shipping_amount'],
|
1221 |
+
'order_date' => $transaction['created_at'],
|
1222 |
'confirmation_date' => $status == 1 ? $transaction['updated_at'] : null,
|
1223 |
+
'shipping_date' => $status == 2 ? $transaction['updated_at'] : null,
|
1224 |
+
'status' => $transaction['status'],
|
1225 |
);
|
1226 |
}
|
1227 |
|
1262 |
/**
|
1263 |
* @description Preparing files to send
|
1264 |
*/
|
1265 |
+
protected function prepareFiles(&$categories = null, &$tags = null)
|
1266 |
{
|
1267 |
|
1268 |
//Prepare attributes
|
1269 |
$csvFiles = array();
|
1270 |
+
if (!file_exists($this->_dir)) {
|
1271 |
+
mkdir($this->_dir);
|
1272 |
}
|
1273 |
|
1274 |
//create csvs
|
1297 |
//csvs done
|
1298 |
|
1299 |
//Create name for file
|
1300 |
+
$exportFile = $this->_dir . '/' . $this->_storeConfig['di_username'];
|
1301 |
$csvFiles = array_filter($csvFiles);
|
1302 |
|
1303 |
//Create xml
|
1490 |
}
|
1491 |
|
1492 |
foreach ($attrs as $attr) {
|
1493 |
+
if ($attr == 'visibility' || $attr == 'status') {
|
1494 |
+
continue;
|
1495 |
+
}
|
1496 |
$attr = $this->_helperSearch->sanitizeFieldName($attr);
|
1497 |
|
1498 |
//attribute
|
1559 |
}
|
1560 |
//#########################################################################
|
1561 |
|
1562 |
+
//########################################################################
|
1563 |
+
// IMAGES
|
1564 |
+
if ($this->_storeConfig['export_product_images']) {
|
1565 |
+
|
1566 |
+
//categories & products images
|
1567 |
+
$source = $sources->addChild('source');
|
1568 |
+
$source->addAttribute('type', 'item_data_file');
|
1569 |
+
$source->addAttribute('id', 'item_cache_image_url');
|
1570 |
+
|
1571 |
+
$source->addChild('file')->addAttribute('value', 'product_cache_image_url.csv');
|
1572 |
+
$source->addChild('itemIdColumn')->addAttribute('value', 'entity_id');
|
1573 |
+
|
1574 |
+
$this->sxml_append_options($source);
|
1575 |
+
}
|
1576 |
+
if ($this->_storeConfig['export_product_images_thumbnail']) {
|
1577 |
+
|
1578 |
+
//categories & products images
|
1579 |
+
$source = $sources->addChild('source');
|
1580 |
+
$source->addAttribute('type', 'item_data_file');
|
1581 |
+
$source->addAttribute('id', 'item_cache_image_thumbnail_url');
|
1582 |
+
|
1583 |
+
$source->addChild('file')->addAttribute('value', 'product_cache_image_thumbnail_url.csv');
|
1584 |
+
$source->addChild('itemIdColumn')->addAttribute('value', 'entity_id');
|
1585 |
+
|
1586 |
+
$this->sxml_append_options($source);
|
1587 |
+
}
|
1588 |
+
//#########################################################################
|
1589 |
+
|
1590 |
//property
|
1591 |
$properties = $products->addChild('properties');
|
1592 |
$props = $this->prepareProperties($withTag);
|
1679 |
|
1680 |
$attrs = $this->_listOfAttributes;
|
1681 |
|
1682 |
+
if ($this->_storeConfig['export_product_url']) {
|
1683 |
+
$attrs[] = 'default_url';
|
1684 |
+
}
|
1685 |
+
|
1686 |
foreach ($attrs as $attr) {
|
1687 |
$ptype = 'string';
|
1688 |
// set property type
|
1703 |
$ptype = 'id';
|
1704 |
break;
|
1705 |
case 'short_description':
|
1706 |
+
case 'status':
|
1707 |
+
case 'visibility':
|
1708 |
+
case 'default_url':
|
1709 |
$ptype = 'text';
|
1710 |
break;
|
1711 |
case 'weight':
|
1716 |
break;
|
1717 |
}
|
1718 |
|
1719 |
+
if (isset($this->_attributesValuesByName[$attr]) && $attr != 'visibility' && $attr != 'status') {
|
1720 |
$properties[] = array(
|
1721 |
+
'id' => $attr,
|
1722 |
+
'name' => $attr,
|
1723 |
+
'ptype' => 'text',
|
1724 |
+
'type' => 'reference',
|
1725 |
+
'field' => $attr . '_id',
|
1726 |
+
'has_lang' => false,
|
1727 |
'reference' => $attr
|
1728 |
);
|
1729 |
} elseif ($attr == 'category_ids') {
|
1735 |
switch ($attr) {
|
1736 |
case 'description':
|
1737 |
case 'short_description':
|
1738 |
+
case 'visibility':
|
1739 |
+
case 'status':
|
1740 |
case 'name':
|
1741 |
+
case 'default_url':
|
1742 |
$lang = true;
|
1743 |
break;
|
1744 |
default:
|
1746 |
break;
|
1747 |
}
|
1748 |
$properties[] = array(
|
1749 |
+
'id' => $attr,
|
1750 |
+
'name' => null,
|
1751 |
+
'ptype' => $ptype,
|
1752 |
+
'type' => $type,
|
1753 |
+
'field' => $field,
|
1754 |
+
'has_lang' => $lang,
|
1755 |
'reference' => $ref
|
1756 |
);
|
1757 |
}
|
1759 |
//tag
|
1760 |
if ($this->_storeConfig['export_tags'] && $withTag) {
|
1761 |
$properties[] = array(
|
1762 |
+
'id' => 'tag',
|
1763 |
+
'name' => 'tag',
|
1764 |
+
'ptype' => 'text',
|
1765 |
+
'type' => 'reference',
|
1766 |
+
'field' => 'tag_id',
|
1767 |
+
'has_lang' => false,
|
1768 |
'reference' => 'tag'
|
1769 |
);
|
1770 |
}
|
1772 |
//categories
|
1773 |
if ($this->_storeConfig['export_categories']) {
|
1774 |
$properties[] = array(
|
1775 |
+
'id' => 'category',
|
1776 |
+
'name' => 'categories', //property id
|
1777 |
+
'ptype' => 'hierarchical', //property type
|
1778 |
+
'type' => 'reference', //logic type
|
1779 |
+
'field' => 'category_id', //field colummn
|
1780 |
+
'has_lang' => false,
|
1781 |
'reference' => 'categories'
|
1782 |
);
|
1783 |
}
|
1784 |
+
|
1785 |
+
//images
|
1786 |
+
if ($this->_storeConfig['export_product_images']) {
|
1787 |
+
$properties[] = array(
|
1788 |
+
'id' => 'cache_image_url',
|
1789 |
+
'name' => 'cache_image_url', //property id
|
1790 |
+
'ptype' => 'string', //property type
|
1791 |
+
'type' => 'direct', //logic type
|
1792 |
+
'field' => 'cache_image_url', //field colummn
|
1793 |
+
'has_lang' => false,
|
1794 |
+
);
|
1795 |
+
}
|
1796 |
+
|
1797 |
+
//images
|
1798 |
+
if ($this->_storeConfig['export_product_images_thumbnail']) {
|
1799 |
+
$properties[] = array(
|
1800 |
+
'id' => 'cache_image_thumbnail_url',
|
1801 |
+
'name' => 'cache_image_thumbnail_url', //property id
|
1802 |
+
'ptype' => 'string', //property type
|
1803 |
+
'type' => 'direct', //logic type
|
1804 |
+
'field' => 'cache_image_thumbnail_url', //field colummn
|
1805 |
+
'has_lang' => false,
|
1806 |
+
);
|
1807 |
+
}
|
1808 |
+
|
1809 |
+
|
1810 |
$properties[] = array(
|
1811 |
+
'id' => 'product_entity_id',
|
1812 |
+
'name' => null,
|
1813 |
+
'ptype' => 'string',
|
1814 |
+
'type' => 'direct',
|
1815 |
+
'field' => 'entity_id',
|
1816 |
+
'has_lang' => false,
|
1817 |
'reference' => null
|
1818 |
);
|
1819 |
|
1830 |
@unlink($name);
|
1831 |
};
|
1832 |
|
1833 |
+
|
1834 |
+
|
1835 |
$zip = new ZipArchive();
|
1836 |
if ($zip->open($name, ZIPARCHIVE::CREATE)) {
|
1837 |
|
1838 |
foreach ($csvFiles as $f) {
|
1839 |
+
if (!$zip->addFile($this->_dir . '/' . $f, $f)) {
|
1840 |
+
throw new Exception(
|
1841 |
+
'Synchronization failure: Failed to add file "' .
|
1842 |
+
$this->_dir . '/' . $f . '" to the zip "' .
|
1843 |
+
$name . '". Please try again.'
|
1844 |
+
);
|
1845 |
}
|
1846 |
}
|
1847 |
|
1848 |
if (!$zip->addFile($xml, 'properties.xml')) {
|
1849 |
+
throw new Exception(
|
1850 |
+
'Synchronization failure: Failed to add file "' .
|
1851 |
+
$xml . '" to the zip "' .
|
1852 |
+
$name . '". Please try again.'
|
1853 |
+
);
|
1854 |
}
|
1855 |
|
1856 |
if (!$zip->close()) {
|
1857 |
+
throw new Exception(
|
1858 |
+
'Synchronization failure: Failed to close the zip "' .
|
1859 |
+
$name . '". Please try again.'
|
1860 |
+
);
|
1861 |
}
|
1862 |
|
1863 |
} else {
|
1864 |
+
throw new Exception(
|
1865 |
+
'Synchronization failure: Failed to open the zip "' .
|
1866 |
+
$name . '" for writing. Please check the permissions and try again.'
|
1867 |
+
);
|
1868 |
}
|
1869 |
}
|
1870 |
|
1871 |
protected function pushXML($file)
|
1872 |
{
|
|
|
1873 |
$fields = array(
|
1874 |
'username' => $this->_storeConfig['di_username'],
|
1875 |
'password' => $this->_storeConfig['di_password'],
|
1876 |
+
'account' => $this->_storeConfig['di_account'],
|
1877 |
'template' => 'standard_source',
|
1878 |
+
'xml' => file_get_contents($file . '.xml')
|
1879 |
);
|
1880 |
|
1881 |
$url = $this->_helperExporter->getXMLSyncUrl($this->_storeConfig['account_dev']);
|
|
|
1882 |
return $this->pushFile($fields, $url, 'xml');
|
1883 |
|
1884 |
}
|
1885 |
|
1886 |
protected function pushFile($fields, $url, $type)
|
1887 |
{
|
1888 |
+
if ($this->_getIndexType() == 'delta' && !in_array('products.csv', $this->_files)) {
|
1889 |
+
return 'skipped empty product delta sync';
|
1890 |
+
}
|
1891 |
|
1892 |
+
self::logMem($type . ' push');
|
1893 |
$s = curl_init();
|
1894 |
|
1895 |
curl_setopt($s, CURLOPT_URL, $url);
|
1902 |
$responseBody = curl_exec($s);
|
1903 |
curl_close($s);
|
1904 |
if (strpos($responseBody, 'Internal Server Error') !== false) {
|
1905 |
+
self::logMem($type . ' push error: ' . $responseBody);
|
1906 |
Mage::throwException($this->_helperExporter->getError($responseBody));;
|
1907 |
}
|
1908 |
+
self::logMem($type . ' pushed. Response: ' . $responseBody);
|
1909 |
return $responseBody;
|
1910 |
}
|
1911 |
|
1917 |
$fields = array(
|
1918 |
'username' => $this->_storeConfig['di_username'],
|
1919 |
'password' => $this->_storeConfig['di_password'],
|
1920 |
+
'account' => $this->_storeConfig['di_account'],
|
1921 |
+
'dev' => $this->_storeConfig['account_dev'] == 0 ? 'false' : 'true',
|
1922 |
+
'delta' => $this->_getIndexType() == 'delta' ? 'true' : 'false',
|
1923 |
+
'data' => $this->getCurlFile("@$file.zip", "application/zip"),
|
1924 |
);
|
1925 |
|
1926 |
$url = $this->_helperExporter->getZIPSyncUrl($this->_storeConfig['account_dev']);
|
1928 |
return $this->pushFile($fields, $url, 'zip');
|
1929 |
}
|
1930 |
|
1931 |
+
protected function getCurlFile($filename, $type)
|
1932 |
+
{
|
1933 |
+
try {
|
1934 |
+
if (class_exists('CURLFile')) {
|
1935 |
+
return new CURLFile(substr($filename, 1), $type);
|
1936 |
+
}
|
1937 |
+
} catch(Exception $e){
|
1938 |
+
return $filename . ";type=$type";
|
1939 |
+
}
|
1940 |
+
return $filename . ";type=$type";
|
1941 |
+
}
|
1942 |
+
|
1943 |
protected function savePartToCsv($file, &$data)
|
1944 |
{
|
1945 |
|
1946 |
+
if (!file_exists($this->_dir)) {
|
1947 |
+
mkdir($this->_dir);
|
1948 |
}
|
1949 |
|
1950 |
//save
|
1991 |
$db = $this->_getReadAdapter();
|
1992 |
$select = $db->select()
|
1993 |
->from(
|
1994 |
+
$this->_prefix . 'eav_entity_type',
|
1995 |
array('entity_type_id', 'entity_type_code')
|
1996 |
);
|
1997 |
$this->_entityIds = array();
|
2001 |
}
|
2002 |
return array_key_exists($entityType, $this->_entityIds) ? $this->_entityIds[$entityType] : null;
|
2003 |
}
|
2004 |
+
}
|
|
app/code/local/Boxalino/Exporter/etc/config.xml
CHANGED
@@ -44,6 +44,10 @@
|
|
44 |
<default>
|
45 |
<boxalinoexporter>
|
46 |
<export_data>
|
|
|
|
|
|
|
|
|
47 |
<maximum_population>0</maximum_population>
|
48 |
<language>en</language>
|
49 |
<export_categories>1</export_categories>
|
44 |
<default>
|
45 |
<boxalinoexporter>
|
46 |
<export_data>
|
47 |
+
<export_server>http://di1.bx-cloud.com</export_server>
|
48 |
+
<export_product_url>1</export_product_url>
|
49 |
+
<export_product_images>1</export_product_images>
|
50 |
+
<export_product_images_thumbnail>1</export_product_images_thumbnail>
|
51 |
<maximum_population>0</maximum_population>
|
52 |
<language>en</language>
|
53 |
<export_categories>1</export_categories>
|
app/code/local/Boxalino/Exporter/etc/system.xml
CHANGED
@@ -26,12 +26,21 @@
|
|
26 |
<show_in_website>1</show_in_website>
|
27 |
<show_in_store>1</show_in_store>
|
28 |
<fields>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
<language translate="label">
|
30 |
<label>Language</label>
|
31 |
<frontend_type>text</frontend_type>
|
32 |
<comment>Set language of your store view
|
33 |
<![CDATA[<br />Available: en, fr, de, it, es, zh, cz, ru]]></comment>
|
34 |
-
<sort_order>
|
35 |
<show_in_default>1</show_in_default>
|
36 |
<show_in_website>1</show_in_website>
|
37 |
<show_in_store>1</show_in_store>
|
@@ -45,6 +54,33 @@
|
|
45 |
<show_in_website>1</show_in_website>
|
46 |
<show_in_store>0</show_in_store>
|
47 |
</additional_attributes>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
<maximum_population translate="label">
|
49 |
<label>Maximum amount of product to export</label>
|
50 |
<comment>0=all</comment>
|
26 |
<show_in_website>1</show_in_website>
|
27 |
<show_in_store>1</show_in_store>
|
28 |
<fields>
|
29 |
+
<export_server translate="label">
|
30 |
+
<label>Export server</label>
|
31 |
+
<frontend_type>text</frontend_type>
|
32 |
+
<comment>Set server where data will be exported</comment>
|
33 |
+
<sort_order>1</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>0</show_in_store>
|
37 |
+
</export_server>
|
38 |
<language translate="label">
|
39 |
<label>Language</label>
|
40 |
<frontend_type>text</frontend_type>
|
41 |
<comment>Set language of your store view
|
42 |
<![CDATA[<br />Available: en, fr, de, it, es, zh, cz, ru]]></comment>
|
43 |
+
<sort_order>2</sort_order>
|
44 |
<show_in_default>1</show_in_default>
|
45 |
<show_in_website>1</show_in_website>
|
46 |
<show_in_store>1</show_in_store>
|
54 |
<show_in_website>1</show_in_website>
|
55 |
<show_in_store>0</show_in_store>
|
56 |
</additional_attributes>
|
57 |
+
<export_product_url translate="label">
|
58 |
+
<label>Export products url</label>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
61 |
+
<sort_order>15</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>0</show_in_store>
|
65 |
+
</export_product_url>
|
66 |
+
<export_product_images translate="label">
|
67 |
+
<label>Export products images url</label>
|
68 |
+
<frontend_type>select</frontend_type>
|
69 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
70 |
+
<sort_order>16</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>0</show_in_store>
|
74 |
+
</export_product_images>
|
75 |
+
<export_product_images_thumbnail translate="label">
|
76 |
+
<label>Export products thumbnail url</label>
|
77 |
+
<frontend_type>select</frontend_type>
|
78 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
79 |
+
<sort_order>17</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>0</show_in_store>
|
83 |
+
</export_product_images_thumbnail>
|
84 |
<maximum_population translate="label">
|
85 |
<label>Maximum amount of product to export</label>
|
86 |
<comment>0=all</comment>
|
app/design/frontend/base/default/layout/boxalino.xml
CHANGED
@@ -1,18 +1,50 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
|
3 |
<layout version="0.1.0">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
<reference name="top.search">
|
15 |
-
<action method="setTemplate"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
</reference>
|
17 |
-
|
18 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
|
3 |
<layout version="0.1.0">
|
4 |
+
<default>
|
5 |
+
<reference name="head">
|
6 |
+
<action method="addItem">
|
7 |
+
<type>skin_css</type>
|
8 |
+
<name>css/boxalinoCemSearch.css</name>
|
9 |
+
</action>
|
10 |
+
<action method="addItem">
|
11 |
+
<type>skin_js</type>
|
12 |
+
<name>js/boxalinoAutocomplete.js</name>
|
13 |
+
</action>
|
14 |
+
<action method="addItem" ifconfig="Boxalino_General/jquery/jquery_file">
|
15 |
+
<type>skin_js</type>
|
16 |
+
<name>js/jquery-1.10.2.min.js</name>
|
17 |
+
</action>
|
18 |
+
<action method="addItem" ifconfig="Boxalino_General/jquery/noconflict_file">
|
19 |
+
<type>skin_js</type>
|
20 |
+
<name>js/jquery-noConflict.js</name>
|
21 |
+
</action>
|
22 |
+
</reference>
|
23 |
<reference name="top.search">
|
24 |
+
<action method="setTemplate">
|
25 |
+
<template>boxalino/catalogsearch/form.mini.phtml</template>
|
26 |
+
</action>
|
27 |
+
</reference>
|
28 |
+
<reference name="before_body_end">
|
29 |
+
<block type="boxalino/script" name="boxalino_script" template="boxalino/script.phtml"/>
|
30 |
+
</reference>
|
31 |
+
</default>
|
32 |
+
<catalogsearch_result_index>
|
33 |
+
<reference name="left">
|
34 |
+
<block type="boxalino/facets" name="left_filters" as="left_filters" template="boxalino/left_filters.phtml"/>
|
35 |
+
</reference>
|
36 |
+
<reference name="content">
|
37 |
+
<block type="boxalino/facets" name="top_filters" as="top_filters" before="-" template="boxalino/top_filters.phtml"/>
|
38 |
+
<block type="core/template" name="relaxation_suggestion" as="relaxation_suggestion" after="top_filters" template="boxalino/relaxation_suggestion.phtml"/>
|
39 |
+
<block type="catalog/product_list" name="relaxation_products" as="relaxation_products" before="search.result" template="boxalino/catalogsearch/relaxation_products.phtml">
|
40 |
+
<block type="core/text_list" name="product_list.name.after" as="name.after"/>
|
41 |
+
<block type="core/text_list" name="product_list.after" as="after"/>
|
42 |
+
</block>
|
43 |
+
</reference>
|
44 |
+
<reference name="search.result">
|
45 |
+
<action method="setTemplate">
|
46 |
+
<template>boxalino/catalogsearch/result.phtml</template>
|
47 |
+
</action>
|
48 |
</reference>
|
49 |
+
</catalogsearch_result_index>
|
50 |
</layout>
|
app/design/frontend/base/default/template/boxalino/catalogsearch/form.mini.phtml
CHANGED
@@ -1,31 +1,31 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
?>
|
5 |
<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
id="search"
|
10 |
type="search"
|
11 |
name="<?php echo $catalogSearchHelper->getQueryParamName() ?>"
|
12 |
value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>"
|
13 |
class="input-text required-entry"
|
14 |
-
maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength()
|
15 |
-
placeholder="<?php echo $this->__('Search entire store here...') ?>"
|
16 |
-
|
17 |
<span>
|
18 |
<span><?php echo $this->__('Search') ?>
|
19 |
</span>
|
20 |
</span>
|
21 |
</button>
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
</form>
|
1 |
<?php
|
2 |
+
/* @var $catalogSearchHelper Mage_Catalogsearch_Helper_Data */
|
3 |
+
$catalogSearchHelper = $this->helper('catalogsearch');
|
4 |
?>
|
5 |
<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
|
6 |
+
<div class="input-box">
|
7 |
+
<label for="search"><?php echo $this->__('Search:') ?></label>
|
8 |
+
<input
|
9 |
id="search"
|
10 |
type="search"
|
11 |
name="<?php echo $catalogSearchHelper->getQueryParamName() ?>"
|
12 |
value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>"
|
13 |
class="input-text required-entry"
|
14 |
+
maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength(); ?>"
|
15 |
+
placeholder="<?php echo $this->__('Search entire store here...') ?>"/>
|
16 |
+
<button type="submit" title="<?php echo $this->__('Search') ?>" class="button search-button">
|
17 |
<span>
|
18 |
<span><?php echo $this->__('Search') ?>
|
19 |
</span>
|
20 |
</span>
|
21 |
</button>
|
22 |
+
</div>
|
23 |
|
24 |
+
<div id="search_autocomplete" class="search-autocomplete"></div>
|
25 |
+
<script type="text/javascript">
|
26 |
+
//<![CDATA[
|
27 |
+
var searchForm = new Varien.searchForm('search_mini_form', 'search', '');
|
28 |
+
searchForm.initAutocomplete('<?php echo $catalogSearchHelper->getSuggestUrl() ?>', 'search_autocomplete');
|
29 |
+
//]]>
|
30 |
+
</script>
|
31 |
</form>
|
app/design/frontend/base/default/template/boxalino/catalogsearch/relaxation_products.phtml
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Product list template
|
4 |
+
*
|
5 |
+
* @see Mage_Catalog_Block_Product_List
|
6 |
+
*/
|
7 |
+
/* @var $this Mage_Catalog_Block_Product_List */
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
$session = Mage::getSingleton('core/session');
|
11 |
+
$_productCollections = $session->getData('relax_products_extra');
|
12 |
+
$catalogSearchHelper = $this->helper('catalogsearch');
|
13 |
+
$_helper = $this->helper('catalog/output');
|
14 |
+
if (count($_productCollections) == 0) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<?php foreach ($_productCollections as $k => $_productCollection): ?>
|
19 |
+
<div class="page-title">
|
20 |
+
<?php if ($this->helper('rss/catalog')->getTagFeedUrl()): ?>
|
21 |
+
<a href="<?php echo $this->helper('rss/catalog')->getTagFeedUrl() ?>" class="nobr link-rss"><?php echo $this->__('Subscribe to Feed') ?></a>
|
22 |
+
<?php endif; ?>
|
23 |
+
<h1><?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", '<a href="' . $catalogSearchHelper->getResultUrl() . '?q=' . $k . '">' . $k . '</a>'); ?></h1>
|
24 |
+
</div>
|
25 |
+
<?php if (count($_productCollection) == 0): ?>
|
26 |
+
<!-- <p class="note-msg">--><?php //echo $this->__('There are no products matching the selection.') ?><!--</p>-->
|
27 |
+
<?php else: ?>
|
28 |
+
<div class="category-products">
|
29 |
+
<!-- --><?php //echo $this->getToolbarHtml() ?>
|
30 |
+
<?php // List mode ?>
|
31 |
+
<?php if ($this->getMode() != 'grid'): ?>
|
32 |
+
<?php $_iterator = 0; ?>
|
33 |
+
<ol class="products-list" id="products-list">
|
34 |
+
<?php foreach ($_productCollection as $_product):
|
35 |
+
$_product = Mage::getModel('catalog/product')->load($_product);
|
36 |
+
?>
|
37 |
+
|
38 |
+
<li class="item<?php if (++$_iterator == sizeof($_productCollection)): ?> last<?php endif; ?>">
|
39 |
+
<?php // Product Image ?>
|
40 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
|
41 |
+
<?php /* Based on the native RWD styling, product images are displayed at a max of ~400px wide when viewed on a
|
42 |
+
one column page layout with four product columns from a 1280px viewport. For bandwidth reasons,
|
43 |
+
we are going to serve a 300px image, as it will look fine at 400px and most of the times, the image
|
44 |
+
will be displayed at a smaller size (eg, if two column are being used or viewport is smaller than 1280px).
|
45 |
+
This $_imgSize value could even be decreased further, based on the page layout
|
46 |
+
(one column, two column, three column) and number of product columns. */
|
47 |
+
?>
|
48 |
+
<?php $_imgSize = 300; ?>
|
49 |
+
<img id="product-collection-image-<?php echo $_product->getId(); ?>"
|
50 |
+
src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->keepFrame(false)->resize($_imgSize); ?>"
|
51 |
+
alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"/>
|
52 |
+
</a>
|
53 |
+
<?php // Product description ?>
|
54 |
+
<div class="product-shop">
|
55 |
+
<div class="f-fix">
|
56 |
+
<div class="product-primary">
|
57 |
+
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
|
58 |
+
<h2 class="product-name">
|
59 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?></a>
|
60 |
+
</h2>
|
61 |
+
<?php if ($_product->getRatingSummary()): ?>
|
62 |
+
<?php echo $this->getReviewsSummaryHtml($_product) ?>
|
63 |
+
<?php endif; ?>
|
64 |
+
|
65 |
+
<?php
|
66 |
+
$_nameAfterChildren = $this->getChild('name.after')->getSortedChildren();
|
67 |
+
foreach ($_nameAfterChildren as $_nameAfterChildName):
|
68 |
+
$_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
|
69 |
+
$_nameAfterChild->setProduct($_product);
|
70 |
+
?>
|
71 |
+
<?php echo $_nameAfterChild->toHtml(); ?>
|
72 |
+
<?php endforeach; ?>
|
73 |
+
</div>
|
74 |
+
<div class="product-secondary">
|
75 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
76 |
+
</div>
|
77 |
+
<div class="product-secondary">
|
78 |
+
<?php if ($_product->isSaleable() && !$_product->canConfigure()): ?>
|
79 |
+
<p class="action">
|
80 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
|
81 |
+
<span><span><?php echo $this->__('Add to Cart') ?></span></span>
|
82 |
+
</button>
|
83 |
+
</p>
|
84 |
+
<?php elseif ($_product->isSaleable()): ?>
|
85 |
+
<p class="action">
|
86 |
+
<a title="<?php echo $this->__('View Details') ?>" class="button" href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->__('View Details') ?></a>
|
87 |
+
</p>
|
88 |
+
<?php
|
89 |
+
else: ?>
|
90 |
+
<p class="action availability out-of-stock">
|
91 |
+
<span><?php echo $this->__('Out of stock') ?></span></p>
|
92 |
+
<?php endif; ?>
|
93 |
+
<ul class="add-to-links">
|
94 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
95 |
+
<li>
|
96 |
+
<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>
|
97 |
+
</li>
|
98 |
+
<?php endif; ?>
|
99 |
+
<?php if ($_compareUrl = $this->getAddToCompareUrl($_product)): ?>
|
100 |
+
<li><span class="separator">|</span>
|
101 |
+
<a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a>
|
102 |
+
</li>
|
103 |
+
<?php endif; ?>
|
104 |
+
</ul>
|
105 |
+
</div>
|
106 |
+
<div class="desc std">
|
107 |
+
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
|
108 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
</li>
|
113 |
+
<?php endforeach; ?>
|
114 |
+
</ol>
|
115 |
+
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
|
116 |
+
|
117 |
+
<?php else: ?>
|
118 |
+
|
119 |
+
<?php // Grid Mode ?>
|
120 |
+
|
121 |
+
<?php $_collectionSize = count($_productCollection) ?>
|
122 |
+
<?php $_columnCount = $this->getColumnCount(); ?>
|
123 |
+
<ul class="products-grid products-grid--max-<?php echo $_columnCount; ?>-col">
|
124 |
+
<?php $i = 0;
|
125 |
+
foreach ($_productCollection as $_product):
|
126 |
+
$_product = Mage::getModel('catalog/product')->load($_product);
|
127 |
+
?>
|
128 |
+
<?php /*if ($i++%$_columnCount==0): ?>
|
129 |
+
<?php endif*/
|
130 |
+
?>
|
131 |
+
<li class="item<?php if (($i - 1) % $_columnCount == 0): ?> first<?php elseif ($i % $_columnCount == 0): ?> last<?php endif; ?>">
|
132 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
|
133 |
+
<?php $_imgSize = 210; ?>
|
134 |
+
<img id="product-collection-image-<?php echo $_product->getId(); ?>"
|
135 |
+
src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_imgSize); ?>"
|
136 |
+
alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"/>
|
137 |
+
</a>
|
138 |
+
|
139 |
+
<div class="product-info">
|
140 |
+
<h2 class="product-name">
|
141 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a>
|
142 |
+
</h2>
|
143 |
+
|
144 |
+
<?php
|
145 |
+
$_nameAfterChildren = $this->getChild('name.after')->getSortedChildren();
|
146 |
+
foreach ($_nameAfterChildren as $_nameAfterChildName):
|
147 |
+
$_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
|
148 |
+
$_nameAfterChild->setProduct($_product);
|
149 |
+
?>
|
150 |
+
<?php echo $_nameAfterChild->toHtml(); ?>
|
151 |
+
<?php endforeach; ?>
|
152 |
+
|
153 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
154 |
+
<?php if ($_product->getRatingSummary()): ?>
|
155 |
+
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
|
156 |
+
<?php endif; ?>
|
157 |
+
<div class="actions">
|
158 |
+
<?php if ($_product->isSaleable() && !$_product->canConfigure()): ?>
|
159 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
|
160 |
+
<span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
|
161 |
+
<?php elseif ($_product->isSaleable()): ?>
|
162 |
+
<a title="<?php echo $this->__('View Details') ?>" class="button" href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->__('View Details') ?></a>
|
163 |
+
<?php
|
164 |
+
else: ?>
|
165 |
+
<p class="availability out-of-stock">
|
166 |
+
<span><?php echo $this->__('Out of stock') ?></span></p>
|
167 |
+
<?php endif; ?>
|
168 |
+
<ul class="add-to-links">
|
169 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
170 |
+
<li>
|
171 |
+
<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>
|
172 |
+
</li>
|
173 |
+
<?php endif; ?>
|
174 |
+
<?php if ($_compareUrl = $this->getAddToCompareUrl($_product)): ?>
|
175 |
+
<li><span class="separator">|</span>
|
176 |
+
<a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a>
|
177 |
+
</li>
|
178 |
+
<?php endif; ?>
|
179 |
+
</ul>
|
180 |
+
</div>
|
181 |
+
</div>
|
182 |
+
</li>
|
183 |
+
<?php /*if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
|
184 |
+
<?php endif*/
|
185 |
+
?>
|
186 |
+
<?php endforeach ?>
|
187 |
+
</ul>
|
188 |
+
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd', 'even', 'first', 'last'])</script>
|
189 |
+
<?php endif; ?>
|
190 |
+
|
191 |
+
<div class="toolbar-bottom">
|
192 |
+
<!-- --><?php //echo $this->getToolbarHtml() ?>
|
193 |
+
</div>
|
194 |
+
</div>
|
195 |
+
<?php endif; ?>
|
196 |
+
<?php endforeach; ?>
|
app/design/frontend/base/default/template/boxalino/catalogsearch/result.phtml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$session = Mage::getSingleton("core/session");
|
3 |
+
$_productCollections = $session->getData("relax_products_extra");
|
4 |
+
if (count($_productCollections) > 0) {
|
5 |
+
return;
|
6 |
+
}
|
7 |
+
?>
|
8 |
+
<?php if ($this->getResultCount()): ?>
|
9 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
10 |
+
<div class="page-title">
|
11 |
+
<?php if ($this->helper('rss/catalog')->getTagFeedUrl()): ?>
|
12 |
+
<a href="<?php echo $this->helper('rss/catalog')->getTagFeedUrl() ?>" class="nobr link-rss"><?php echo $this->__('Subscribe to Feed') ?></a>
|
13 |
+
<?php endif; ?>
|
14 |
+
<h1><?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?></h1>
|
15 |
+
</div>
|
16 |
+
<?php if ($messages = $this->getNoteMessages()): ?>
|
17 |
+
<p class="note-msg">
|
18 |
+
<?php foreach ($messages as $message): ?>
|
19 |
+
<?php echo $message ?><br/>
|
20 |
+
<?php endforeach; ?>
|
21 |
+
</p>
|
22 |
+
<?php endif; ?>
|
23 |
+
<?php echo $this->getProductListHtml() ?>
|
24 |
+
<?php else: ?>
|
25 |
+
<div class="page-title">
|
26 |
+
<h1><?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?></h1>
|
27 |
+
</div>
|
28 |
+
<p class="note-msg">
|
29 |
+
<?php echo ($this->getNoResultText()) ? $this->getNoResultText() : $this->__('Your search returns no results.') ?>
|
30 |
+
<?php if ($messages = $this->getNoteMessages()): ?>
|
31 |
+
<?php foreach ($messages as $message): ?>
|
32 |
+
<br/><?php echo $message ?>
|
33 |
+
<?php endforeach; ?>
|
34 |
+
<?php endif; ?>
|
35 |
+
</p>
|
36 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/boxalino/head.phtml
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$this->printScripts();
|
3 |
-
?>
|
4 |
-
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/boxalino/left_filters.phtml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $filters = $this->getLeftFilters(); ?>
|
2 |
+
<?php if (!empty($filters)): ?>
|
3 |
+
<div class="left-filters">
|
4 |
+
<?php foreach ($filters as $key => $filter): ?>
|
5 |
+
<div class="filter">
|
6 |
+
<div class="filter-title"><?php echo $filter['title']; ?></div>
|
7 |
+
<ul class="values">
|
8 |
+
<?php foreach ($filter['values'] as $value): ?>
|
9 |
+
<li class="value">
|
10 |
+
<a href="<?php echo $value['url'] ?>"><?php echo $value['stringValue'] . ' (' . $value['hitCount'] . ')' ?></a>
|
11 |
+
</li>
|
12 |
+
<?php endforeach; ?>
|
13 |
+
</ul>
|
14 |
+
</div>
|
15 |
+
<?php endforeach; ?>
|
16 |
+
</div>
|
17 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/boxalino/relaxation_suggestion.phtml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $session = Mage::getSingleton("core/session");
|
2 |
+
$relax = $session->getData("relax");
|
3 |
+
$catalogSearchHelper = $this->helper('catalogsearch');
|
4 |
+
?>
|
5 |
+
|
6 |
+
<?php if (count($relax) > 0): ?>
|
7 |
+
<div class="suggest">
|
8 |
+
<div class="header"><?php echo $this->__("Did you mean"); ?>:</div>
|
9 |
+
<ul class="suggestions">
|
10 |
+
<?php foreach ($relax as $r): ?>
|
11 |
+
<li>
|
12 |
+
<a href="<?php echo $catalogSearchHelper->getResultUrl() . '?q=' . $r['href']; ?>"><?php echo $r['text'] . ' (' . $r['hits'] . ')'; ?></a>
|
13 |
+
</li>
|
14 |
+
<?php endforeach; ?>
|
15 |
+
</ul>
|
16 |
+
</div>
|
17 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/boxalino/script.phtml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Boxalino Script Block
|
4 |
+
*/
|
5 |
+
|
6 |
+
/** @var $this Boxalino_CemSearch_Block_Script */
|
7 |
+
|
8 |
+
/** @var $_helper Boxalino_CemSearch_Helper_Data */
|
9 |
+
$_helper = Mage::helper('Boxalino_CemSearch');
|
10 |
+
|
11 |
+
// get account
|
12 |
+
$account = Mage::getStoreConfig('Boxalino_General/general/di_account');
|
13 |
+
?>
|
14 |
+
<script>
|
15 |
+
var _bxq = _bxq || []
|
16 |
+
_bxq.push(['setAccount', <?php echo json_encode($account); ?>]);
|
17 |
+
<?php echo $this->getScripts(); ?>
|
18 |
+
|
19 |
+
<?php if ($_helper->isAnalyticsEnabled()): ?>
|
20 |
+
_bxq.push(['trackPageView']);
|
21 |
+
<?php endif; ?>
|
22 |
+
|
23 |
+
<?php if ($this->isSearch()): ?>
|
24 |
+
<?php echo $_helper->reportSearch($_GET['q'], $_helper->getFiltersValues($_GET)); ?>
|
25 |
+
<?php endif; ?>
|
26 |
+
|
27 |
+
(function () {
|
28 |
+
var s = document.createElement('script');
|
29 |
+
s.async = 1;
|
30 |
+
s.src = '//cdn.bx-cloud.com/frontend/rc/js/ba.min.js';
|
31 |
+
document.getElementsByTagName('head')[0].appendChild(s);
|
32 |
+
})();
|
33 |
+
</script>
|
app/design/frontend/base/default/template/boxalino/top_filters.phtml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $filters = $this->getTopFilters(); ?>
|
2 |
+
<?php if (!empty($filters)): ?>
|
3 |
+
<div class="top_filters" style="width:100%; margin-left:5px;">
|
4 |
+
<?php foreach ($filters as $key => $filter): ?>
|
5 |
+
<div class="value" style="width:33%; float:left;">
|
6 |
+
<?php if ($filter['selected']) echo '<strong>' ?>
|
7 |
+
<a href="<?php echo $filter['url'] ?>"><?php echo $filter['title'] . ' (' . $filter['hitCount'] . ')' ?></a>
|
8 |
+
<?php if ($filter['selected']) echo '</strong>' ?>
|
9 |
+
</div>
|
10 |
+
<?php endforeach; ?>
|
11 |
+
</div>
|
12 |
+
<?php endif; ?>
|
app/etc/modules/Boxalino_CemSearch.xml
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
|
3 |
<config>
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
|
3 |
<config>
|
4 |
+
<modules>
|
5 |
+
<Boxalino_CemSearch>
|
6 |
+
<active>true</active>
|
7 |
+
<codePool>local</codePool>
|
8 |
+
</Boxalino_CemSearch>
|
9 |
+
</modules>
|
10 |
</config>
|
app/locale/de_DE/Boxalino.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
"Boxalino", "Boxalino"
|
2 |
+
|
3 |
+
"Did you mean", "Meinten sie"
|
4 |
+
"Search for", "Suche nach"
|
app/locale/en_US/Boxalino.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
"Boxalino", "Boxalino"
|
2 |
+
|
3 |
+
"Did you mean", "Did you mean"
|
4 |
+
"Search for", "Search for"
|
app/locale/fr_FR/Boxalino.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
"Boxalino", "Boxalino"
|
2 |
+
|
3 |
+
"Did you mean", "Vouliez-vous dire"
|
4 |
+
"Search for", "Recherche pour"
|
package.xml
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>boxalino_plugin</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://www.boxalino.com">
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>This extension connects your magento shop to the boxalino personalisation and testing engine
|
10 |
<description>This extension connects your magento shop to the boxalino engine. 
|
11 |

|
12 |
Boxalino is the intelligent engine for realtime personalization with modules for Landingpages, Search, Recommendations, E-Mail Personalisation and Apps.
|
@@ -16,11 +16,17 @@ Boxalino increases the online success of e-commerce companies on the mobile and
|
|
16 |
Boxalino is the best solution for Conversion Optimization on the market that integrates Testing, AI and Reporting in a way that is really usable for E-Commerce Teams.
|
17 |

|
18 |
Check out www.boxalino.com for details or give us a shout at sales@boxalino.com.</description>
|
19 |
-
<notes>
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
<compatible/>
|
25 |
-
<dependencies><required><php><min>5.
|
26 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>boxalino_plugin</name>
|
4 |
+
<version>2.8.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://www.boxalino.com">boxalino Plugin</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>This extension connects your magento shop to the boxalino personalisation and testing engine.</summary>
|
10 |
<description>This extension connects your magento shop to the boxalino engine. 
|
11 |

|
12 |
Boxalino is the intelligent engine for realtime personalization with modules for Landingpages, Search, Recommendations, E-Mail Personalisation and Apps.
|
16 |
Boxalino is the best solution for Conversion Optimization on the market that integrates Testing, AI and Reporting in a way that is really usable for E-Commerce Teams.
|
17 |

|
18 |
Check out www.boxalino.com for details or give us a shout at sales@boxalino.com.</description>
|
19 |
+
<notes>supporting more complex shop structures
|
20 |
+

|
21 |
+
- Added support for structures where store views map to languages in different search indexes within one website.
|
22 |
+
- Improved handling of empty deltas and permission problems when creating ZIPs.
|
23 |
+

|
24 |
+
Includes all earlier changes as described at:
|
25 |
+
https://github.com/boxalino/plugin-magento/releases</notes>
|
26 |
+
<authors><author><name>Szymon Nosal</name><user>szymonnosal</user><email>szymon.nosal@boxalino.com</email></author><author><name>Simon Rupf</name><user>simonrupf</user><email>simon.rupf@boxalino.com</email></author></authors>
|
27 |
+
<date>2015-04-30</date>
|
28 |
+
<time>21:00:00</time>
|
29 |
+
<contents><target name="magelocal"><dir name="Boxalino"><dir name="CemSearch"><dir name="Block"><file name="Abstract.php" hash="45253ec10623b07c67cd623c626ad5f4"/><file name="Autocomplete.php" hash="d5b5bdcad96b7057e91543d57e91e5e2"/><dir name="Cart"><file name="Crosssell.php" hash="cea7a2d6f5b65db2a2f645a1603b4f8d"/></dir><file name="Facets.php" hash="a1615b9a891fc5f00eebd68528e07f0c"/><dir name="Product"><dir name="List"><file name="Recommendation.php" hash="a6a6458eb55c017aca0a6ab5d6576386"/><file name="Related.php" hash="e7586fbc5cab975bc159ea946f367a87"/><file name="Upsell.php" hash="49e506c72b059348d6edab2a56050ec8"/></dir><file name="List.php" hash="2ae8fde63ab299c4ec7a6cff0c31edbc"/></dir><file name="Script.php" hash="a1d73dbf9a6fee9b3146a852072c95bf"/></dir><dir name="CatalogSearch"><dir name="Helper"><file name="Data.php" hash="9257d32c8f117e727333f4f1b4b5ef35"/></dir></dir><dir name="Helper"><file name="Data.php" hash="da6294c7560e3643dd312809cf7fd539"/><dir name="P13n"><file name="Adapter.php" hash="052f92514591a48c614284ac2c9fc5e0"/><file name="Config.php" hash="82597fa7e5fc6695137ad2f96267378a"/><file name="Recommendation.php" hash="32a664921b31680dca74335885b61a54"/><file name="Sort.php" hash="f40c0e1472ed4c75b2dbafc14cc5608c"/></dir></dir><dir name="Lib"><file name="AbstractThrift.php" hash="d6c88b8524dbd810d51ca9b568ca64ee"/><file name="P13nService.php" hash="96bae2ed236b56c93c69c043d61bb1fa"/><file name="Types.php" hash="3b56e03fe225e986511a7abfaab0a84c"/><dir name="vendor"><dir name="Thrift"><dir name="Base"><file name="TBase.php" hash="b383bf43ac76a57e3b1168cfacffbf22"/></dir><dir name="ClassLoader"><file name="ThriftClassLoader.php" hash="13159566c8b2dcc5b260ef9a0844167e"/></dir><dir name="Exception"><file name="TApplicationException.php" hash="1ee65cc5fb3dc82550a85cc18a31850c"/><file name="TException.php" hash="756e6a847c9e6bd1560c24b9a7373d2c"/><file name="TProtocolException.php" hash="148ebd5d8eba2587cd6e039cf70e04ab"/><file name="TTransportException.php" hash="aca39eea001fcbfd452db9ca7d5c218c"/></dir><dir name="Factory"><file name="TBinaryProtocolFactory.php" hash="bcd6e0555d6e2670a3bc7dd39ff3dbaf"/><file name="TCompactProtocolFactory.php" hash="0118b6363e09080548de3c6daf153290"/><file name="TJSONProtocolFactory.php" hash="28af1d10b4133df7f8ad8022ca39d703"/><file name="TProtocolFactory.php" hash="300bf2d805fa4a227cc3dc2b6ed0200c"/><file name="TStringFuncFactory.php" hash="242f32ade732f9c0d9b62a81b6901cd4"/><file name="TTransportFactory.php" hash="8347271458aea0453e774170a5b3e9fd"/></dir><file name="HttpP13n.php" hash="8ab6f5e997fae57430e9634b753fdd46"/><dir name="Protocol"><dir name="JSON"><file name="BaseContext.php" hash="ed1d83fba59a1d04c07416094ece8ee1"/><file name="ListContext.php" hash="9c8a970f54c30be1299c2d38da60ed56"/><file name="LookaheadReader.php" hash="315a96446f0f530ed1b0b1350b37f58d"/><file name="PairContext.php" hash="3fa06b3f7c9698642aefe00cd322f68b"/></dir><file name="TBinaryProtocol.php" hash="933d2be5503504cddd544992a4af0ee3"/><file name="TBinaryProtocolAccelerated.php" hash="444ba8026d73b83fbcf303d9a550cb70"/><file name="TCompactProtocol.php" hash="57b31bf77c29c1e0d1417f018a239505"/><file name="TJSONProtocol.php" hash="fac76e10fbc711cbfbcf6bdbc0b60191"/><file name="TProtocol.php" hash="d9c9a8105ad160bf0b87e8053d4b9d7c"/></dir><dir name="Serializer"><file name="TBinarySerializer.php" hash="e1fef75686b1fbadc28242b7f3697397"/></dir><dir name="Server"><file name="TForkingServer.php" hash="6e319d0d7f45350a03e387fc2f22473d"/><file name="TServer.php" hash="dc87f6a299fb4fb9ab76206f3b6bec72"/><file name="TServerSocket.php" hash="468fc875e7a5e4899e502e95f823455d"/><file name="TServerTransport.php" hash="ca2ab3e25a0760d37eb3538274dfaccb"/><file name="TSimpleServer.php" hash="38d5685001585a0d9f31b9d8c46656d2"/></dir><dir name="StringFunc"><file name="Core.php" hash="4493a096c73f5922316d95cc2c5fb687"/><file name="Mbstring.php" hash="b5ee27dd6bdceee0f2133df01c8d4fcd"/><file name="TStringFunc.php" hash="89fd7900f1b258391e4d4fdc924bc0f0"/></dir><dir name="Transport"><file name="P13nTCurlClient.php" hash="aaa63d036b6920b57e0777f90c08064f"/><file name="P13nTHttpClient.php" hash="8223e00845b717bb55981649d9ce6616"/><file name="TBufferedTransport.php" hash="7ace771173641cf47b3b11ca0bfebcfa"/><file name="TCurlClient.php" hash="16b14d5f643b20c872468dc96218708d"/><file name="TFramedTransport.php" hash="c6fc032e990e4cf3507741ef1d5b83b2"/><file name="THttpClient.php" hash="b299d30eecc318d7dde4d012ebe8a512"/><file name="TMemoryBuffer.php" hash="7367faa512ec8d25489819ca2ed8848f"/><file name="TNullTransport.php" hash="82d683d7d76ef2938fad1c58878f45e5"/><file name="TPhpStream.php" hash="44769e5da4709a4b6c2025137e4898b3"/><file name="TSocket.php" hash="d689b1f877eda19f7caaa9cb46788f96"/><file name="TSocketPool.php" hash="73d86dbd017130fe2aa0778132b42b26"/><file name="TTransport.php" hash="9185e82d3a440d1db97c6983573bd1ab"/></dir><dir name="Type"><file name="TMessageType.php" hash="20a9fb9a1de1ffe03bfac3057c913101"/><file name="TType.php" hash="261cc40ce2573ebf414c0ec06a2ee093"/></dir></dir></dir></dir><dir name="Model"><file name="Advanced.php" hash="d22f70b7cc2a9e599e5b45fbea541750"/><file name="Category.php" hash="37a225843c7ce20966f130480075aa5d"/><file name="Logger.php" hash="a75219dc447c1ebdd41ad312b2ef7f40"/><file name="Observer.php" hash="a255f380058ade19fd3864cb61580480"/><dir name="Resource"><dir name="Advanced"><file name="Collection.php" hash="8814272ed16bc3c895bf3320633c0d24"/></dir><file name="Advanced.php" hash="572af318b61552c006b32ce5f5d9eb7e"/><file name="Fulltext.php" hash="cb2dc7ab7e243ea12a5595cfd77dc60a"/></dir><file name="Session.php" hash="f5f6948355cfc10882dd7a4f80e2713f"/></dir><dir name="controllers"><file name="AdvancedController.php" hash="7b22f7b4ffdf1a59448218eb79fca4ad"/><file name="AjaxController.php" hash="8331416b6beee0fb635da991790b8f40"/><file name="IndexController.php" hash="0f9ba5d1ee9bf4d7f9d6868a502738cd"/><file name="ResultController.php" hash="e43539a5921da7db3364b8e70dac2bdc"/></dir><dir name="etc"><file name="adminhtml.xml" hash="13af90d012dc3871c9af59c804d3588f"/><file name="config.xml" hash="2f52a0306ea5cc393eb107d3d467d5b4"/><file name="system.xml" hash="96d9966e52f500a359822e3bb40946a0"/></dir></dir><dir name="Exporter"><dir name="Helper"><file name="Data.php" hash="3aca44b357b96db9151373a9ee1e3daa"/></dir><dir name="Model"><file name="Delta.php" hash="664b8a733751dd7e85169f3c9d99322f"/><file name="Indexer.php" hash="d9c10401971e9544992fbf34594fb600"/><dir name="Mysql4"><dir name="Exporter"><file name="Delta.php" hash="f4175abe070a035fd16399d3dbda1509"/><file name="Indexer.php" hash="bc1524bba09adc0c796872c718d5b6c1"/></dir><file name="Indexer.php" hash="62f2353d571636f01c61f994a8e1808b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="57e26697c6d9b55a58f6da88b5a8d822"/><file name="config.xml" hash="d5c1b16f57a024ad1fb7f5a9ed1631dc"/><file name="system.xml" hash="a3931334075859ea2aa820012e8ba23a"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="boxalino.xml" hash="94bdcfdcff2210386d329f396f16b55a"/></dir><dir name="template"><dir name="boxalino"><dir name="catalogsearch"><file name="form.mini.phtml" hash="ac78368a3d53a36f912b5f9ceae4b566"/><file name="relaxation_products.phtml" hash="257908262463f380f098f0158c628899"/><file name="result.phtml" hash="8764361c966bdc64557aee6af4e8e336"/></dir><file name="left_filters.phtml" hash="d49cfedbc38298a1556cdca86b03a192"/><file name="relaxation_suggestion.phtml" hash="2344e747549eb399c219459b842569a0"/><file name="script.phtml" hash="9d5dc83f66114026208446fb0993b004"/><file name="top_filters.phtml" hash="588185dc46825a1415124f84b90ef6c3"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Boxalino_CemSearch.xml" hash="01bf5b3a93e59ab4141658725bd615dd"/><file name="Boxalino_Exporter.xml" hash="b50cc52bc40c36b25677b6ef60bbf376"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Boxalino.csv" hash="898a7e741c385f6de40705755c7dbac7"/></dir><dir name="en_US"><file name="Boxalino.csv" hash="2fa5b37fa965c1c60e60609918cc953a"/></dir><dir name="fr_FR"><file name="Boxalino.csv" hash="07fc6c55708c4986f21f3196af74a4a3"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="boxalinoCemSearch.css" hash="aa5e2a4ae7f048bc8dc96cc3b15f827d"/></dir><dir name="js"><file name="boxalinoAutocomplete.js" hash="b26c8a5e419c7f2e8da9c0e6efbe04a2"/><file name="jquery-1.10.2.min.js" hash="628072e7212db1e8cdacb22b21752cda"/><file name="jquery-noConflict.js" hash="10bdc1b7f2effa529e5baae786007688"/></dir></dir></dir></dir></target></contents>
|
30 |
<compatible/>
|
31 |
+
<dependencies><required><php><min>5.2.0</min><max>5.5.9</max></php></required></dependencies>
|
32 |
</package>
|
skin/frontend/base/default/css/boxalinoCemSearch.css
CHANGED
@@ -1,70 +1,104 @@
|
|
1 |
.search-autocomplete .autocomplete-suggestions {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
}
|
10 |
|
11 |
.search-autocomplete .autocomplete-suggestion {
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
}
|
16 |
|
17 |
.search-autocomplete .autocomplete-selected {
|
18 |
-
|
19 |
}
|
20 |
|
21 |
.search-autocomplete .autocomplete-suggestions strong {
|
22 |
-
|
23 |
-
|
24 |
}
|
25 |
|
26 |
-
.search-autocomplete .product-autocomplete span{
|
27 |
display: block;
|
28 |
padding-left: 10px;
|
29 |
}
|
30 |
|
31 |
-
.search-autocomplete .product-autocomplete.hide{
|
32 |
-
|
33 |
}
|
34 |
|
35 |
-
.search-autocomplete ul{
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
|
|
|
|
39 |
}
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
background: #bbbbbb;
|
45 |
-
}
|
46 |
-
.search-autocomplete .amount{
|
47 |
-
float: right;
|
48 |
-
display: block;
|
49 |
-
padding: 0 10px;
|
50 |
-
}
|
51 |
-
.search-autocomplete ul:first-child{
|
52 |
-
border-bottom: none !important;
|
53 |
-
-webkit-border-bottom-right-radius: 0px !important;
|
54 |
-
-webkit-border-bottom-left-radius: 0px !important;
|
55 |
-
-moz-border-radius-bottomright: 0px !important;
|
56 |
-
-moz-border-radius-bottomleft: 0px !important;
|
57 |
-
border-bottom-right-radius: 0px !important;
|
58 |
-
border-bottom-left-radius: 0px !important;
|
59 |
-
}
|
60 |
-
.search-autocomplete ul:last-child{
|
61 |
-
top: -1px !important;
|
62 |
-
border-top: none !important;
|
63 |
-
-webkit-border-top-left-radius: 0px !important;
|
64 |
-
-webkit-border-top-right-radius: 0px !important;
|
65 |
-
-moz-border-radius-topleft: 0px !important;
|
66 |
-
-moz-border-radius-topright: 0px !important;
|
67 |
-
border-top-left-radius: 0px !important;
|
68 |
-
border-top-right-radius: 0px !important;
|
69 |
}
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.search-autocomplete .autocomplete-suggestions {
|
2 |
+
border: 1px solid #999;
|
3 |
+
background: #fff;
|
4 |
+
cursor: default;
|
5 |
+
overflow: auto;
|
6 |
+
-webkit-box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64);
|
7 |
+
-moz-box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64);
|
8 |
+
box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64);
|
9 |
}
|
10 |
|
11 |
.search-autocomplete .autocomplete-suggestion {
|
12 |
+
padding: 0px 5px;
|
13 |
+
white-space: nowrap;
|
14 |
+
overflow: hidden;
|
15 |
}
|
16 |
|
17 |
.search-autocomplete .autocomplete-selected {
|
18 |
+
background: #f0f0f0;
|
19 |
}
|
20 |
|
21 |
.search-autocomplete .autocomplete-suggestions strong {
|
22 |
+
font-weight: normal;
|
23 |
+
color: #39f;
|
24 |
}
|
25 |
|
26 |
+
.search-autocomplete .product-autocomplete span {
|
27 |
display: block;
|
28 |
padding-left: 10px;
|
29 |
}
|
30 |
|
31 |
+
.search-autocomplete .product-autocomplete.hide {
|
32 |
+
display: none;
|
33 |
}
|
34 |
|
35 |
+
.search-autocomplete ul {
|
36 |
+
position: relative !important;
|
37 |
+
background: #fff;
|
38 |
+
}
|
39 |
+
.search-autocomplete ul li {
|
40 |
+
text-align: left;
|
41 |
+
}
|
42 |
+
.search-autocomplete ul li.selected {
|
43 |
+
background: #bbb;
|
44 |
+
}
|
45 |
+
.search-autocomplete .amount {
|
46 |
+
float: right;
|
47 |
+
display: block;
|
48 |
+
padding: 0 10px;
|
49 |
+
}
|
50 |
+
.search-autocomplete ul:first-child {
|
51 |
+
border-bottom: none !important;
|
52 |
+
-webkit-border-bottom-right-radius: 0px !important;
|
53 |
+
-webkit-border-bottom-left-radius: 0px !important;
|
54 |
+
-moz-border-radius-bottomright: 0px !important;
|
55 |
+
-moz-border-radius-bottomleft: 0px !important;
|
56 |
+
border-bottom-right-radius: 0px !important;
|
57 |
+
border-bottom-left-radius: 0px !important;
|
58 |
+
}
|
59 |
+
.search-autocomplete ul:last-child {
|
60 |
+
top: -1px !important;
|
61 |
+
border-top: none !important;
|
62 |
+
-webkit-border-top-left-radius: 0px !important;
|
63 |
+
-webkit-border-top-right-radius: 0px !important;
|
64 |
+
-moz-border-radius-topleft: 0px !important;
|
65 |
+
-moz-border-radius-topright: 0px !important;
|
66 |
+
border-top-left-radius: 0px !important;
|
67 |
+
border-top-right-radius: 0px !important;
|
68 |
+
}
|
69 |
+
|
70 |
+
.queries .facet {
|
71 |
+
color: rgb(138, 148, 175) !important;
|
72 |
+
}
|
73 |
|
74 |
+
.queries .facet span {
|
75 |
+
padding-left: 10px;
|
76 |
}
|
77 |
+
|
78 |
+
.search-autocomplete ul li.facet:hover {
|
79 |
+
background-color: #39f;
|
80 |
+
color: #fff;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
+
.queries a.selected li {
|
84 |
+
background-color: #39f !important;
|
85 |
+
color: #fff !important;
|
86 |
+
}
|
87 |
+
|
88 |
+
.search-autocomplete li.facet:hover span {
|
89 |
+
color: #fff !important;
|
90 |
+
}
|
91 |
+
.suggest {
|
92 |
+
display: block;
|
93 |
+
height: 100px;
|
94 |
+
}
|
95 |
+
|
96 |
+
.suggest li {
|
97 |
+
float: left;
|
98 |
+
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
|
99 |
+
font-size: 12px;
|
100 |
+
height: 18px;
|
101 |
+
line-height: 18px;
|
102 |
+
text-align: left;
|
103 |
+
width: 31%;
|
104 |
+
}
|
skin/frontend/base/default/js/boxalinoAutocomplete.js
CHANGED
@@ -1,67 +1,106 @@
|
|
1 |
-
Autocompleter.Base.prototype.onKeyPress = function(event) {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
}
|
38 |
|
39 |
var originalAddClassMethod = Autocompleter.Base.prototype.render;
|
40 |
-
Autocompleter.Base.prototype.render = function(key){
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
return result;
|
59 |
-
}
|
60 |
|
|
|
|
|
|
|
61 |
|
|
|
62 |
|
|
|
|
|
|
|
|
|
63 |
|
|
|
|
|
|
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
|
|
66 |
|
|
|
|
|
|
|
|
|
67 |
|
|
1 |
+
Autocompleter.Base.prototype.onKeyPress = function (event) {
|
2 |
+
if (this.active)
|
3 |
+
switch (event.keyCode) {
|
4 |
+
case Event.KEY_TAB:
|
5 |
+
case Event.KEY_RETURN:
|
6 |
+
$a = jQuery('a.selected');
|
7 |
+
if (typeof $a[0] != 'undefined') {
|
8 |
+
window.location = $a.attr('href');
|
9 |
+
} else {
|
10 |
+
this.selectEntry();
|
11 |
+
}
|
12 |
+
Event.stop(event);
|
13 |
+
case Event.KEY_ESC:
|
14 |
+
this.hide();
|
15 |
+
this.active = false;
|
16 |
+
Event.stop(event);
|
17 |
+
return;
|
18 |
+
case Event.KEY_LEFT:
|
19 |
+
case Event.KEY_RIGHT:
|
20 |
+
return;
|
21 |
+
case Event.KEY_UP:
|
22 |
+
this.markPrevious();
|
23 |
+
this.render(true);
|
24 |
+
Event.stop(event);
|
25 |
+
return;
|
26 |
+
case Event.KEY_DOWN:
|
27 |
+
this.markNext();
|
28 |
+
this.render(true);
|
29 |
+
Event.stop(event);
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
else if (event.keyCode == Event.KEY_TAB || event.keyCode == Event.KEY_RETURN ||
|
33 |
+
(Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
|
34 |
|
35 |
+
this.changed = true;
|
36 |
+
this.hasFocus = true;
|
37 |
|
38 |
+
if (this.observer) clearTimeout(this.observer);
|
39 |
+
this.observer =
|
40 |
+
setTimeout(this.onObserverEvent.bind(this), this.options.frequency * 1000);
|
41 |
+
};
|
42 |
|
43 |
var originalAddClassMethod = Autocompleter.Base.prototype.render;
|
44 |
+
Autocompleter.Base.prototype.render = function (key) {
|
45 |
+
var result = originalAddClassMethod.apply(this, arguments);
|
46 |
+
if (typeof key != 'undefined' && key == true) {
|
47 |
+
var element = jQuery('#search_autocomplete .selected');
|
48 |
+
var word = element.data('word');
|
49 |
|
50 |
+
if (word) {
|
51 |
+
jQuery('#search_autocomplete .product-autocomplete').each(function () {
|
52 |
+
if (jQuery(this).data('word') == word) {
|
53 |
+
jQuery(this).removeClass('hide');
|
54 |
+
jQuery(this).show();
|
55 |
+
} else {
|
56 |
+
jQuery(this).addClass('hide');
|
57 |
+
jQuery(this).hide();
|
58 |
+
}
|
59 |
+
});
|
60 |
+
}
|
61 |
+
}
|
62 |
|
63 |
+
return result;
|
64 |
+
};
|
|
|
|
|
65 |
|
66 |
+
var element = null;
|
67 |
+
var x,y;
|
68 |
+
Autocompleter.Base.prototype.onHover = function (event) {
|
69 |
|
70 |
+
element = event;
|
71 |
|
72 |
+
setTimeout(function(){
|
73 |
+
if(event == element){
|
74 |
+
el = jQuery(event.target).closest('*[data-word]');
|
75 |
+
$el = jQuery(el);
|
76 |
|
77 |
+
if(Math.abs(event.pageX - x) > 50 || Math.abs(event.pageY - y) > 25){
|
78 |
+
return;
|
79 |
+
}
|
80 |
|
81 |
+
var word = el.data('word');
|
82 |
+
if (word) {
|
83 |
+
jQuery('#search_autocomplete .product-autocomplete').each(function () {
|
84 |
+
if (jQuery(this).data('word') == word) {
|
85 |
+
jQuery(this).removeClass('hide');
|
86 |
+
jQuery(this).show();
|
87 |
+
} else {
|
88 |
+
jQuery(this).addClass('hide');
|
89 |
+
jQuery(this).hide();
|
90 |
+
}
|
91 |
+
});
|
92 |
+
jQuery('*[data-word]').removeClass('selected');
|
93 |
+
jQuery(event.target).addClass('selected');
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}, 1000);
|
97 |
+
};
|
98 |
|
99 |
+
jQuery(document).ready(function () {
|
100 |
|
101 |
+
jQuery('body').on('mousemove', function (e) {
|
102 |
+
x = e.pageX;
|
103 |
+
y = e.pageY;
|
104 |
+
});
|
105 |
|
106 |
+
});
|
skin/frontend/base/default/js/jquery-noConflict.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
$.noConflict();
|
1 |
+
$.noConflict();
|