Skip to main content

Overview

The Query process is designed to perform SQL-like custom queries on the Loqate GKR. It enables searching and retrieving multiple results of specific address components that meet user-definable conditions. The query-conditions are expressed in our proprietary query-language, an example using our Verify SaaS service and the syntax and semantics are described below.
{
  "Key": "{{LoqateKey}}",
  "Options": {
    "Process": "Query",
    "ServerOptions": {
      "Table": "rd_US_vfy",
      "QueryString": "(PostalCodePrimary LIKE \"60010%*\")",
      "OutputFields": "Locality",
      "QueryClause": "Distinct",
      "AliasPreference": "First",
      "RangefieldPreference": "Match",
      "MaxResults": 655
    }
  }
}
Query is a debug tool to be used to support submission of support cases, and please note this tool is in maintenance mode with no planned future developments or bug fixes.

Query Syntax and Semantics

A query has the following syntax:
...(<(>QUERY-EXPRESSION <LOGICAL-OPERATOR QUERY-EXPRESSION><)> <LOGICAL-OPERATOR QUERY-EXPRESSION<)>...
The terminology used in the query syntax is described below. Parenthesis may be used optionally to nest and string simple queries into compound queries:
TermSyntax/ValuesDescription
PREFIX TAG~Means phonetic similarity (optional)
SUFFIX TAG%, *% means auto-complete word, * means auto-complete phrase
QUERY-KEYWORD<PREFIX-TAG(s)>word<SUFFIX-TAG(s)>Tags apply at word level to qualify search criteria
CONDITION-OPERATORSLIKE, CONTAINSLIKE = Ordered-matching, CONTAINS = Unordered-matching
QUERY-EXPRESSIONFieldName CONDITION-OPERATOR "QUERY-KEYWORD(s)"Complete query expression
LOGICAL-OPERATORSTwo pipes, &&Two pipes = logical OR, && = logical AND, used to form compound queries

Example Queries

QueryMatchesDoes Not Match
Thoroughfare LIKE "Bayhill Dr"Bayhill DrDr Bayhill, Bayhill Drive
Thoroughfare CONTAINS "Bayhill Dr"Bayhill Dr, Dr BayhillBayhill Drive
Thoroughfare LIKE "~Payhill Dr"Bayhill DrBayhill Tr
Thoroughfare CONTAINS "Bay% Dr"Dr Bayhill, Bayhill Dr, Bay DrBay Drive, TromBay Dr
Thoroughfare LIKE "Bay Dr%"Bay Dr, Bay DriveBayhill Dr, Bay Drive Ct
Thoroughfare LIKE "Bay Dr%*"Bay Dr, Bay Dr Ct, Bay Drive, Bay Drive Ct
(Thoroughfare CONTAINS "Bay%") && (Locality LIKE "San Bruno")Bayhill Drive San Bruno, Bay Dr San Bruno, Bayhill Dr San Bruno

Process Options

The query tool uses the following process options:
OptionRequiredDescription
TableRequiredReference (GKR) table to be queried
QueryStringRequiredString expressing the query in the query language
OutputFieldsOptionalComma separated output field-names desired. Field-names are case sensitive. Reserved keyword ALL (or null) returns all field in output.
MaxResultsOptionalMax number of output records desired. Defaults to 10, valid values are 1-1000.
QueryClauseOptionalDISTINCT/UNIQUE/null specifies output address component-set to be distinct, unique, or unconstrained across the output record results, respectively.
AliasPreferenceOptionalSpecify to return, for non-rangefields: FIRST - the first alias in fields desired in the output; EXHAUSTIVE - all combinations of every alias; UNPROCESSED (null) - field-value entry as stored in the GKR
RangefieldPreferenceOptionalSpecify to return, for rangefields: MATCH - the queried value verified in the range; RANGE - the range containing the queried value after verification; FULL - every value in the range containing the queried value; RAW (null) - the range-field containing the queried value as stored in the table

Output

The results of the query are returned in the ProcessResult object.