ValueSourceParser — yes. You’ll find a ton of them in Solr to get ideas from.
In your example you forgot the “asc” or “desc”. ~ David Smiley Freelance Apache Lucene/Solr Search Consultant/Developer http://www.linkedin.com/in/davidwsmiley On Fri, Apr 3, 2015 at 9:44 AM, Robert Krüger <krue...@lesspain.de> wrote: > Hi, > > I have been looking around on the web for information on sorting by a > custom function but the results are inconclusive to me and some of it seems > so old that I suspect it's outdated. What I want to do is the following: > > I have a field "fingerprint" in my schema that contains a binary data (e.g. > 64 bytes) that can be used to compute a distance/similarity between two > records. > > Now I want to be able to execute a query and sort its result by the > distance of the matching records from a given reference value, so the query > would look something like this > > q=*:*&sort=my_distance_func(fingerprint, 0xadet54786eguizgig) > > where > > my_distance_func is my custom function > fingerprint is the field in my schema (type binary) > 0xadet54786eguizgig is a reference value (byte array encoded in whatever > way) to which the distance shall be computed, which differs with each > query. > > Is ValueSourceParser the right way to look here? Is there a source code > example someone can point me to? > > Thanks in advance, > > Robert >