You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Pratik Patel <pr...@semandex.net> on 2018/06/27 19:58:03 UTC
String concatenation in Streaming Expressions
Hello,
Is there a function which can be used in Streaming Expressions to
concatenate two strings? I want to use it just like add(1,2) in a Streaming
Expression. Essentially, I want to achieve something as follows.
select(
search(..),
conceptid as foo,
storeid as bar
concat(foo,bar) as id
)
I can use merge() function but my streaming expression is quite complex and
that will make it even more complex as that would be a round about way of
doing it. Any idea how this can be achieved?
Thanks,
Pratik
Re: String concatenation in Streaming Expressions
Posted by Aroop Ganguly <ar...@icloud.com>.
I think there is a bug here in your query, the syntax is : concat(fields=\"fieldA,fieldB\", as=\"fieldABConcat\", delim=\"-\")"
Try this:
select(
search(collection1,q="*:*",fl="conceptid",sort="conceptid
asc",fq=storeid:"59c03d21d997b97bf47b3eeb",fq=schematype:"Article",fq=tags:"genetics",
qt="/export"),
conceptid as conceptid,
storeid as "test_",
concat(fields=\"conceptid,storeid\", as=\”blah\”, delim=\"-\")
)
> On Jun 27, 2018, at 2:59 PM, Pratik Patel <pr...@semandex.net> wrote:
>
> Thanks Aroop,
>
> I tired following Streaming Expression but it doesn't work for me.
>
> select(
> search(collection1,q="*:*",fl="conceptid",sort="conceptid
> asc",fq=storeid:"59c03d21d997b97bf47b3eeb",fq=schematype:"Article",fq=tags:"genetics",
> qt="/export"),
> conceptid as conceptid,
> storeid as "test_",
> concat([conceptid,storeid], conceptid, "-")
> )
>
> It generates an exception, "Invalid expression
> concat([conceptid,storeid],conceptid,\"-\") - unknown operands found"
>
> Is this correct syntax?
>
> On Wed, Jun 27, 2018 at 4:30 PM, Aroop Ganguly <ar...@icloud.com>
> wrote:
>
>> It seems like append is not available on 6.4, but concat is …
>> Check this out on the 6.4 branch:
>> https://github.com/apache/lucene-solr/blob/branch_6_4/
>> solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/
>> ConcatOperationTest.java <https://github.com/apache/
>> lucene-solr/blob/branch_6_4/solr/solrj/src/test/org/
>> apache/solr/client/solrj/io/stream/ops/ConcatOperationTest.java>
>>
>>
>>> On Jun 27, 2018, at 1:27 PM, Aroop Ganguly <ar...@icloud.com>
>> wrote:
>>>
>>> It should, but 6.6.* has some issues of things not working per
>> documentation.
>>> Try using 7+.
>>>
>>>> On Jun 27, 2018, at 1:24 PM, Pratik Patel <pr...@semandex.net> wrote:
>>>>
>>>> Thanks a lot for help!
>>>>
>>>> Looks like this is a recent addition? It doesn't work for me in version
>>>> 6.6.4
>>>>
>>>>
>>>>
>>>> On Wed, Jun 27, 2018 at 4:18 PM, Aroop Ganguly <aroopganguly@icloud.com
>>>
>>>> wrote:
>>>>
>>>>> So it will become:
>>>>> select(
>>>>> search(..),
>>>>> conceptid as foo,
>>>>> storeid as bar
>>>>> append(conceptid, storeid) as id
>>>>> )
>>>>>
>>>>> Or
>>>>> select
>>>>> select(
>>>>> search(..),
>>>>> conceptid as foo,
>>>>> storeid as bar
>>>>> ),
>>>>> foo,
>>>>> bar,
>>>>> append(foo,bar) as id
>>>>> )
>>>>>
>>>>>> On Jun 27, 2018, at 1:12 PM, Aroop Ganguly <ar...@icloud.com>
>>>>> wrote:
>>>>>>
>>>>>> this test case here will help in understanding the usage:
>>>>>> https://github.com/apache/lucene-solr/blob/branch_7_2/
>>>>> solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/
>>>>> AppendEvaluatorTest.java <https://github.com/apache/
>>>>> lucene-solr/blob/branch_7_2/solr/solrj/src/test/org/
>>>>> apache/solr/client/solrj/io/stream/eval/AppendEvaluatorTest.java>
>>>>>>
>>>>>>> On Jun 27, 2018, at 1:07 PM, Aroop Ganguly <ar...@icloud.com>
>>>>> wrote:
>>>>>>>
>>>>>>> I think u can use the append evaluator
>>>>>>> https://github.com/apache/lucene-solr/blob/master/solr/
>>>>> solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java
>> <
>>>>> https://github.com/apache/lucene-solr/blob/master/solr/
>>>>> solrj/src/java/org/apache/solr/client/solrj/io/eval/
>> AppendEvaluator.java>
>>>>>>>
>>>>>>>
>>>>>>>> On Jun 27, 2018, at 12:58 PM, Pratik Patel <pr...@semandex.net>
>>>>> wrote:
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> Is there a function which can be used in Streaming Expressions to
>>>>>>>> concatenate two strings? I want to use it just like add(1,2) in a
>>>>> Streaming
>>>>>>>> Expression. Essentially, I want to achieve something as follows.
>>>>>>>>
>>>>>>>> select(
>>>>>>>> search(..),
>>>>>>>> conceptid as foo,
>>>>>>>> storeid as bar
>>>>>>>> concat(foo,bar) as id
>>>>>>>> )
>>>>>>>>
>>>>>>>> I can use merge() function but my streaming expression is quite
>>>>> complex and
>>>>>>>> that will make it even more complex as that would be a round about
>> way
>>>>> of
>>>>>>>> doing it. Any idea how this can be achieved?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Pratik
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>
>>
>>
Re: String concatenation in Streaming Expressions
Posted by Pratik Patel <pr...@semandex.net>.
Thanks Aroop,
I tired following Streaming Expression but it doesn't work for me.
select(
search(collection1,q="*:*",fl="conceptid",sort="conceptid
asc",fq=storeid:"59c03d21d997b97bf47b3eeb",fq=schematype:"Article",fq=tags:"genetics",
qt="/export"),
conceptid as conceptid,
storeid as "test_",
concat([conceptid,storeid], conceptid, "-")
)
It generates an exception, "Invalid expression
concat([conceptid,storeid],conceptid,\"-\") - unknown operands found"
Is this correct syntax?
On Wed, Jun 27, 2018 at 4:30 PM, Aroop Ganguly <ar...@icloud.com>
wrote:
> It seems like append is not available on 6.4, but concat is …
> Check this out on the 6.4 branch:
> https://github.com/apache/lucene-solr/blob/branch_6_4/
> solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/
> ConcatOperationTest.java <https://github.com/apache/
> lucene-solr/blob/branch_6_4/solr/solrj/src/test/org/
> apache/solr/client/solrj/io/stream/ops/ConcatOperationTest.java>
>
>
> > On Jun 27, 2018, at 1:27 PM, Aroop Ganguly <ar...@icloud.com>
> wrote:
> >
> > It should, but 6.6.* has some issues of things not working per
> documentation.
> > Try using 7+.
> >
> >> On Jun 27, 2018, at 1:24 PM, Pratik Patel <pr...@semandex.net> wrote:
> >>
> >> Thanks a lot for help!
> >>
> >> Looks like this is a recent addition? It doesn't work for me in version
> >> 6.6.4
> >>
> >>
> >>
> >> On Wed, Jun 27, 2018 at 4:18 PM, Aroop Ganguly <aroopganguly@icloud.com
> >
> >> wrote:
> >>
> >>> So it will become:
> >>> select(
> >>> search(..),
> >>> conceptid as foo,
> >>> storeid as bar
> >>> append(conceptid, storeid) as id
> >>> )
> >>>
> >>> Or
> >>> select
> >>> select(
> >>> search(..),
> >>> conceptid as foo,
> >>> storeid as bar
> >>> ),
> >>> foo,
> >>> bar,
> >>> append(foo,bar) as id
> >>> )
> >>>
> >>>> On Jun 27, 2018, at 1:12 PM, Aroop Ganguly <ar...@icloud.com>
> >>> wrote:
> >>>>
> >>>> this test case here will help in understanding the usage:
> >>>> https://github.com/apache/lucene-solr/blob/branch_7_2/
> >>> solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/
> >>> AppendEvaluatorTest.java <https://github.com/apache/
> >>> lucene-solr/blob/branch_7_2/solr/solrj/src/test/org/
> >>> apache/solr/client/solrj/io/stream/eval/AppendEvaluatorTest.java>
> >>>>
> >>>>> On Jun 27, 2018, at 1:07 PM, Aroop Ganguly <ar...@icloud.com>
> >>> wrote:
> >>>>>
> >>>>> I think u can use the append evaluator
> >>>>> https://github.com/apache/lucene-solr/blob/master/solr/
> >>> solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java
> <
> >>> https://github.com/apache/lucene-solr/blob/master/solr/
> >>> solrj/src/java/org/apache/solr/client/solrj/io/eval/
> AppendEvaluator.java>
> >>>>>
> >>>>>
> >>>>>> On Jun 27, 2018, at 12:58 PM, Pratik Patel <pr...@semandex.net>
> >>> wrote:
> >>>>>>
> >>>>>> Hello,
> >>>>>>
> >>>>>> Is there a function which can be used in Streaming Expressions to
> >>>>>> concatenate two strings? I want to use it just like add(1,2) in a
> >>> Streaming
> >>>>>> Expression. Essentially, I want to achieve something as follows.
> >>>>>>
> >>>>>> select(
> >>>>>> search(..),
> >>>>>> conceptid as foo,
> >>>>>> storeid as bar
> >>>>>> concat(foo,bar) as id
> >>>>>> )
> >>>>>>
> >>>>>> I can use merge() function but my streaming expression is quite
> >>> complex and
> >>>>>> that will make it even more complex as that would be a round about
> way
> >>> of
> >>>>>> doing it. Any idea how this can be achieved?
> >>>>>>
> >>>>>> Thanks,
> >>>>>> Pratik
> >>>>>
> >>>>
> >>>
> >>>
> >
>
>
Re: String concatenation in Streaming Expressions
Posted by Aroop Ganguly <ar...@icloud.com>.
It seems like append is not available on 6.4, but concat is …
Check this out on the 6.4 branch:
https://github.com/apache/lucene-solr/blob/branch_6_4/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/ConcatOperationTest.java <https://github.com/apache/lucene-solr/blob/branch_6_4/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/ops/ConcatOperationTest.java>
> On Jun 27, 2018, at 1:27 PM, Aroop Ganguly <ar...@icloud.com> wrote:
>
> It should, but 6.6.* has some issues of things not working per documentation.
> Try using 7+.
>
>> On Jun 27, 2018, at 1:24 PM, Pratik Patel <pr...@semandex.net> wrote:
>>
>> Thanks a lot for help!
>>
>> Looks like this is a recent addition? It doesn't work for me in version
>> 6.6.4
>>
>>
>>
>> On Wed, Jun 27, 2018 at 4:18 PM, Aroop Ganguly <ar...@icloud.com>
>> wrote:
>>
>>> So it will become:
>>> select(
>>> search(..),
>>> conceptid as foo,
>>> storeid as bar
>>> append(conceptid, storeid) as id
>>> )
>>>
>>> Or
>>> select
>>> select(
>>> search(..),
>>> conceptid as foo,
>>> storeid as bar
>>> ),
>>> foo,
>>> bar,
>>> append(foo,bar) as id
>>> )
>>>
>>>> On Jun 27, 2018, at 1:12 PM, Aroop Ganguly <ar...@icloud.com>
>>> wrote:
>>>>
>>>> this test case here will help in understanding the usage:
>>>> https://github.com/apache/lucene-solr/blob/branch_7_2/
>>> solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/
>>> AppendEvaluatorTest.java <https://github.com/apache/
>>> lucene-solr/blob/branch_7_2/solr/solrj/src/test/org/
>>> apache/solr/client/solrj/io/stream/eval/AppendEvaluatorTest.java>
>>>>
>>>>> On Jun 27, 2018, at 1:07 PM, Aroop Ganguly <ar...@icloud.com>
>>> wrote:
>>>>>
>>>>> I think u can use the append evaluator
>>>>> https://github.com/apache/lucene-solr/blob/master/solr/
>>> solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java <
>>> https://github.com/apache/lucene-solr/blob/master/solr/
>>> solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java>
>>>>>
>>>>>
>>>>>> On Jun 27, 2018, at 12:58 PM, Pratik Patel <pr...@semandex.net>
>>> wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> Is there a function which can be used in Streaming Expressions to
>>>>>> concatenate two strings? I want to use it just like add(1,2) in a
>>> Streaming
>>>>>> Expression. Essentially, I want to achieve something as follows.
>>>>>>
>>>>>> select(
>>>>>> search(..),
>>>>>> conceptid as foo,
>>>>>> storeid as bar
>>>>>> concat(foo,bar) as id
>>>>>> )
>>>>>>
>>>>>> I can use merge() function but my streaming expression is quite
>>> complex and
>>>>>> that will make it even more complex as that would be a round about way
>>> of
>>>>>> doing it. Any idea how this can be achieved?
>>>>>>
>>>>>> Thanks,
>>>>>> Pratik
>>>>>
>>>>
>>>
>>>
>
Re: String concatenation in Streaming Expressions
Posted by Aroop Ganguly <ar...@icloud.com>.
It should, but 6.6.* has some issues of things not working per documentation.
Try using 7+.
> On Jun 27, 2018, at 1:24 PM, Pratik Patel <pr...@semandex.net> wrote:
>
> Thanks a lot for help!
>
> Looks like this is a recent addition? It doesn't work for me in version
> 6.6.4
>
>
>
> On Wed, Jun 27, 2018 at 4:18 PM, Aroop Ganguly <ar...@icloud.com>
> wrote:
>
>> So it will become:
>> select(
>> search(..),
>> conceptid as foo,
>> storeid as bar
>> append(conceptid, storeid) as id
>> )
>>
>> Or
>> select
>> select(
>> search(..),
>> conceptid as foo,
>> storeid as bar
>> ),
>> foo,
>> bar,
>> append(foo,bar) as id
>> )
>>
>>> On Jun 27, 2018, at 1:12 PM, Aroop Ganguly <ar...@icloud.com>
>> wrote:
>>>
>>> this test case here will help in understanding the usage:
>>> https://github.com/apache/lucene-solr/blob/branch_7_2/
>> solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/
>> AppendEvaluatorTest.java <https://github.com/apache/
>> lucene-solr/blob/branch_7_2/solr/solrj/src/test/org/
>> apache/solr/client/solrj/io/stream/eval/AppendEvaluatorTest.java>
>>>
>>>> On Jun 27, 2018, at 1:07 PM, Aroop Ganguly <ar...@icloud.com>
>> wrote:
>>>>
>>>> I think u can use the append evaluator
>>>> https://github.com/apache/lucene-solr/blob/master/solr/
>> solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java <
>> https://github.com/apache/lucene-solr/blob/master/solr/
>> solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java>
>>>>
>>>>
>>>>> On Jun 27, 2018, at 12:58 PM, Pratik Patel <pr...@semandex.net>
>> wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> Is there a function which can be used in Streaming Expressions to
>>>>> concatenate two strings? I want to use it just like add(1,2) in a
>> Streaming
>>>>> Expression. Essentially, I want to achieve something as follows.
>>>>>
>>>>> select(
>>>>> search(..),
>>>>> conceptid as foo,
>>>>> storeid as bar
>>>>> concat(foo,bar) as id
>>>>> )
>>>>>
>>>>> I can use merge() function but my streaming expression is quite
>> complex and
>>>>> that will make it even more complex as that would be a round about way
>> of
>>>>> doing it. Any idea how this can be achieved?
>>>>>
>>>>> Thanks,
>>>>> Pratik
>>>>
>>>
>>
>>
Re: String concatenation in Streaming Expressions
Posted by Pratik Patel <pr...@semandex.net>.
Thanks a lot for help!
Looks like this is a recent addition? It doesn't work for me in version
6.6.4
On Wed, Jun 27, 2018 at 4:18 PM, Aroop Ganguly <ar...@icloud.com>
wrote:
> So it will become:
> select(
> search(..),
> conceptid as foo,
> storeid as bar
> append(conceptid, storeid) as id
> )
>
> Or
> select
> select(
> search(..),
> conceptid as foo,
> storeid as bar
> ),
> foo,
> bar,
> append(foo,bar) as id
> )
>
> > On Jun 27, 2018, at 1:12 PM, Aroop Ganguly <ar...@icloud.com>
> wrote:
> >
> > this test case here will help in understanding the usage:
> > https://github.com/apache/lucene-solr/blob/branch_7_2/
> solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/
> AppendEvaluatorTest.java <https://github.com/apache/
> lucene-solr/blob/branch_7_2/solr/solrj/src/test/org/
> apache/solr/client/solrj/io/stream/eval/AppendEvaluatorTest.java>
> >
> >> On Jun 27, 2018, at 1:07 PM, Aroop Ganguly <ar...@icloud.com>
> wrote:
> >>
> >> I think u can use the append evaluator
> >> https://github.com/apache/lucene-solr/blob/master/solr/
> solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java <
> https://github.com/apache/lucene-solr/blob/master/solr/
> solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java>
> >>
> >>
> >>> On Jun 27, 2018, at 12:58 PM, Pratik Patel <pr...@semandex.net>
> wrote:
> >>>
> >>> Hello,
> >>>
> >>> Is there a function which can be used in Streaming Expressions to
> >>> concatenate two strings? I want to use it just like add(1,2) in a
> Streaming
> >>> Expression. Essentially, I want to achieve something as follows.
> >>>
> >>> select(
> >>> search(..),
> >>> conceptid as foo,
> >>> storeid as bar
> >>> concat(foo,bar) as id
> >>> )
> >>>
> >>> I can use merge() function but my streaming expression is quite
> complex and
> >>> that will make it even more complex as that would be a round about way
> of
> >>> doing it. Any idea how this can be achieved?
> >>>
> >>> Thanks,
> >>> Pratik
> >>
> >
>
>
Re: String concatenation in Streaming Expressions
Posted by Aroop Ganguly <ar...@icloud.com>.
So it will become:
select(
search(..),
conceptid as foo,
storeid as bar
append(conceptid, storeid) as id
)
Or
select
select(
search(..),
conceptid as foo,
storeid as bar
),
foo,
bar,
append(foo,bar) as id
)
> On Jun 27, 2018, at 1:12 PM, Aroop Ganguly <ar...@icloud.com> wrote:
>
> this test case here will help in understanding the usage:
> https://github.com/apache/lucene-solr/blob/branch_7_2/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AppendEvaluatorTest.java <https://github.com/apache/lucene-solr/blob/branch_7_2/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AppendEvaluatorTest.java>
>
>> On Jun 27, 2018, at 1:07 PM, Aroop Ganguly <ar...@icloud.com> wrote:
>>
>> I think u can use the append evaluator
>> https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java <https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java>
>>
>>
>>> On Jun 27, 2018, at 12:58 PM, Pratik Patel <pr...@semandex.net> wrote:
>>>
>>> Hello,
>>>
>>> Is there a function which can be used in Streaming Expressions to
>>> concatenate two strings? I want to use it just like add(1,2) in a Streaming
>>> Expression. Essentially, I want to achieve something as follows.
>>>
>>> select(
>>> search(..),
>>> conceptid as foo,
>>> storeid as bar
>>> concat(foo,bar) as id
>>> )
>>>
>>> I can use merge() function but my streaming expression is quite complex and
>>> that will make it even more complex as that would be a round about way of
>>> doing it. Any idea how this can be achieved?
>>>
>>> Thanks,
>>> Pratik
>>
>
Re: String concatenation in Streaming Expressions
Posted by Aroop Ganguly <ar...@icloud.com>.
this test case here will help in understanding the usage:
https://github.com/apache/lucene-solr/blob/branch_7_2/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AppendEvaluatorTest.java <https://github.com/apache/lucene-solr/blob/branch_7_2/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AppendEvaluatorTest.java>
> On Jun 27, 2018, at 1:07 PM, Aroop Ganguly <ar...@icloud.com> wrote:
>
> I think u can use the append evaluator
> https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java <https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java>
>
>
>> On Jun 27, 2018, at 12:58 PM, Pratik Patel <pr...@semandex.net> wrote:
>>
>> Hello,
>>
>> Is there a function which can be used in Streaming Expressions to
>> concatenate two strings? I want to use it just like add(1,2) in a Streaming
>> Expression. Essentially, I want to achieve something as follows.
>>
>> select(
>> search(..),
>> conceptid as foo,
>> storeid as bar
>> concat(foo,bar) as id
>> )
>>
>> I can use merge() function but my streaming expression is quite complex and
>> that will make it even more complex as that would be a round about way of
>> doing it. Any idea how this can be achieved?
>>
>> Thanks,
>> Pratik
>
Re: String concatenation in Streaming Expressions
Posted by Aroop Ganguly <ar...@icloud.com>.
I think u can use the append evaluator
https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java <https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AppendEvaluator.java>
> On Jun 27, 2018, at 12:58 PM, Pratik Patel <pr...@semandex.net> wrote:
>
> Hello,
>
> Is there a function which can be used in Streaming Expressions to
> concatenate two strings? I want to use it just like add(1,2) in a Streaming
> Expression. Essentially, I want to achieve something as follows.
>
> select(
> search(..),
> conceptid as foo,
> storeid as bar
> concat(foo,bar) as id
> )
>
> I can use merge() function but my streaming expression is quite complex and
> that will make it even more complex as that would be a round about way of
> doing it. Any idea how this can be achieved?
>
> Thanks,
> Pratik