Re: select where from query type in lucene

2005-02-18 Thread Morus Walter
Miles Barr writes:
> 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?
>
[...] 
> 
> Another alternative is to put each type in it's own index and use a
> MultiSearcher to pull in the types you want.
> 
If the change rate of the index and the number of commonly used
type combinations aren't too large, cached filters might be another 
alternative.
Of couse the filter would have to be recreated whenever the index changes.
The advantage is, that you save searching for the types for each query
where the filter is reused while you can keep all documents within one 
index.

Morus

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



Re: select where from query type in lucene

2005-02-18 Thread Miles Barr
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]



select where from query type in lucene

2005-02-17 Thread Miro Max
Hi,

i've problem with my my classes using lucene.
my index looks like:

type   |   content
-
document   |  x
document   |  x
view   |  x
view   |  x
dbentry|  x
dbentry|  x

my question now:

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?

thx

miro




___ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: 
http://mail.yahoo.de

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