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 Matt Magnusson <ma...@gmail.com> on 2017/03/22 20:12:22 UTC

Concatenating streams in streaming expressions

Hello;

Does anyone know of a way where I can concatenate source streams?

For example if I have two searches
search(prod,q="content:cat",fl="id,score",sort="score desc")
search(prod,q="content:dog",fl="id,score",sort="score desc")


Is there a way to have these come out as one stream. I've been trying
to use the executor function by storing these searches as expr_s.  I
however, can't figure out how to merge the output of these back into
one stream.  If I run the following code,

executor(search(queries, q="*:*",fl="id, expr_s", sort="id asc",
qt="/export")). It gives this output:

{
  "result-set": {
    "docs": [
      {
        "EOF": true,
        "RESPONSE_TIME": 32
      }
    ]
  }
}

So not the underlying tuples returned.

I want it the return to be like this for all individual searches
combined into one stream.

{
  "result-set": {
    "docs": [
      {
        "score": 12.340755,
        "id": "9a49d7d6f5b3cc597f8e55e66bb6d96438b670d1"
      },
      {
        "score": 11.879734,
        "id": "887d349fc9390a87ac7fd4209af59af61531ad06"
      },
      {
        "score": 11.82577,
        "id": "c91971049ab95cb32dc2d0f8d616aad25ee04bb7"
      },...




 I know the searches are working correctly using the executor function
because I can have them save output back to solr if I also include the
update and commit functions in the expr_s field in my source queries
collection.  Thanks

Matt

Re: Concatenating streams in streaming expressions

Posted by Joel Bernstein <jo...@gmail.com>.
There isn't a cat function yet. The closest function we have currently is a
merge function:

https://cwiki.apache.org/confluence/display/solr/Streaming+Expressions#StreamingExpressions-merge

But I've been meaning to add a cat function so feel free to create the jira.


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

On Wed, Mar 22, 2017 at 4:12 PM, Matt Magnusson <ma...@gmail.com>
wrote:

> Hello;
>
> Does anyone know of a way where I can concatenate source streams?
>
> For example if I have two searches
> search(prod,q="content:cat",fl="id,score",sort="score desc")
> search(prod,q="content:dog",fl="id,score",sort="score desc")
>
>
> Is there a way to have these come out as one stream. I've been trying
> to use the executor function by storing these searches as expr_s.  I
> however, can't figure out how to merge the output of these back into
> one stream.  If I run the following code,
>
> executor(search(queries, q="*:*",fl="id, expr_s", sort="id asc",
> qt="/export")). It gives this output:
>
> {
>   "result-set": {
>     "docs": [
>       {
>         "EOF": true,
>         "RESPONSE_TIME": 32
>       }
>     ]
>   }
> }
>
> So not the underlying tuples returned.
>
> I want it the return to be like this for all individual searches
> combined into one stream.
>
> {
>   "result-set": {
>     "docs": [
>       {
>         "score": 12.340755,
>         "id": "9a49d7d6f5b3cc597f8e55e66bb6d96438b670d1"
>       },
>       {
>         "score": 11.879734,
>         "id": "887d349fc9390a87ac7fd4209af59af61531ad06"
>       },
>       {
>         "score": 11.82577,
>         "id": "c91971049ab95cb32dc2d0f8d616aad25ee04bb7"
>       },...
>
>
>
>
>  I know the searches are working correctly using the executor function
> because I can have them save output back to solr if I also include the
> update and commit functions in the expr_s field in my source queries
> collection.  Thanks
>
> Matt
>