Are you asking to sort on the number of matching terms?

Not an answer, but hopefully giving you pointers...

Firstly, highlighting is done in the highlighting component, which comes
after the QueryComponent in the list of search components invoked.
Sorting happens within the QueryComponent, which therefore cannot make
use of information not yet derived, which makes your request challenging
right from the start.

A sensible way to implement sort here is to implement a function query
(which I think you can do using a ValueSourceParser in 4.0). You can
then sort on that function. So, the question is how can you derive a
numerical value from a document that will represent your sort
preference, before highlighting has actually happened, and how can you
do so quickly enough, given that the value will have to be calculated
for every document matching your query, not just for the ones returned
to your user.

HTH

Upayavira

On Mon, Jan 7, 2013, at 07:27 AM, wwhite1133 wrote:
> Hi ,
>  I wanted to sort the results of the solr search query on the number of
> highlights generated per document. 
> e.g  
> Doc 1 
> highlights {
> fieldA
> FieldB
> }
> Doc 2
> Highlights{
> field A 
> fieldC
> fieldC
> }
> 
> No, I understand that score is calculated depending on many factors like
> ,
> tf , idf boost etc. So when I sort on score the the document with 2
> highlights can come ahead of the document with 3 highlights.
> How can I sort based on purely the number of highlights. 
> Right now I am doing it in the code but 
> I do not want to do this in code  as then the pagination becomes an issue
> .
> I have to fetch a larger number of records and do in memory sorting . 
> 
> Any help is appreciated.
> Thanks 
> WW
> 
> 
> 
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Sorting-the-search-results-based-on-number-of-highlights-tp4031175.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to