lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven A Rowe <>
Subject RE: InverseWildcardQuery
Date Fri, 30 Jul 2010 16:14:17 GMT
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,

View raw message