[
https://issues.apache.org/jira/browse/SOLR-5707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14028877#comment-14028877
]
Hoss Man commented on SOLR-5707:
--------------------------------
bq. What do you mean by "positional func args to names in bindings"?
I don't know that i can explain what i was imaginging any better then the
comment i included in the patch...
{noformat}
+ // TODO: should we support mapping positional func args to names in
bindings?
+ //
+ // ie: ...
+ // <lst name="expressions">
+ // <lst name="my_expr">
+ // <str name="expression">foo * bar / baz</str>
+ // <arr name="positional-bindings">
+ // <str>baz</str>
+ // <str>bar</str>
+ // </arr>
+ // </lst>
+ // <str name="foo">32</foo>
+ // ...
+ // </lst>
+ // and then: "expr(my_expr,42,56)" == "32 * 56 / 42"
{noformat}
...i'm not really a fan of that syntax though -- I haven't played around with
expressions enough yet to know what kinds of "variable" names are allowed, but
if we can use variables like {{$1}} in expressions, then the Bindings could
look for the {{$}} prefix and map those directly to the positional function
args w/o needing the explicit {{positional-bindings}} configuration which would
be much cleaner.
bq. I think you could get your desired minimal cycle by doing your own join,
but first advancing the iterator to your current element?
I'm not following what you mean, but i'm also not sure it's worth worrying
about -- improving hte error messages to just be the minimal cycle is
definitely something i'd be happy to punt to as a later optimization. (the
most important thing is covered: not going into an infinite loop on startup
with bad config)
bq. shouldn't there be a static check that the non-expression variables are
numeric fields in the schema?
I don't think so...
# we don't ever want to explicitly enforce that the fields are numeric -- any
FieldType that supports getValueSource() should be fine -- what matters is that
any unbound variable must be a valid schema field, and the SolrBindings already
checks for that
# we could do a static valid schema field check on parser init, but i didn't
bother to add that because:
#* then we can't handle bindings that come from request params -- something
that isn't in the code yet because there wasn't a test for it in your previous
code, but i had a TODO about it and definitely want to include.
#* it wouldn't help with dynamic expressions specified at query time, so we
have to check for it in the bindings anyway.
----
FWIW: I hope to come back and revisit this in a few weeks and get all the TODOs
& nocommits resolved -- but it's on my backburner at the moment.
> 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
> Attachments: SOLR-5707.patch, SOLR-5707_vsp.patch
>
>
> Expressions should be available for use in Solr.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]