lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Chandler <a...@chandlerfamily.org.uk>
Subject Re: Confused about boolean query and how an IndexReader is associated with Hits
Date Wed, 07 Dec 2005 20:44:47 GMT
On Wednesday 07 Dec 2005 19:00, Chris Hostetter wrote:
> : In otherwords my BooleanQuery was more complex than I let on.
>
> I believe I understand what you are saying, but it's a little hard to make
> sense of given teh corrections and lack of context -- it sounds like it
> shoudl work.  please print out query.toString() and make sure it looks
> like what you are expecting.

 -ID:0 Category:Category1 Category:Category2

What I hope this says is

"Give me all documents whose ID is not "0" AND which have a Category Field 
which contains "Category1" or "Category2"

What I seem to be getting is only the document whose ID is "0"

> As I remember someone else saying (I'm guessing Erik) if you're having
> trouble, pelase post a simple, comlete, self contained (ideally JUnit)
> example of your that uses a RAMDirectory.  You're sure to get lots of help
> if everyone can immediately run your code to see your problem.



How do I do that?  As a jar file with the relevent source code in it?  Posted 
as an attachment to this mailing list?



>
>
> Something else you should think about *after* you get this working...
>
> : (My config document has the field "ID" set to value "0" - all the other
> : documents have a single field called "ID" set to the string of a positive
> : integer so config is defined as
> :
> : private static final TermQuery config =new TermQuery(new Term("ID","0"));
> : )
>
> FYI: it sounds like what you're trying to achieve with this TermQuery in
> particular could best be done with a Filter that only allows documents
> which do not contain that magic term -- for stuff like this, filters can
> be faster then BooleanQueries with negated clauses (especially if you know
> that there will only ever be one of these config docs, you can short
> circut all the others) and they can be cached and reused, saving even more
> time.

I'll take a look - I happen to use the single TermQuery quite a lot to access 
the "config" document (it holds the nextID for new documents, it also holds 
all the allowable categories, so I am always using it for that.


-- 
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.

---------------------------------------------------------------------
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