Ranking or position of solr in search results

I need to specify a ranking (or position, as you might prefer) or each document after the request in solr. the thing i want to see looks something like this:

<doc> <int name="field1">1</int> <str name="someotherfield">blabla</str> <int name="position">1</int> </doc> <doc> <int name="field1">2</int> <str name="someotherfield">blabla</str> <int name="position">2</int> </doc> <doc> <int name="field1">3</int> <str name="someotherfield">blabla</str> <int name="position">3</int> </doc> 

Is it possible? or do i need to implement or find a plugin?

+2
source share
2 answers

after digging the source code, now I can see dynamic positions for each different search. I just added a position function to DocIterator and implemented it in subclasses. Then I added a control block to ReturnFields to check for a position in it. It works similarly to score . and the last thing to do is add a custom augmenter class like PositionAugmenter - similar to ScoreAugmenter . Then I finished :)

thank you for david faber for giving me an idea of ​​working with source xml

+3
source

List the position field (among other things) in the results:

 ...&fl=field1,field2,position 

Sort by position

 ...&sort=position desc 

Refer to them here: http://wiki.apache.org/solr/CommonQueryParameters#sort

-2
source

Source: https://habr.com/ru/post/1211266/


All Articles