Keyword Search
When you make a keyword (text) search, two clauses are used under the hood:
A
multi_matchover resource, service, location, and organization fields (listed below) with theANDoperator.A nested
multi_matchover taxonomy name/description fields (also withAND).
At least one of these clauses must match. Using AND inside each clause means every term you type must appear somewhere within the clause’s fields.
In other words, keywords either need to show up in all of the major fields, OR in the taxonomy name and description. This is pretty strict.
We used to use OR logic for these fields, instead of AND logic. Experienced showed that returned too many low quality results, so we tightened our tolerance quite a bit.
However, if a search returns 0 results, then we automatically perform a 2nd request using a more_like_this clause on the main text fields (excludes nested taxonomy name/description). This broadens matching to reduce zero-result cases.
If you submit a blank keyword search, we fall back to a match_all (return everything subject to filters).
Fields included in the first multi_match
name
description
summary
service.name
service.alternate_name
service.description
service.summary
location.name
location.alternate_name
location.description
location.summary
organization.name
organization.alternate_name
organization.description
organization.summary
Fields included in the second, nested multi_match
taxonomies.name
taxonomies.description
Taxonomy Search
Basic taxonomy searches use match_phrase_prefix on the taxonomies.code field so parent codes will match their child codes.
You can search multiple codes by comma separating them (OR logic) or by sending an array (also OR). For advanced logic you can send a JSON object with nested AND / OR (up to 5 levels). Advanced queries use exact code matching instead of prefix.
Examples:
// Multiple (OR)
query=NW-0000,NW-1000
// Advanced (AND within OR)
{
"OR": [
{ "AND": ["NW-0000", "NW-1000"] },
"NW-2000"
]
}
Filters
Geo Shape
If a user’s location is provided (lat/long), then a geo shape/service area filter is applied in all cases. This is to ensure that only records that actually service the user’s area are returned.
Geo Distance / Radius
When a user’s location is provided AND when the distance is set to anything above 0, then a secondary filter is applied that filters out all records that are not within the given distance in miles.
Virtual or location-less resources (no coordinates) are still included, even for very tight radii.
Facets
When facets are passed from the front-end, we further will filter down on records that include these facets.
Sorting
Priority
Resources are first sorted on priority to ensure priority resources apply at the top of the list.
Pinned
Not implemented yet. Currently this is the Priority sort. Once schema changes are done, then this change will be made.
Distance
When a user’s location is provided, records are sorted on distance to ensure the resources closest to the user appear first.
