lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Bowyer <gbow...@fastmail.co.uk>
Subject Re: Javascript function queries: opinions!
Date Tue, 15 Nov 2011 01:55:48 GMT
Would it be hard to alter this slightly to use a "script" style tag

my rationale is I would like to say something like

<script type="text/python">
def duplicate(doc):
     return doc.doubleval("foo_pd") * 2
</script>

and I am sure others would like to say ruby, scala, clojure ..... etc 
etc etc

-- Greg
On 14/11/11 17:50, Emmanuel Espina wrote:
> 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 <http://lucidimagination.com>
>


Mime
View raw message