Thanks Chris (or if you prefer, Hoss) - I will definitely try that for
matching no docs, but one of the problems I'm having is that I'm
indexing multiple terms for one field and I need ALL the terms to
match it.
Maybe this is easier ... suppose what I'm indexing is a phone number,
and there are multiple phone numbers for what I'm indexing under the
same field (phone) and I want the wildcard query to match only records
that have either no phone numbers at all OR where ALL phone numbers
are in a specific area code (e.g. 800* would match all in the 800 area
code).
I would want something like
+phone:800*
but I want this query to ALSO exclude any hits that have any records
that DON'T match the wildcard ... so if a record has an 800* number
AND a 900* number I don't want it to be in the results..
-Ron
On Jul 15, 2008, at 4:47 PM, Chris Hostetter wrote:
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]