On Sep 2, 2010, at 3:39 PM, Gerald wrote:

> 
> while investigating custom functions in solr, I noticed LiteralValueSource
> 
> according to the one line documentation will "Pass a the field value through
> as a String, no matter the type"
> 
> how would I use such a value source?  if it is a value source, I should be
> able to use it in functionqueries for string related tests.

It can be used to pass a String to a function.  It is then up to that function 
to do something with it.  For instance, the StringDistance function (or 
whatever it's called) could use the literal value and compare it to the value 
of the string on the field for a document and then return the score.  It's kind 
of like boosting based on a fuzzy match.

> 
> the reason I was wondering was that I wanted to see if I could create a
> custom function that returned a string value source (after some
> manipulation) to the query, possibly something like this:
> 
> http://mysolrserver:8080/solr/select?q=*:* AND
> _val_:("mycustomstrfunction(mysolrfield):'somestringvalue'")&sort=score asc
> 
> is this type of functionality feasible in solr?

I'm not sure on your syntax there, but yes, you can have function that returned 
a string as a value source (for the DocValues), eventually, though, you need to 
translate that string into a float, as FunctionQuery itself isn't going to work 
with a string.


--------------------------
Grant Ingersoll
http://lucenerevolution.org Apache Lucene/Solr Conference, Boston Oct 7-8

Reply via email to