Matt Schraeder wrote:
I'm attempting to write a query as follows:
($query^10) OR (NOT ($query)) which effectively would return everything, but if it matches the first query it will get a higher score and thus be sorted first in the result set. Unfortunately the results are not coming back as expected. ($query) works by itself and gets X rows
(NOT ($query)) works by itself and gets Y rows
You would expect ($query) OR (NOT ($query)) to return X+Y rows but it is only returning X rows. What am I doing wrong?


I believe that Solr will only allow a put 'not' in the top level of a Boolean query - also not sure if it supports NOT or just !.

In any case, to use it deeper than the top level you must use the MatchAllDocsQuery syntax (obviously doesn't apply to DisMax):

($query^10) OR (*:* NOT ($query))



--
- Mark

http://www.lucidimagination.com



Reply via email to