Isn't this what Solr/Lucene are designed to do??

On indexing a document, Lucene creates an inverted index, mapping terms
back to their containing documents. The data you have is already
inverted.

I'd suggest uninverting it and then hand it to Solr in that format,
thus:

doc1: java
doc2: java
doc4: book
doc5: java
doc9: book
doc77: book

With that structure, you'll have in your index exactly what Solr
expects, and will be able to take advantage of the inbuilt ranking
capabilities of Lucene and Solr.

Upayavira

On Wed, Nov 28, 2012, at 10:15 AM, Floyd Wu wrote:
> Hi there,
> 
> If I have a list that is key-value pair in text filed or database table.
> How do I achieve dynamic ranking based on search term? That say when user
> search term "java" and doc1,doc2, doc5 will get higher ranking.
> 
> for example( key is search term, value is related index document unique
> key):
> ==========
> key, value
> ==========
> java, doc1,doc2,doc5
> book, doc9, doc4,doc77
> ==========
> 
> I've finished implementation using externalFileField to do ranking, but
> in
> this way, ranking is static.
> 
> Please kindly point me a way to do this.
> 
> PS: SearchComponent maybe?

Reply via email to