lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin <>
Subject Re: InverseWildcardQuery
Date Fri, 30 Jul 2010 16:32:13 GMT
> assuming that you mistakenly used the same field name

Nope, wasn't a mistake. We'd have to dynamically iterate through an unknown 
number of fields if we didn't use the same one.

----- Original Message ----
From: Steven A Rowe <>
To: "" <>
Sent: Fri, July 30, 2010 11:14:17 AM
Subject: RE: InverseWildcardQuery

Hi Justin,

> [...] "*:* AND -myfield:foo*".
> If my document contains "myfield:foobar" and "myfield:dog", the document
> would be thrown out because of the first field. I want to keep the
> document because the second field does not match.

I'm assuming that you mistakenly used the same field name above in 
("myfield:foobar" and "myfield:dog"), and that you instead meant:

    "myfield1:foobar" and "myfield2:dog".

I think you can get what you want by specifying every field in the query - e.g., 
if each document has the same set of two fields F1 and F2:

    (*:* AND -F1:foo*) OR (*:* AND -F2:foo*)

Truth table for four documents:

    Doc1: F1:foobar (no-match), F2:dog      (match)    => match
    Doc2: F1:cat    (match),    F2:dog      (match)    => match
    Doc3: F1:cat    (match),    F2:foosball (no-match) => match
    Doc4: F1:foobar (no-match), F2:foosball (no-match) => no-match

Good luck,


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

View raw message