Yeah, this is an error in the docs which needs to be corrected as this is a
common use case. The val function is the one to use. I will make the change
in the docs.



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


On Fri, Feb 26, 2021 at 12:28 PM ufuk yılmaz <uyil...@vivaldi.net.invalid>
wrote:

> I tried to debug this to the best of my ability, and it seems the correct
> name for the “raw” evaluator is “val”.
>
>
>
> Copied from StreamContext: val=class
> org.apache.solr.client.solrj.io.eval.RawValueEvaluator
>
>
>
> I think there’s a small error in stream evaluator documentation of 8.4
>
>
>
> https://lucene.apache.org/solr/guide/8_4/stream-evaluator-reference.html
>
>
>
> When I used “val” instead of “raw”, I got the expected response:
>
>
>
> select(
>
>                                 search(
>
>                                                 myCollection,
>
>                                                 q="*:*",
>
>                                                 qt="/export",
>
>                                                 sort="id_str asc",
>
>                                                 fl="id_str"
>
>                                 ),
>
>                                 id_str,
>
>                                 val(abc) as text
>
>                 )
>
>
>
> {
>
>   "result-set": {
>
>     "docs": [
>
>       {
>
>         "id_str": "deneme123",
>
>         "text": "abc"
>
>       },
>
>       {
>
>         "EOF": true,
>
>         "RESPONSE_TIME": 70
>
>       }
>
>     ]
>
>   }
>
> }
>
>
>
> --ufuk yilmaz
>
>
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> *From: *ufuk yılmaz <uyil...@vivaldi.net.INVALID>
> *Sent: *26 February 2021 16:38
> *To: *solr-u...@lucene.apache.org
> *Subject: *Select streaming expression, add a field to every tuple,
> replaceor raw not working
>
>
>
> Hello all,
>
>
>
> Solr version 8.4
>
>
>
> I have a very simple select expression here. What I’m trying to do is to
> add a constant value to incoming tuples.
>
>
>
> My collection has only 1 document. Id_str is of type String. Other fields
> are Solr generated.
>
>
>
> {
>
>         "_version_":1692761378187640832,
>
>         "id_str":"experiment123",
>
>         "id":"18d658b13b6b072f"}]
>
>   }
>
>
>
> My streaming expression:
>
>
>
> select(
>
>                                 search(
>
>                                                 myCollection,
>
>                                                 q="*:*",
>
>                                                 qt="/export",
>
>                                                 sort="id_str asc",
>
>                                                 fl="id_str"
>
>                                 ),
>
>                                 id_str,
>
>                                 raw(ttt) as text // Docs state that select
> works with any evaluator. “raw” here is a stream evaluator.
>
>                 )
>
>
>
> I also tried:
>
>
>
> select(
>
>                                 search(
>
>                                                 myCollection,
>
>                                                 q="*:*",
>
>                                                 qt="/export",
>
>                                                 sort="id_str asc",
>
>                                                 fl="id_str"
>
>                                 ),
>
>                                 id_str,
>
>                                 replace(text, null, withValue=raw(ttt)) as
> text //replace is described in select expression documentation. I also
> tried withValue=ttt directly
>
>                 )
>
>
>
> No matter what I do, response only includes id_str field, without any
> error:
>
>
>
> {
>
>   "result-set":{
>
>     "docs":[{
>
>         "id_str":" experiment123"}
>
>       ,{
>
>         "EOF":true,
>
>         "RESPONSE_TIME":45}]}}
>
>
>
> I also tried wrapping text value with quotes, that didn’t work too.
>
>
>
> What am I doing wrong?
>
>
>
> --ufuk yilmaz
>
>
>
> Sent from Mail for Windows 10
>
>
>
>
>

Reply via email to