You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Matt Schraeder <MS...@btsb.com> on 2009/08/17 23:04:15 UTC
Query not working as expected
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?
RE: Query not working as expected
Posted by "Harsch, Timothy J. (ARC-SC)[PEROT SYSTEMS]" <ti...@nasa.gov>.
The rows parameter would prevent you from getting all docs back. It is set by default to 10 I believe.
-----Original Message-----
From: Matt Schraeder [mailto:MSchraeder@btsb.com]
Sent: Monday, August 17, 2009 2:04 PM
To: solr-user@lucene.apache.org
Subject: Query not working as expected
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?
Re: Query not working as expected
Posted by Mark Miller <ma...@gmail.com>.
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