Hello, Still working on the same query, here is the code I am currently working with.
I am thinking this should bring up all the documents that have olFaithFull=stillHere and kcfileupload!=jpg (so anything else) query1 = QueryParser.parse("jpg", "kcfileupload", new StandardAnalyzer()); query2 = QueryParser.parse("stillHere", "olFaithFull", new StandardAnalyzer()); BooleanQuery typeNegativeSearch = new BooleanQuery(); typeNegativeSearch.add(query1, false, true); typeNegativeSearch.add(query2, true, false); There toString() on the query is: -kcfileupload:jpg +olFaithFull:stillhere This looks right to me. Why the 0 results? Thanks, Luke ----- Original Message ----- From: "Maik Schreiber" <[EMAIL PROTECTED]> To: "Lucene Users List" <lucene-user@jakarta.apache.org> Sent: Thursday, February 03, 2005 1:19 PM Subject: Re: Parsing The Query: Every document that doesn't have a field containing x > > Negating a term must be combined with at least one nonnegated term to return > > documents; in other words, it isn't possible to use a query like NOT term to > > find all documents that don't contain a term. > > > > So does that mean the above example wouldn't work? > > Exactly. You cannot search for "-kcfileupload:jpg", you need at least one > clause that actually _includes_ documents. > > Do you by chance have a field with known contents? If so, you could misuse > that one and include it in your query (perhaps by doing range or > wildcard/prefix search). If not, try IndexReader.terms() for building a > Query yourself, then use that one for search. > > -- > Maik Schreiber * http://www.blizzy.de > > GPG public key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x1F11D713 > Key fingerprint: CF19 AFCE 6E3D 5443 9599 18B5 5640 1F11 D713 > > --------------------------------------------------------------------- > 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]