About
Record search (also called text search) search records that contains a particular keyword.
The resulting results are records :
- which contain (keyword|Search terms) in any combination of attributes.
- that have matching attribute values are returned, along with any valid refinement values.
In addition to basic record search, other features affect the behaviour of record search, such as:
- spelling support,
- relevance ranking of results,
- wildcard syntax,
- multiple attribute record searches,
- and attribute group record searches.
Record search queries in a Studio application are made from the Search Box component and the entire Studio application is re-summarized based on matching search results.
Because record search returns a navigation page, it is important to remember that the record search parameter acts as a record filter in the same way that an attribute value does, even though it is not a specific value.
Articles Related
Example
Studio
Example of Record Search
Global view of search capabilities
Example 2
Rec ID | Managed attribute BikeType: | Standard attribute “Name”: | Standard attribute “Description”: |
---|---|---|---|
1 | Road Bikes | Road-450 | can do double-duty for racing or long-range mileage… |
2 | Road Bikes | Road-550-W | its speed comes at the sake of comfort… |
3 | Touring Bikes | Touring-1000 | combines comfort and performance… |
4 | Mountain Bikes | Mountain-500 | this mountain bike has serious racing performance… |
When the user performs a record search on the Description attribute using the keyword comfort, the following objects are returned:
- 2 records (records 2 and 3)
- 2 refinement attribute values (Road Bikes and Touring Bikes)
When performing a record search on the Description attribute using the keyword racing, these objects are returned:
- 2 records (records 1 and 4)
- 2 refinement attribute values (Road Bikes and Mountain Bikes)
Configuration
Enable Attribute to be searched
There are no Dgraph configuration flags necessary to enable record searching. If an attribute was properly enabled for record searching, it will automatically be available for record searching.
To enable or disable, record searching for a standard attribute, set the property mdex-property_IsTextSearchable to:
- true to enable
- false to disable (default)
Create Search Interface
Global
The data domain configuration flag:
- –search-max specifies the maximum number of terms for record search for the data domain profile. The default is 10.
- –search-char-limit specifies the maximum length (in characters) of a search term for record search. The default is 132 characters. Any term exceeding this length will not be indexed for any form of record search, and thus that term will not be found.
Wildcard
Management
Although search interfaces are not mandatory for record searches, you have to create a search interface if you want to specify one or more standard attributes to search.
You issue record search queries using the Conversation Web Service API.
List
The AvailableSearchKeysConfig type identifies the items that are searchable (ie a searchable attribute,property, interfaces)
<ns:AvailableSearchKeysConfig Id="?">
<!--Optional:-->
<ns:StateName>?</ns:StateName>
</ns:AvailableSearchKeysConfig>
Result:
<cs:AvailableSearchKeys>
<cs:AvailableSearchKey Interface="true">
<cs:Key>AllFields</cs:Key>
<cs:DisplayName>AllFields</cs:DisplayName>
</cs:AvailableSearchKey>
<cs:AvailableSearchKey Interface="false">
<cs:Key>Column1</cs:Key>
<cs:DisplayName>Column1</cs:DisplayName>
</cs:AvailableSearchKey>
<cs:AvailableSearchKey Interface="false">
<cs:Key>Column1</cs:Key>
<cs:DisplayName>Column2</cs:DisplayName>
</cs:AvailableSearchKey>
<cs:AvailableSearchKey Interface="false">
<cs:Key>mdex-collection_Key</cs:Key>
<cs:DisplayName>Collection Key</cs:DisplayName>
</cs:AvailableSearchKey>
</cs:AvailableSearchKeys>
where:
- The Interface attribute distinguishes whether the search key is:
Record search filter
TextSearchFilter type
A basic record search requires a TextSearchFilter type. The syntax for a search request is shown in this example:
<TextSearchFilter
Key="Prod_Category"
EnableSnippeting="true"
SnippetLength="5"
Mode="AllPartial"
RelevanceRankingStrategy="numfields"
Language="en">
SearchTerm
</TextSearchFilter>
<!-- Key and Search Term are Required -->
where:
- key is and attribute value that specifies which standard or managed attribute will be evaluated when searching.
- EnableSnippeting true or false
- SnippetLength Specifies the length of the snippet.
- mode specifies a match mode (defaults to All)
- RelevanceRankingStrategy Specifies a relevance ranking strategy.
- Language specifies a language code for the search
- SearchTerm Specifies one or more terms to search for. (Max 132 chr)
Request Filter
Record search works against named collections
<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>