lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Materna, Wolf-Dietrich (empolis B)" <>
Subject RE: Implementation of 'NOT' in the Lucene.
Date Thu, 15 Aug 2002 08:55:50 GMT
> The basic scenario is this: I have two files (single line 
> files) and am running them through the demo application.
> file1: abc def 
> file1: def ghi
> I then run the query:
> -(def)
> and get the result:
> Searching for: -def
> 0 total matching documents
Sorry, this will not work, because "NOT" is evaluated on a set of documents
selected by other
parts of the query. You query contains only this exclude filter, so no
document is selected
and the result remains empty.
See also at the
last note about "NOT".

In order to make it work you have to write your own query parser and add an
dummy field
"dummy_field" contains the same value for all documents, e.g. "empty". Your
parser have to
change the original query "-def" into "dummy:empty -def" only if the query
contains nothing
But this solutions will be probaly to slow for real applications. There is
no good way to deal
such queries for large databases.
	Wolf-Dietrich Materna

Wolf-Dietrich Materna
empolis GmbH
Bertelsmann MOHN Media Group
Kekul├ęstr. 7 
12489 Berlin, Germany
phone :  +49-30-6780-6510
fax :    +49-30-6780-6549
<> <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message