Page tree
Skip to end of metadata
Go to start of metadata

The GeoBoost  field expression lets you give a scoring boost to documents with a latitude/longitude location near to a specific point. (See Geographic Searching for more information on AIE's geographical search features.)

The following examples give a scoring boost to locations near to latitude 37.5, longitude -119.9. Note that the "position" field (designated by the FieldNames.POSITION reference in the code below) is special. It is automatically added to a document during ingestion when AIE sees latitude and longitude fields. The "position" field is the basis of all geographical search and boost calculations.

Example:

QueryRequest request = new QueryRequest("*:*)");
request.setRelevancyModelNames("noop");
request.addScoreFunction(new GeoBoost(FieldNames.POSITION, 37.5, -119.9);
// ... (perform search)

REST Syntax:

GEOBOOST(FIELDEXPRESSION, LAT, LONG)

  • FIELDEXPRESSION - The stored field to operate on (usually the "position" field in this case).
  • LAT - Latitude of the reference location..
  • LONG - Longitude of the reference location.

Example:

&score.function=GEOBOOST(position, 37.5, -119.9)&relevancyModelName=noop&q=*:*

Note that in both examples, we've overridden the default query relevancy model with the noop model which performs no scoring. This is just to make the geolocation boost the sole scoring function, so that the query's result ordering reflects that function and nothing else.

  • No labels