Record search queries

The endeca:matches() function allows a user to perform a keyword search against specific properties or dimension values assigned to records. (Record search queries are also called text search queries.)

The resulting records that have matching properties or dimension values are returned, along with any valid refinement dimension values. The search operation returns results that contain text matching all user search terms (that is, the search is conjunctive by default). To perform a less restrictive search, use the matchMode argument to specify a match mode other than MatchAll mode. Wildcard terms (using the * character) can be specified if the search interface or property is configured for wildcards in Developer Studio.

Note the following about record search queries:

The syntax for a record search query is:
collection()/record[endeca:matches(., "searchKey", "searchTerm", "matchMode", "languageId", autoPhrase)]
The meanings of the arguments are as follows:

Argument

Meaning

.

Required. The period is currently the only valid option. The period is the XPath context item, which is the node currently being considered (that is, the node to apply the function to). In effect, the context item is the record to search.

searchKey

Required. The name of an Endeca property or search interface which will be evaluated for the search. The name must be specified within a set of double quotes. Property names must use the NCName format and must be enabled for record search. Search interface names do not have to use the NCName format.

searchTerm

Required. The term to search for (which may contain multiple words or phrases). Specify the search term within a pair of double quotes. Phrase searches within searchTerm must be enclosed within two pairs of double quotes in addition to the pair enclosing the entire searchTerm entry. (This is because a pair of double quotes is the XPath escape sequence for a single double quote character within a string literal.)

For example, in "Melville ""Moby Dick"" hardcover", the phrase "Moby Dick" is enclosed in two pairs of double quotes: these yield a single escaped pair which indicates a phrase search for these words. In another example, """Tiny Tim""", the outermost pair of double quotes delimits the full searchTerm value, while the two inner pairs yield a single escaped pair to indicate a phrase search.
Note: To enable EQL parsing, use straight double-quote characters for double quotes (rather than typographer’s double quotes, which the EQL parser does not accept).

matchMode

Optional. A match mode (also called a search mode) that specifies how restrictive the match should be. The match mode must be specified within a set of double quotes.

The valid match modes are all (MatchAll mode; perform a conjunctive search by matching all user search terms; this is the default), partial (MatchPartial mode; match some of the search terms), any (MatchAny mode; results need match only a single search term), allpartial (MatchAllPartial mode; first use MatchAll mode and, if no results are returned, then use MatchPartial mode), allany (MatchAllAny mode; first use MatchAll mode and, if no results are returned, then use MatchAny mode), and partialmax (MatchPartialMax mode; first use MatchAll mode and, if no results are returned, then return results matching all but one term, and so on). For details on match modes, see the Basic Development Guide.
Note: MatchBoolean is not supported, because EQL has its own powerful set of query composition features such as the and, or, and not operators.

languageId

Optional. A per-query language ID, such as “fr” for French. The ID must be specified within a set of double quotes. For a list of valid language IDs, see the topic “Using language identifiers." The default language ID is the default for the MDEX Engine.

autoPhrase

Optional. A TrueFunction or FalseFunction that sets the option for automatic-phrasing query re-write. The default is false(), which disables automatic phrasing. Specifying true() enables automatic phrasing, which instructs the MDEX Engine to compute a phrasing alternative for a query and then rewrite the query using that phrase. For details on automatic phrasing (including adding phrases to the project with Developer Studio), see the topic “Using automatic phrasing."