You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Michael Giles <mg...@visionstudio.com> on 2003/10/08 00:01:11 UTC

Default AND for multi-field queries...

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


Re: score for MultipleSearcher

Posted by Ype Kingma <yk...@xs4all.nl>.
Hui,

On Tuesday 07 October 2003 19:31, hui wrote:
> Hi,
> When I use the Mutliple index seach on one large index and one small index,
> look like sometimes the documents from the small index get higher score
> compared the documents from the big index. But when I look at the score
> formular, this actaully should not happen. Both indices were created by
> Lucene API 1.3rc.
> Any idea aobut this?

This could happen in case the term weights are determined per index:
the fewer documents that contain a term, the higher the term weight,
(idf: inverse document frequency).
The default scores are not normalized for the idf term weights,
only for the query term weights.

As I'm still using 1.2, I have never tried the new 1.3 features for
searching multiple indexes. I would expect 1.3 to use the total
nr. of docs containing a term in searched all indexes together,
though.

Kind regards,
Ype.


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


score for MultipleSearcher

Posted by hui <hu...@triplehop.com>.
Hi,
When I use the Mutliple index seach on one large index and one small index,
look like sometimes the documents from the small index get higher score
compared the documents from the big index. But when I look at the score
formular, this actaully should not happen. Both indices were created by
Lucene API 1.3rc.
Any idea aobut this?

Regards,
Hui


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


Re: Default AND for multi-field queries...

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
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