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 Urvashi Gadi <ug...@emory.edu> on 2006/04/18 21:46:18 UTC
using custom sort method
Hello All,
My requirement is to combine 2 or more fields using some critera (for
example weighted average) and sort the search results based on the
combined fields.
I am looking at DistanceComparatorSource class to implement custom sort
but it takes only one field for calculation and then sorts the result.
Is there a way to use more than one field? I looked in sorts in
succession by the criteria in each SortField class but this doesn't
fulfill my requirement.
Please suggest.
Urvashi
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: using custom sort method
Posted by Chris Hostetter <ho...@fucit.org>.
: I have asked the exact same question a few weeks ago. I just follow the
: customized distance example and loop the results again to get another
: field and compute the scores. It will be painful if you need more than 3
: fields. So far I didn't find any other way to do it. Hope we can see
It's not clear to me what exactly you've tried so far, and what it doesn't
do that you want it to ... can you post some code demonstrating your
problem?
: some new classes to address the problem. To be able to customize ranking
: is very important to a search engine.
Customizing ranking/scoring is not exactly the same thing as defining your
own sort -- there are lots of ways to customize the scoring of your
queries: doc boosts, field boosts, query boosts, customomized Similarity ...
you should also take a look at the FunctionQueries available in Solr, they
allow you to define custom functions that are factoried into the total
score of your query...
http://incubator.apache.org/solr/docs/api/org/apache/solr/search/function/package-summary.html
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: using custom sort method
Posted by Urvashi Gadi <ug...@emory.edu>.
Yang,
If you could send some more details...it would be really helpful.
Thanks
Quoting Yang Sun <ys...@ist.psu.edu>:
> I have asked the exact same question a few weeks ago. I just follow
> the customized distance example and loop the results again to get
> another field and compute the scores. It will be painful if you need
> more than 3 fields. So far I didn't find any other way to do it. Hope
> we can see some new classes to address the problem. To be able to
> customize ranking is very important to a search engine.
>
> Yang
>
> Urvashi Gadi wrote:
>
>> No...the information is available only at search time
>>
>> Quoting Erik Hatcher <er...@ehatchersolutions.com>:
>>
>>> Could your computation be done at indexing time rather than at
>>> search time? If so, pre-compute the value and index that into a
>>> single field.
>>>
>>> Erik
>>>
>>>
>>> On Apr 18, 2006, at 3:46 PM, Urvashi Gadi wrote:
>>>
>>>> Hello All,
>>>>
>>>> My requirement is to combine 2 or more fields using some critera
>>>> (for example weighted average) and sort the search results based
>>>> on the combined fields.
>>>>
>>>> I am looking at DistanceComparatorSource class to implement custom
>>>> sort but it takes only one field for calculation and then sorts
>>>> the result. Is there a way to use more than one field? I looked
>>>> in sorts in succession by the criteria in each SortField class
>>>> but this doesn't fulfill my requirement.
>>>>
>>>> Please suggest.
>>>>
>>>> Urvashi
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: using custom sort method
Posted by Yang Sun <ys...@ist.psu.edu>.
I have asked the exact same question a few weeks ago. I just follow the
customized distance example and loop the results again to get another
field and compute the scores. It will be painful if you need more than 3
fields. So far I didn't find any other way to do it. Hope we can see
some new classes to address the problem. To be able to customize ranking
is very important to a search engine.
Yang
Urvashi Gadi wrote:
> No...the information is available only at search time
>
> Quoting Erik Hatcher <er...@ehatchersolutions.com>:
>
>> Could your computation be done at indexing time rather than at search
>> time? If so, pre-compute the value and index that into a single field.
>>
>> Erik
>>
>>
>> On Apr 18, 2006, at 3:46 PM, Urvashi Gadi wrote:
>>
>>> Hello All,
>>>
>>> My requirement is to combine 2 or more fields using some critera
>>> (for example weighted average) and sort the search results based on
>>> the combined fields.
>>>
>>> I am looking at DistanceComparatorSource class to implement custom
>>> sort but it takes only one field for calculation and then sorts the
>>> result. Is there a way to use more than one field? I looked in
>>> sorts in succession by the criteria in each SortField class but
>>> this doesn't fulfill my requirement.
>>>
>>> Please suggest.
>>>
>>> Urvashi
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: using custom sort method
Posted by Urvashi Gadi <ug...@emory.edu>.
No...the information is available only at search time
Quoting Erik Hatcher <er...@ehatchersolutions.com>:
> Could your computation be done at indexing time rather than at search
> time? If so, pre-compute the value and index that into a single
> field.
>
> Erik
>
>
> On Apr 18, 2006, at 3:46 PM, Urvashi Gadi wrote:
>
>> Hello All,
>>
>> My requirement is to combine 2 or more fields using some critera
>> (for example weighted average) and sort the search results based on
>> the combined fields.
>>
>> I am looking at DistanceComparatorSource class to implement custom
>> sort but it takes only one field for calculation and then sorts the
>> result. Is there a way to use more than one field? I looked in
>> sorts in succession by the criteria in each SortField class but
>> this doesn't fulfill my requirement.
>>
>> Please suggest.
>>
>> Urvashi
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: using custom sort method
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Could your computation be done at indexing time rather than at search
time? If so, pre-compute the value and index that into a single field.
Erik
On Apr 18, 2006, at 3:46 PM, Urvashi Gadi wrote:
> Hello All,
>
> My requirement is to combine 2 or more fields using some critera
> (for example weighted average) and sort the search results based on
> the combined fields.
>
> I am looking at DistanceComparatorSource class to implement custom
> sort but it takes only one field for calculation and then sorts the
> result. Is there a way to use more than one field? I looked in
> sorts in succession by the criteria in each SortField class but
> this doesn't fulfill my requirement.
>
> Please suggest.
>
> Urvashi
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org