lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Boolean expression for no terms OR matching a wildcard
Date Tue, 15 Jul 2008 20:47:55 GMT

Assuming i understand your question: the fact that your first clause is a 
wildcard query is irrelevant, to generalize your request you want a way to 
query for all docs which either match some sub query, or have no terms in 
the field at all.  to find all docs with no terms for a given field, you 
need to search for all docs (MatchAllDocs), then exclude the docs that 
have a value for 
thatfield -- which is easy to do using a ConstantScoreRangeQuery where the 
lower and upper bounds are both null.

essentially you want something like...

   myfield:abc*123  (+MatchAllDocsQuery -myfield:[* TO *])

(except you'll have to construct the MatchAllDocsQuery and the two 
BooleanQueries yourself)


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message