You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Dennis Gove (JIRA)" <ji...@apache.org> on 2015/08/10 15:55:45 UTC

[jira] [Comment Edited] (SOLR-7669) Add SelectStream to Streaming API

    [ https://issues.apache.org/jira/browse/SOLR-7669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14661163#comment-14661163 ] 

Dennis Gove edited comment on SOLR-7669 at 8/10/15 1:55 PM:
------------------------------------------------------------

Updated to add support for performing operations on the selected values. The only operation included in this patch is Replace which can be used to replace field values (or nulll) with a different value or the value of another field.

In the following example, if fieldA is null then it will be replaced with value 123 and if fieldB is "foo" then it will be set to "bar".
{code}
select(
  id, 
  fieldA_i as fieldA, 
  fieldB_s as fieldB,
  replace(fieldA, null, withValue=123),
  replace(fieldB, foo, withValue=bar),
  search(collection1, q="*:*", fl="id,fieldA_i,fieldB_s", sort="fieldA_i asc, fieldB_s asc, id asc")
)
{code}

In the following example, if fieldA is null or "???" then it will be replaced with the value of fieldB.
{code}
select(
  id, 
  fieldA_s as fieldA, 
  fieldB_s as fieldB,
  replace(fieldA, null, withField=fieldB),
  replace(fieldA, "???", withField=fieldB)
  search(collection1, q="*:*", fl="id,fieldA_i,fieldB_s", sort="fieldA_i asc, fieldB_s asc, id asc")
)
{code}


was (Author: dpgove):
Updated to add support for performing operations on the selected values. The only operation included in this patch is Replace which can be used to replace field values (or nulll) with a different value or the value of another field.

In the following example, if fieldA is null then it will be replaced with value 123 and if fieldB is "foo" then it will be set to "bar".
{code}
select(
  id, 
  fieldA_i as fieldA, 
  fieldB_s as fieldB,
  replace(fieldA, null, 123),
  replace(fieldB, foo, withValue=bar),
  search(collection1, q="*:*", fl="id,fieldA_i,fieldB_s", sort="fieldA_i asc, fieldB_s asc, id asc")
)
{code}

In the following example, if fieldA is null or "???" then it will be replaced with the value of fieldB.
{code}
select(
  id, 
  fieldA_s as fieldA, 
  fieldB_s as fieldB,
  replace(fieldA, null, withField=fieldB),
  replace(fieldA, "???", withField=fieldB)
  search(collection1, q="*:*", fl="id,fieldA_i,fieldB_s", sort="fieldA_i asc, fieldB_s asc, id asc")
)
{code}

> Add SelectStream to Streaming API
> ---------------------------------
>
>                 Key: SOLR-7669
>                 URL: https://issues.apache.org/jira/browse/SOLR-7669
>             Project: Solr
>          Issue Type: Improvement
>          Components: SolrJ
>            Reporter: Dennis Gove
>            Priority: Minor
>              Labels: Streaming
>         Attachments: SOLR-7669.patch, SOLR-7669.patch
>
>
> Adds a new stream called SelectStream which can be used for two purpose.
>  1. Limit the set of fields included in an outgoing tuple to remove unwanted fields
>  2. Provide aliases for fields. With this it acts as an alternative to the CloudSolrStream's 'aliases' option.
>  For example, in a simple case
> {code}
> select(
>   id, 
>   fieldA_i as fieldA, 
>   fieldB_s as fieldB,
>   search(collection1, q="*:*", fl="id,fieldA_i,fieldB_s", sort="fieldA_i asc, fieldB_s asc, id asc")
> )
> {code}
> This can also be used as part of complex expressions to help keep track of what is being worked on. This is particularly useful when merging/joining multiple collections which share field names. For example, the following results in a set of tuples including only the fields id, left.ident, and right.ident even though the total set of fields required to perform the search and join is much larger than just those three fields.
> {code}
> select(
>   id, left.ident, right.ident,
>   innerJoin(
>     select(
>       id, join1_i as left.join1, join2_s as left.join2, ident_s as left.ident,
>       search(collection1, q="side_s:left", fl="id,join1_i,join2_s,ident_s", sort="join1_i asc, join2_s asc, id asc")
>     ),
>     select(
>       join3_i as right.join1, join2_s as right.join2, ident_s as right.ident,
>       search(collection1, q="side_s:right", fl="join3_i,join2_s,ident_s", sort="join3_i asc, join2_s asc"),
>     ),
>     on="left.join1=right.join1, left.join2=right.join2"
>   )
> )
> {code}
> This depends on SOLR-7584.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org