11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Parameters<br />

Syntax<br />

StreamExpression (Mandatory)<br />

over: (Mandatory) A list of fields to group by.<br />

metrics: (Mandatory) The list of metrics to compute. Currently supported metrics are sum(col) , avg(c<br />

ol) , min(col) , max(col) , count(*) .<br />

rollup(<br />

search(<br />

collection1, q=*:*, fl="a_s,a_i,a_f", qt="/export", sort="a_s asc"),<br />

over="a_s",<br />

sum(a_i),<br />

sum(a_f),<br />

min(a_i),<br />

min(a_f),<br />

max(a_i),<br />

max(a_f),<br />

avg(a_i),<br />

avg(a_f),<br />

count(*)<br />

)<br />

The example about shows the rollup function wrapping the search function. Notice that search function is using<br />

the /export handler to provide the entire result set to the rollup stream. Also notice that the search function's s<br />

ort param matches up with the rollup's over parameter. This allows the rollup function to rollup the over the a_s<br />

field, one group at a time.<br />

select<br />

The select function wraps a streaming expression and outputs tuples containing a subset or modified set of<br />

fields from the incoming tuples. The list of fields included in the output tuple can contain aliases to effectively<br />

rename fields. One can provide a list of operations to perform on any fields, such as replace to replace the<br />

value of a field with some other value or the value of another field in the tuple.<br />

Parameters<br />

Syntax<br />

StreamExpression<br />

fieldName: name of field to include in the output tuple (can include multiple of<br />

these) outputTuple[fieldName] = inputTuple[fieldName]<br />

fieldName as aliasFieldName: aliased field name to include in the output tuple (can include multiple<br />

of these) outputTuple[aliasFieldName] = incomingTuple[fieldName]<br />

replace(fieldName, value, withValue=replacementValue): if incomingTuple[fieldName] ==<br />

value then outgoingTuple[fieldName] will be set to replacementValue. value can be the string "null" to<br />

replace a null value with some other value<br />

replace(fieldName, value, withField=otherFieldName): if incomingTuple[fieldName] ==<br />

value then outgoingTuple[fieldName] will be set to the value of incomingTuple[otherFieldName]. value can<br />

be the string "null" to replace a null value with some other value<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

423

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!