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 qrcde <ra...@yahoo.com> on 2013/10/17 00:11:06 UTC

Solr - Read sort data from external source

Hello,

I am trying to write some code to read rank data from external db, I saw
some example done using database -
http://sujitpal.blogspot.com/2011/05/custom-sorting-in-solr-using-external.html,
where they fetch whole database during index searcher creation and cache it.

But is there any way to pass parameter or choose different database during
FieldComparator based on query. Lets say I want to pass versions, the sort
order in version 1 will be different then sort order in v2.

Or if I use ExternalFileField is there way to load different file base on
query parameter? 

Regards



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Read-sort-data-from-external-source-tp4095970.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - Read sort data from external source

Posted by Chris Hostetter <ho...@fucit.org>.
: I am trying to write some code to read rank data from external db, I saw
: some example done using database -
: http://sujitpal.blogspot.com/2011/05/custom-sorting-in-solr-using-external.html,
	...
: But is there any way to pass parameter or choose different database during
: FieldComparator based on query. Lets say I want to pass versions, the sort
: order in version 1 will be different then sort order in v2.

I would suggest that instead of trying to implement a custom sort, you 
instead look into implementing a custom ValueSourceParser -- this lets 
you define custom functions that can take input, and then use the 
function input to specify your query time variations.

any registered function name can be sorted on.

I think this article is still fairly accurate in terms of the internal 
APIs you need to implemnt...

http://java.dzone.com/news/how-write-custom-solr

...or if you liked Sujit's blog on custom sorting, he has a more recent 
one on custom functions...

http://sujitpal.blogspot.com/2013/03/solr-custom-ranking-with-function.html


-Hoss