Sphinx reset only one filter

I have a sphinx object. I got the result from the sphinx. Now I need to start the search again without reloading the full object. I just need to reset to create one filter.

This is my filter, I need to reset $ sphinx-> SetFilter ("cid", $ category_ids);

How can I reset to use only one filter. I need the old values ​​to be completely removed from the filter.

+4
source share
1 answer

Add this to your SphinxClient class

<?php function RemoveFilter ( $attribute ) { assert ( is_string($attribute) ); foreach($this->_filters AS $key => $filter){ if($filter['attr'] == $attribute){ unset($this->_filters[$key]); break; } } } ?> 

Then run $SphinxClient->RemoveFilter('your filter'); to remove the filter.

+1
source

Source: https://habr.com/ru/post/1397789/


All Articles