Reputation: 1916
This question is a more complex extension of this simpler case.
In this instance, however, suppose I have an index with the following integer attributes:
category
type
Such that each document has one category
ID and one type
ID.
Suppose I also have a list of category
IDs:
category_list = [1,3,5,7,9]
And a list of type
IDs:
type_list = [1,2]
I want to filter all documents that are NOT (IN category_list AND IN type_list)
Once again, I'm using the Python sphinxapi.py
.
Can this be done?
Upvotes: 0
Views: 151
Reputation: 21091
Very similar, just using the IN()
function
.setSelect("*, IN(category,1,3,5,7,9)+IN(type,1,2) AS myfilter")
.setFilter("myfilter", [2], true)
Not sure the best python syntax to convert a list to the string, but that shouldnt be difficult.
Upvotes: 1