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.

interface being developed allows an explicit resolution increase/decrease feature then subsequent requests can<br />

specify the gridLevel explicitly.<br />

The minX, maxX, minY, maxY reports the region where the counts are. This is the minimally enclosing bounding<br />

rectangle of the input geom at the target grid level. This may wrap the dateline. The columns and rows values<br />

are how many columns and rows that the output rectangle is to be divided by evenly. Note: Don't divide an<br />

on-screen projected map rectangle evenly to plot these rectangles/points since the cell data is in the coordinate<br />

space of decimal degrees if geo=true or whatever units were given if geo=false. This could be arranged to be<br />

the same as an on-screen map but won't necessarily be.<br />

The counts_ints2D key has a 2D array of integers. The initial outer level is in row order (top-down), then the<br />

inner arrays are the columns (left-right). If any array would be all zeros, a null is returned instead for efficiency<br />

reasons. The entire value is null if there is no matching spatial data.<br />

If format=png then the output key is counts_png. It's a base-64 encoded string of a 4-byte PNG. The PNG<br />

logically holds exactly the same data that the ints2D format does. Note that the alpha channel byte is flipped to<br />

make it easier to view the PNG for diagnostic purposes, since otherwise counts would have to exceed 2^24<br />

before it becomes non-opague. Thus counts greater than this value will become opaque.<br />

BBoxField<br />

The BBoxField field type indexes a single rectangle (bounding box) per document field and supports searching<br />

via a bounding box. It supports most spatial search predicates, it has enhanced relevancy modes based on the<br />

overlap or area between the search rectangle and the indexed rectangle. It's particularly useful for its relevancy<br />

modes. To configure it in the schema, use a configuration like this:<br />

<br />

<br />

<br />

BBoxField is actually based off of 4 instances of another field type referred to by numberType. It also uses a<br />

boolean to flag a dateline cross. Assuming you want to use the relevancy feature, docValues is required. Some<br />

of the attributes are in common with the RPT field like geo, units, worldBounds, and spatialContextFactory<br />

because they share some of the same spatial infrastructure.<br />

To index a box, add a field value to a bbox field that's a string in the WKT/CQL ENVELOPE syntax. Example: EN<br />

VELOPE(-10, 20, 15, 10) which is minX, maxX, maxY, minY order. The parameter ordering is unintuitive<br />

but that's what the spec calls for.<br />

To search, you can use the {!bbox} query parser, or the range syntax e.g. [10,-10 TO 15,20] , or the<br />

ENVELOPE syntax wrapped in parenthesis with a leading search predicate. The latter is the only way to choose<br />

a predicate other than Intersects. For example:<br />

&q={!field f=bbox}Contains(ENVELOPE(-10, 20, 15, 10))<br />

Now to sort the results by one of the relevancy modes, use it like this:<br />

&q={!field f=bbox score=overlapRatio}Intersects(ENVELOPE(-10, 20, 15, 10))<br />

The score local-param can be one of overlapRatio, area, and area2D. area scores by the document area<br />

using surface-of-a-sphere (assuming geo=true) math, area2D uses simple width * height. overlapRatio<br />

computes a [0-1] ranged score based on how much overlap exists relative to the document's area and the query<br />

area. The javadocs of BBoxOverlapRatioValueSource have more info on the formula, if you're really curious.<br />

There is an additional parameter queryTargetProportion that allows you to weight the query side of the formula<br />

to the index (target) side of the formula. You can also use &debug=results to see useful score computation<br />

info.<br />

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

377

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

Saved successfully!

Ooh no, something went wrong!