On Feb 26, 2006, at 5:38 AM, Samuru Jackson wrote:

Hi to all!

I added some documents to my index repository this way:

Document document = new Document();
document.add(Field.Keyword("id", id));
document.add(Field.Keyword("type", type));
document.add(Field.Text("content", content));


Is it possible to search only within a specific Field.Keyword? For example I want to search only the contents that have got a Keyword *type*="webpages".

Is there a way to create such a filter?

Two ways....

1) Simply create a BooleanQuery with one clause a TermQuery for "type" and the constraint

2) Use a QueryFilter with that same TermQuery, and apply that Filter to your search method.

#1 is the simplest and most recommended to begin with unless you have other reasons to go to #2.

        Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to