You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Prasanna R <pl...@gmail.com> on 2009/12/30 21:21:39 UTC

Result ordering for Wildcard/Prefix queries or ConstantScoreQueries

All documents matched for Wildcard and Prefix queries get the same score as
they are scored as a ConstantScoreQuery. Example query - title:abc*

In such cases, what determines the ordering of the results? Is it simply the
same order in which those document terms appeared when enumerating through
the terms of the field matched in the index?

Also, would it be possible to specify criteria determining the ordering of
such matches? I am assuming that should be possible but have little idea how
that could be done. Kindly provide guidance/help.

Regards,

Prasanna.

Re: Result ordering for Wildcard/Prefix queries or ConstantScoreQueries

Posted by Prasanna R <pl...@gmail.com>.
On Wed, Dec 30, 2009 at 5:04 PM, Grant Ingersoll <gs...@gmail.com> wrote:

>
> On Dec 30, 2009, at 3:21 PM, Prasanna R wrote:
>
> > All documents matched for Wildcard and Prefix queries get the same score
> as
> > they are scored as a ConstantScoreQuery. Example query - title:abc*
> >
> > In such cases, what determines the ordering of the results? Is it simply
> the
> > same order in which those document terms appeared when enumerating
> through
> > the terms of the field matched in the index?
>
> I'm assuming they are just in order of internal Lucene doc id, but I'd have
> to look for sure.  There was also some changes to Lucene that allowed the
> collectors to take docs out of order, but again, I'd have to check to see if
> that is the case.
>
> >
> > Also, would it be possible to specify criteria determining the ordering
> of
> > such matches? I am assuming that should be possible but have little idea
> how
> > that could be done. Kindly provide guidance/help.
>
> Sort?
>
> What problem are you trying to solve?
>
> I am using a prefix query to match a bunch of documents and would like to
specify an ordering for the documents matched for that prefix query This is
part of the work I am doing in implementing an autocomplete feature and I am
using the dismax query parser with some custom modifications. I assume you
mean that I can apply a sort ordering to the prefix query matches as part of
the results handler. I was not aware of the same. Will look into that.

Thanks a lot for the help.

Regards,

Prasanna.

Re: Result ordering for Wildcard/Prefix queries or ConstantScoreQueries

Posted by Grant Ingersoll <gs...@gmail.com>.
On Dec 30, 2009, at 3:21 PM, Prasanna R wrote:

> All documents matched for Wildcard and Prefix queries get the same score as
> they are scored as a ConstantScoreQuery. Example query - title:abc*
> 
> In such cases, what determines the ordering of the results? Is it simply the
> same order in which those document terms appeared when enumerating through
> the terms of the field matched in the index?

I'm assuming they are just in order of internal Lucene doc id, but I'd have to look for sure.  There was also some changes to Lucene that allowed the collectors to take docs out of order, but again, I'd have to check to see if that is the case.

> 
> Also, would it be possible to specify criteria determining the ordering of
> such matches? I am assuming that should be possible but have little idea how
> that could be done. Kindly provide guidance/help.

Sort?

What problem are you trying to solve?

-Grant