lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Espina <espinaemman...@gmail.com>
Subject Javascript function queries: opinions!
Date Tue, 15 Nov 2011 01:50:00 GMT
I'm going to generate some controversy with this one.

I created a proof of concept to add javascript functions to Solr and use
them as function queries. The objective of all this is to provide an easy
way to extend the function queries and to simplify its syntax and
readability. I would appreciate your opinions, in particular, regarding the
possibility of creating a Jira ticket requesting this functionality (not
necessarily to add this POC, but to initiate a discussion)


About the POC:
https://github.com/espinaemmanuel/ScriptFq

It is a ValueSource that gets a script from the solrconfig:

  <valueSourceParser name="js"
class="org.apache.solr.scriptfq.ScriptValueSourceParser">
  <str name="script"><![CDATA[
   function duplicate(doc){
   return doc.doubleVal("foo_pd")*2;
   }
  ]]></str>
  </valueSourceParser>

Where "doc" represents the current document
Then to use it you call something like:

http://localhost:8983:/solr/select?defType=edismax&q=*:*&*bf=js(duplicate)*
*
*
*Regarding the performance*, I've tested it with the standard engine
(Rhino) and, of course, it completely sucks. But in a recent post that I
published I show that using Google's V8 you can get incredible performance
boost of javascript:
http://www.lucidimagination.com/blog/2011/11/10/performance-of-googles-v8-javascript-engine-in-solr/

However, I tried my POC with V8 in the same way I tested DIH in the post
but I didn't succed. One of those horrible JNI errors that kills the JVM
arises and I could't track it. Probably its a bug with jav8 (the V8 wrapper
that I used)

Thank you

*Emmanuel Espina | Lucid Imagination  <http://www.lucidimagination.com/>
*T 1 650 353 4057 ext. 152
E emmanuel.espina @lucidimagination.com

Mime
View raw message