: Not sure how you are indexing, but in addition to the above
: suggestion by Yonik, one could ignore 0's at indexing time,
: i.e., ensure that 0 values for that field are not indexed, and
: use sortMissingLast.

Once upon a time i had a usecase where i was indexing product data, and in 
thta product data a null price ment not currently for sale, but "0" was a 
legal price for products that were being given away free.  i had a similar 
requirement that the default sort should be based on price, but "free" 
products should come last ... except if the user explicitly said "sort by 
price".

what i did was to index a "hasPrice" field that was true if the price 
field existed and was non-zero.  my default sort was "hasPrice desc, price 
asc" but if the user clicked "sort by price" it was "price asc"

that might give you ideas about your own usecase.

-Hoss

Reply via email to