This topic contains examples of record search queries.
The first query example searches for the name
jane against the
editor_name
property of any record. Because they are not
specified, these defaults are used for the other arguments: MatchAll mode,
language ID is the MDEX Engine default, and automatic phrasing is disabled.
collection()/record [ endeca:matches(.,"editor_name","jane") ]
The next query example is identical to the first one, except that the
wildcard term
ja* is used for the search term. If the
editor_name
property is wildcard-enabled, this search
returns records in which the value of the property has a value that begins with
ja (such as “Jane” or “James”).
collection()/record [ endeca:matches(.,"editor_name","ja*") ]
The next query example searches for four individual terms against the
"description" property of any records. The
partialmax
argument specifies that the MatchPartialMax
match mode be used for the search. The language ID is English (as specified by
the "en" argument) and automatic phrasing is disabled (because the default
setting is used). Because the MatchPartialMax match mode is specified, MatchAll
results are returned if they exist. If no such results exist, then results
matching all but one terms are returned; otherwise, results matching all but
two terms are returned; and so forth.
collection()/record [ endeca:matches(.,"description", "sailor seafaring ship ocean","partialmax","en") ]
The next query example illustrates a phrase search. Any phrase term must be within a pair of double quotes, as in the example ""Tiny Tim"". This is because a pair of double quotes is the XPath escape sequence for a single double-quote character within a string literal. Thus, if the entire search term is a single phrase, there are three sets of quotes, as in the example.
collection()/record [ endeca:matches(.,"description","""Tiny Tim""") ]
In the final query example, the use of the
true()
function enables the automatic phrasing option.
This example assumes that phrases have been added to the project with Developer
Studio or Oracle Commerce Workbench. The example also illustrates the use of the
MatchAll match mode.
collection()/record [ endeca:matches(.,"description","story of","all","en",true()) ]