Search code examples
pythondjangosolrdjango-haystack

how to filter search by values that are not available


I have a list of items as:

i = SearchQuerySet().models(Item)

now, each item in i has a attribute, price

I want to narrow the result in which price information is not available along with the ones falling in a given range

something like

i.narrow('price:( None OR [300 TO 400 ] )')

how can that be done?


Solution

  • Try this:

    -(-price:[300 TO 400] AND price:[* TO *])
    

    is logically the same and it works in Solr.