Basics of using search indexes
DataStax Graph (DSG) leverages DSE Search indexes to efficiently filter vertices and edges by properties, reducing query latency. DSE Search uses a modified Apache Solr to create the search indexes. Graph search indexes can be created using textual, numeric and geospatial data.
Using search indexes requires DSE Search as well as DSG to be running on the nodes in a cluster. It is important to know that search indexing operates on a per-datacenter basis, so if DSE Search and DSG are running in different datacenters, the behavior of indexing may not match what is expected.
In general, if a query requires textual search or geospatial search, a search index must be used.
Search indexes are created for both full text and string searches by default, but properties can be designated with either option using asText
or asString
, respectively.
Textual search indexes are by default indexed in both tokenized (TextField) and non-tokenized (StrField) forms.
This means that all textual predicates (token, tokenPrefix, tokenRegex, eq, neq, regex, prefix) will be usable with all textual vertex or edge properties indexed.
Practically, search indexes should be created using the asString()
method only in cases where there is absolutely no use for tokenization and text analysis, such as for inventory categories (silverware, shoes, clothing).
The asText()
method is used if searching tokenized text, such as long multi-sentence descriptions.
The query optimizer will choose whether to use analyzed or non-analyzed indexing based on the textual predicate used.
Property key indexes defined with asText()
or undefined (since this is the default) can use the following options for search:
Property key indexes defined with asString()
can use the following options for search:
The |
In addition, property key indexes defined with asString()
can use the following Apache TinkerPop options for search: