I have a list of items as:
i = SearchQuerySet().models(Item)
now, each item in i
has a attribute, price
I wan
The aim was to sort some items by score based on an boosting by type and plus if a type:bike item has an image. The result should be:
This was my first query approach:
type:"car"^10000 OR type:"boat"^5000 OR (type:"bike" AND image-type:[* TO *])^100 OR type:"bike"^5
(works fine)
But i forgot old data items without the type field. The should be in the result set like this:
So i changed my query to -type:[* TO *] OR type:"car"^10000 OR type:"boat"^5000 OR (type:"bike" AND image-type:[* TO *])^100 OR type:"bike"^5
and ended up with no results.
So i found this thread and tried to change my query to -(type:[* TO *] OR -type:"car"^10000 OR -type:"boat"^5000 OR -(type:"bike" AND image-type:[* TO *])^100 OR -type:"bike"^5
) like shown in this answer https://stackoverflow.com/a/17211744/326905
But sadly all items have the same score :(