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 shai deljo <sh...@gmail.com> on 2007/02/25 19:54:12 UTC

Overriding Ranking in solr

Is there a way to add a plug in to override the ranking in Solr? e.g.
my ranking is based on distance from a Geo location provided in the
query.
Thanks,
Shai

Re: Overriding Ranking in solr

Posted by Chris Hostetter <ho...@fucit.org>.
Your question is broad, and has a lot of potential answers...

1) Lucene has a very configurable Scoring, that allows a lot of
customiztaion -- much of the scoring formula can be tweaked just by
changing the "Similarity" class used, other more complex things can be
achieved by writing your own Query classes

2) Solr allows for a *lot* of customization using "plugins" where just
about any class you can imagine (including Similarity, custom
RequestHandlers, and new Query clases) can be loaded from a JAR you
provide at runtime...

  http://wiki.apache.org/solr/SolrPlugins

3) Solr has a special type of query called a FunctionQuery which makes
writing special Query Scoring based on numeric Document Fields really easy
... some very complicated things can be done right out of the box using
the Function Parsing supported by the SolrQueryParser...

http://lucene.apache.org/solr/api/org/apache/solr/search/QueryParsing.html#parseFunction(java.lang.String,%20org.apache.solr.schema.IndexSchema)

...but more complicated things (like distance searching) would require you
to write a simple ValueSource definining your equation, and using that
ValueSource in a FunctionQuery you constructi na custom RequestHandler.

using FunctionQuery has been discussed on several Lucene lists in the
past, there have even been some fairly in depth discussion about using
it for Geo based scoring...

http://www.nabble.com/forum/Search.jtp?query=FunctionQuery+distance&local=y&forum=44


-Hoss