[ 
https://issues.apache.org/jira/browse/SOLR-5707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17985630#comment-17985630
 ] 

David Smiley commented on SOLR-5707:
------------------------------------

I updated the PR with a new Solr Ref Guide page.  As I look at it and think 
about this, I don't think it's ideal for there to be one registration of this 
value source parser that lists named expressions within it.  Instead, I think 
each named expression should itself be a ValueSource, and ideally it would then 
have access to all other value sources (i.e. those defined by Solr and custom 
ones).  So instead of
{code:xml}
<valueSourceParser name="expr" class="solr.ExpressionValueSourceParser">
  <lst name="expressions">
    <str name="sqrt_popularity">sqrt(popularity)</str>
    <str name="log_price">log(price)</str>
    <str name="boost_formula">sqrt_popularity / log_price</str>
  </lst>
</valueSourceParser>
{code}
We'd have 3 separate ones.  Here's the first:
{code:xml}
<valueSourceParser name="sqrt_popularity" 
class="solr.ExpressionValueSourceParser">
  <str name="expression">sqrt(popularity)</str>
</valueSourceParser>
{code}
I think this is much easier understand -- basically it allows someone to define 
a custom ValueSource merely by putting a small JavaScript expression.  I think 
this would deliver the best user experience, and integration with other 
ValueSources shouldn't be an afterthought -- it's expected/natural.  There may 
be some challenges to late-bind/compile since I don't think it can be done 
early, since at that time, not all VSPs are even known.  At first we could just 
convert any function call to a lookup of a ValueSource that we convert to a 
DoubleValuesSource.  Ideally we could detect if it could be unwrapped but that 
could come later with a small Lucene addition.

> Lucene Expressions in Solr
> --------------------------
>
>                 Key: SOLR-5707
>                 URL: https://issues.apache.org/jira/browse/SOLR-5707
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Ryan Ernst
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: SOLR-5707.patch, SOLR-5707_vsp.patch
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Expressions should be available for use in Solr.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to