A basic record search requires a TextSearchFilter type.
<TextSearchFilter Key="Prod_Category" RelevanceRankingStrategy="numfields" Mode="AllPartial" EnableSnippeting="true" SnippetLength="5" Language="en"> electronics </TextSearchFilter>
The text content of the TextSearchFilter type contains the search term(s). In the example, a record search is being made for the "electronics" keyword in the Prod_Category standard attribute.
Search attribute | Description |
---|---|
Key | Required. Specifies which standard or managed attribute will be evaluated when searching. You specify an attribute as a value for this parameter. You can also specify a search interface as a value. |
EnableSnippeting | Optional. If set to true, enables snippeting. If set to false, disables snippeting. For details on snippeting, see Using Snippeting in Record Searches. |
SnippetLength | Optional. Specifies the length of the snippet. |
Mode | Optional. Specifies a match mode, which are described in List of valid search modes. If not specified, defaults to All. Note that the Boolean match mode cannot be used. |
RelevanceRankingStrategy | Optional. Specifies a relevance ranking strategy. For details on relevance ranking, see Relevance Ranking. |
Language | Optional. Specifies a language code for the search. Valid language codes are listed in the topic Supported languages. |
searchTerm | Required. Specifies one or more terms to search for. The maximum number of characters in each search term is set by the --search-char-limit configuration flag (in the Endeca command put-dd-profile), which defaults to 132 characters. |
You can run a record search query against the records in a specific collection. To do so, specify the collection name in the <CollectionName> element of the State type.
<Request> <State> <Name>MySalesSearch</Name> <CollectionName>Sales</CollectionName> <TextSearchFilter Key="Prod_Category" RelevanceRankingStrategy="numfields" Mode="AllPartial" EnableSnippeting="true" SnippetLength="5" Language="en"> electronics </TextSearchFilter> </State> <RecordListConfig Id="SalesList" MaxPages="20"> <StateName>MySalesSearch</StateName> <Column>SalesAmount</Column> <RecordsPerPage>5</RecordsPerPage> </RecordListConfig> </Request>
In the example, the name of the State is MySalesSearch and it specifies the Sales collection. In turn, the RecordListConfig type uses the StateName element to associate the MySalesSearch state to the config.