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.

Syntax<br />

A basic jdbc expression:<br />

jdbc(<br />

connection="jdbc:hsqldb:mem:.",<br />

sql="select NAME, ADDRESS, EMAIL, AGE from PEOPLE where AGE > 25 order by AGE, NAME<br />

DESC",<br />

sort="AGE asc, NAME desc",<br />

driver="org.hsqldb.jdbcDriver"<br />

)<br />

A jdbc expression that passes a property to the driver:<br />

// get_column_name is a property to pass to the hsqldb driver<br />

jdbc(<br />

connection="jdbc:hsqldb:mem:.",<br />

sql="select NAME as FIRST_NAME, ADDRESS, EMAIL, AGE from PEOPLE where AGE > 25<br />

order by AGE, NAME DESC",<br />

sort="AGE asc, NAME desc",<br />

driver="org.hsqldb.jdbcDriver",<br />

get_column_name="false"<br />

)<br />

facet<br />

The facet function provides aggregations that are rolled up over buckets. Under the covers the facet function<br />

pushes down the aggregation into the search engine using <strong>Solr</strong>'s JSON Facet API. This provides sub-second<br />

performance for many use cases. The facet function is appropriate for use with a low to moderate number of<br />

distinct values in the bucket fields. To support high cardinality aggregations see the rollup function.<br />

Parameters<br />

Syntax<br />

Example 1:<br />

collection: (Mandatory) Collection the facets will be aggregated from.<br />

q: (Mandatory) The query to build the aggregations from.<br />

buckets: (Mandatory) Comma separated list of fields to rollup over. The comma separated list represents<br />

the dimensions in a multi-dimensional rollup.<br />

bucketSorts: Comma separated list of sorts to apply to each dimension in the buckets parameters.<br />

Sorts can be on the computed metrics or on the bucket values.<br />

bucketSizeLimit: The number of buckets to include. This value is applied to each dimension.<br />

metrics: List of metrics to compute for the buckets. Currently supported metrics are sum(col) , avg(co<br />

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

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

410

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

Saved successfully!

Ooh no, something went wrong!