Search index: Google Spanner Graph Search
Google Spanner Graph Search is the built-in integration providing full-text search for Google Spanner Graph.
It leverages the full-text search capabilities provided by Google Spanner Graph.
Usage
Search is only supported on nodes, and on properties that correspond to a STRING column.
Query optimizer requirements
Full-text search in Google Spanner graph requires the query optimizer in version 6 or above,
because ranked search uses SCORE. To check your currently configured optimizer version, run this query:
SELECT option_name, option_value
FROM information_schema.database_options
WHERE schema_name = '' AND option_name = 'optimizer_version';
To list the supported optimizer versions, run this query:
SELECT * FROM SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS;
If the configured version is below 6, update it to a supported version (6 or above, in the following example, version 9 is used):
ALTER DATABASE MyDatabase
SET OPTIONS (optimizer_version = 9);
Making properties searchable
In Google Spanner, for each SQL table that corresponds to a searchable node label:
Create a
TOKENLISTcolumn for each searchable column, using theTOKENIZE_FULLTEXTfunction. Here is an example of how to create a tokenized property:CREATE TABLE Album ( id STRING(MAX) NOT NULL, title STRING(MAX), title_tokens TOKENLIST AS (TOKENIZE_FULLTEXT(title)) HIDDEN ) PRIMARY KEY(id);Create a single
SEARCH INDEXfor the table, containing all theTOKENLISTcolumns. Here is an example of how to create a search index:CREATE SEARCH INDEX AlbumIndex ON Album(title_tokens);And this is it. Linkurious Enterprise will automatically find the created search indexes, there is no need for additional configuration.