On Fri, 2005-02-18 at 03:58 +0100, Miro Max wrote:
> how can i search for content where type=document or
> (type=document OR type=view).
> actually i can do it with: "(type:document OR
> type:entry) AND queryText" as QueryString.
> but does exist any other better way to realize this?

What's wrong with that method? I don't think you can do it any simpler. 

Are you concerned about writing a string then having to use the query
parser? You could also build it up manually:

QueryParser parser = ...

Query text = parser.parse(queryText);

Query type = new BooleanQuery();
type.add(new TermQuery(new Term("type", "document")), false, false);
type.add(new TermQuery(new Term("type", "view")), false, false);

Query everything = new BooleanQuery();
everything.add(text, true, false);
everything.add(type, true, false);

That way you could avoid things in queryText overriding the type check.

Another alternative is to put each type in it's own index and use a
MultiSearcher to pull in the types you want.



-- 
Miles Barr <[EMAIL PROTECTED]>
Runtime Collective Ltd.


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

Reply via email to