You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by James Greene <ja...@jamesaustingreene.com> on 2022/06/01 17:21:41 UTC

Param Substitution in Stream Expressions?

My application relies on local parameter substitution pretty heavily due to
escaping issues and being able to re-use clauses.

Is there any way to use param substitution in a /stream expression?

(This doesn't work):

POST /stream {
  'expr': 'search(collection1,q=$test,fl="doc_id",sort="doc_id
asc",qt="/export")',   'test': 'contains:blah'
}



Cheers,
JAG

Re: Param Substitution in Stream Expressions?

Posted by James Greene <ja...@jamesaustingreene.com>.
Joel, I owe you a beer!

On Wed, Jun 1, 2022, 2:55 PM Joel Bernstein <jo...@gmail.com> wrote:

> Hi,
>
> You'll need to set a Java system property at startup to run macro expansion
> in Streaming Expressions.
>
> See the commit below which references the jira with the security concerns:
>
>
> https://github.com/apache/solr/commit/9edc557f4526ffbbf35daea06972eb2c595e692b
>
> The parameter setting is as follows:
>
> -DStreamingExpressionMacros=true
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
>
> On Wed, Jun 1, 2022 at 1:22 PM James Greene <ja...@jamesaustingreene.com>
> wrote:
>
> > My application relies on local parameter substitution pretty heavily due
> to
> > escaping issues and being able to re-use clauses.
> >
> > Is there any way to use param substitution in a /stream expression?
> >
> > (This doesn't work):
> >
> > POST /stream {
> >   'expr': 'search(collection1,q=$test,fl="doc_id",sort="doc_id
> > asc",qt="/export")',   'test': 'contains:blah'
> > }
> >
> >
> >
> > Cheers,
> > JAG
> >
>

Re: Param Substitution in Stream Expressions?

Posted by Joel Bernstein <jo...@gmail.com>.
Hi,

You'll need to set a Java system property at startup to run macro expansion
in Streaming Expressions.

See the commit below which references the jira with the security concerns:

https://github.com/apache/solr/commit/9edc557f4526ffbbf35daea06972eb2c595e692b

The parameter setting is as follows:

-DStreamingExpressionMacros=true


Joel Bernstein
http://joelsolr.blogspot.com/


On Wed, Jun 1, 2022 at 1:22 PM James Greene <ja...@jamesaustingreene.com>
wrote:

> My application relies on local parameter substitution pretty heavily due to
> escaping issues and being able to re-use clauses.
>
> Is there any way to use param substitution in a /stream expression?
>
> (This doesn't work):
>
> POST /stream {
>   'expr': 'search(collection1,q=$test,fl="doc_id",sort="doc_id
> asc",qt="/export")',   'test': 'contains:blah'
> }
>
>
>
> Cheers,
> JAG
>