Record search (also called text search) allows a user to perform a
keyword search against specific attribute values assigned to records.
The
resulting records that have matching attribute values are returned, along with
any valid refinement values.
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.
Controlling record search
The following statements describe various aspects of
record search behavior and how you can control it:
- Record search works
against named collections, as described in
Specifying a collection for record search.
- Although search interfaces
are not mandatory for record searches, you can create a search interface if you
want to specify one or more standard attributes to search. For information on
search interfaces, see
Working with Search Interfaces.
- 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.
- You can use the data
domain
--search-max configuration flag to specify the
maximum number of terms for record search for the data domain profile. The
default is 10.
- You can use the data
domain
--search-char-limit configuration flag to specify
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.
Supported languages for record search
For the list of supported languages for record search, see
Supported languages.
You can specify the language ID in the
Language attribute of the
TextSearchFilter type, as in this example:
<TextSearchFilter Key="PROD_CATEGORY" RelevanceRankingStrategy="numfields"
Mode="AllPartial" EnableSnippeting="false" Language="en">
hardware
</TextSearchFilter>
This example uses
en (American English) as the language for the record
search query.
Example of record search
For example, consider the following records:
| Rec ID
|
Managed attribute values for the managed
attribute BikeType:
|
Values for the attribute "Name":
|
Values for the 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)
Note: In addition to basic record search, other features affect the
behavior of record search, such as spelling support, relevance ranking of
results, wildcard syntax, multiple attribute record searches, and attribute
group record searches. These are discussed in detail in their respective
sections.