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.

This parser takes a query that matches child documents and returns their parents. The syntax for this parser is<br />

similar: q={!parent which=} . Again the parameter The parameter allPa<br />

rents is a filter that matches only parent documents; here you would define the field and value that you used<br />

to identify all parent documents. The parameter someChildren is a query that matches some or all of the<br />

child documents. Note that the query for someChildren should match only child documents or you may get an<br />

exception.<br />

Again using the example documents above, we can construct a query such as q={!parent<br />

which="content_type:parentDocument"}comments:<strong>Solr</strong>Cloud. We get this document in response:<br />

<br />

<br />

1<br />

<strong>Solr</strong> has block join support<br />

parentDocument<br />

<br />

<br />

Using which<br />

A common mistake is to try to filter parents with a<br />

which filter, as in this bad example:<br />

q={!parent which=" title:join "}comments:<strong>Solr</strong>Cloud<br />

Instead, you should use a sibling mandatory clause as a filter:<br />

q= +title:join +{!parent which=" content_type:parentDocument"}comments:Sol<br />

rCloud<br />

Scoring<br />

You can optionally use the score local parameter to return scores of the subordinate query. The values to use<br />

for this parameter define the type of aggregation, which are avg (average), max (maximum), min (minimum), to<br />

tal (sum). Implicit default is none which returns 0.0.<br />

Boost Query Parser<br />

BoostQParser extends the QParserPlugin and creates a boosted query from the input value. The main<br />

value is the query to be boosted. Parameter b is the function query to use as the boost. The query to be boosted<br />

may be of any type.<br />

Examples:<br />

Creates a query "foo" which is boosted (scores are multiplied) by the function query log(popularity) :<br />

{!boost b=log(popularity)}foo<br />

Creates a query "foo" which is boosted by the date boosting function referenced in ReciprocalFloatFunctio<br />

n:<br />

{!boost b=recip(ms(NOW,mydatefield),3.16e-11,1,1)}foo<br />

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

281

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

Saved successfully!

Ooh no, something went wrong!