lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Default AND for multi-field queries...
Date Wed, 08 Oct 2003 01:57:15 GMT
Mike,

I agree that MultiQueryParser could use some enhancements to bring it 
closer to QueryParser's capabilities.  I'd recommend that setters be 
added rather than adding another constructor - it just makes it easier 
to add more tweakable parameters later instead of adding new 
constructors, and is in line with how QueryParser works too.

Why are you looping through your fields 6 times if you are using 
MultiFieldQueryParser?  Or is it because MFQP is not suitable to your 
needs and you're doing what it should be doing manually.

I'm curious, though, why you need to query on multiple fields with the 
same query.  Why not group, during indexing, all fields to be queried 
into a single catch-all field that you query against?

Altering a field setting on a Query seems easier said than done, 
although I need to think about this more.  Several Query subclasses 
rewrite queries based on the actual terms in the index, but that 
happens at a later stage and shouldn't actually affect the Query 
instance itself.  But queries don't (currently) have ways to change the 
term(s) dynamically after construction.

	Erik


On Tuesday, October 7, 2003, at 06:01  PM, Michael Giles wrote:

> As with many people, I want the default query behavior to be AND 
> (instead of OR).  However, I'm also (always) creating multi-field 
> queries.  I don't see a way to accomplish this cleanly in the API.  It 
> would be great if MultiFieldQueryParser had a constructor that took an 
> array of fields (i.e. String[]).  That would solve the problem (and 
> seems like a mistaken omission).  It would also be nice if QueryParser 
> allowed you to parse a query once, and then alter the field setting 
> and generate different queries.  As it stands (from my read of the 
> API), I have to loop through my list of fields (6 of them) and create 
> a new QueryParser each time.  Parsing the same query 6 times is pretty 
> ugly.  Perhaps there is a better way that I'm missing.
>
> -Mike
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message