UltipaDocs
Products
Solutions
Resources
Company
Start Free Trial
UltipaDocs
Start Free Trial
  • Introduction
  • GQL vs Other Languages
    • Overview
    • Node and Edge Patterns
    • Path Patterns
    • Quantified Paths
    • Questioned Paths
    • Shortest Paths
    • Graph Patterns
    • Overview
    • Open Graph
    • Closed Graph
    • Constraints
    • Unique Identifiers
    • INSERT
    • INSERT OVERWRITE
    • SET
    • REMOVE
    • DELETE
    • Query Composition
    • Result Table and Visualization
    • MATCH
    • OPTIONAL MATCH
    • FILTER
    • LET
    • FOR
    • ORDER BY
    • LIMIT
    • SKIP
    • CALL
    • RETURN
    • Composite Query
    • NEXT
    • All Functions
    • Element Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Null Functions
    • Utility Functions
    • Type Conversion Functions
    • Table Functions
    • AI & Vector Functions
    • Database Functions
  • Operators
  • Predicates
    • CASE
    • LET Value Expression
    • Value Query Expression
    • List Comprehension
    • Index
    • Full-text Index
    • Vector Index
  • Transactions
  • Triggers
  • Query Management
  • Backup and Restore
    • Variables
    • Values and Types
    • Comments
    • Reserved Words
    • Syntactic Notation
  • GQL Conformance
  1. Docs
  2. /
  3. ISO GQL
  4. /
  5. Query Acceleration

Full-text Index

Overview

A full-text index is a type of index specialized for efficient searching for string or text properties, especially in large text fields like descriptions, comments, or articles.

Full-text indexes work by breaking down the text into smaller segments called tokens. When a query is performed, the search engine matches specified keywords against these tokens instead of the original full text, allowing for faster retrieval of relevant results. Full-text indexes support both precise and fuzzy matches.

Showing Full-text Index

To retrieve all full-text indexes in the current graph:

GQL
SHOW FULLTEXT

To retrieve only node or edge full-text indexes:

GQL
SHOW NODE FULLTEXT
GQL
SHOW EDGE FULLTEXT

The result includes the following fields:

Field
Description
index_nameFull-text index name.
entity_typeNODE or EDGE.
schema_nameThe label of the full-text index.
propertiesThe indexed properties.
analyzerThe text analyzer used.
statusIndex status: ready, loading, or building.
doc_countNumber of documents indexed.
progressBuild/loading progress.

Creating Full-text Index

You can create a full-text index using the CREATE FULLTEXT statement. The index is built asynchronously, use SHOW FULLTEXT to check build progress.

Syntax
<create full-text index statement> ::=
  "CREATE FULLTEXT" <index name> "ON" < "NODE" | "EDGE" > <label>
  "(" <property name> [ { "," <property name> }... ] ")"

Details

  • The <index name> must be unique among nodes and among edges, but a node full-text index and an edge full-text index may share the same name.

To create a full-text index named prodDesc for the description property of product nodes:

GQL
CREATE FULLTEXT prodDesc ON NODE product (description)

To create a full-text index named reviewText for the content and excerpt properties of review edges:

GQL
CREATE FULLTEXT reviewText ON EDGE review (content, excerpt)

Dropping Full-text Index

Dropping a full-text index does not affect the actual property values.

GQL
DROP NODE FULLTEXT prodDesc
GQL
DROP EDGE FULLTEXT reviewText

Use IF EXISTS to avoid errors when the index doesn't exist:

GQL
DROP NODE FULLTEXT IF EXISTS prodDesc

Using Full-text Index

To use a full-text index in search conditions, use the syntax ~<fulltextIndexName> CONTAINS "<keywords>":

  • The ~ symbol marks the full-text index.
  • The operator CONTAINS checks if the segmented tokens in the full-text index match the query.
  • Results are ranked by BM25 relevance score (highest relevance first).
  • If a double quotation mark appears in a keyword, prefix it with a backslash (\) to escape.

Query Syntax

By default, multiple keywords separated by spaces are combined with AND (all must match). Additional operators are supported within the <keywords> string:

OperatorSyntaxDescription
AND (default)"graph database"Entries whose tokens include both graph and database.
OR"graph OR database"Entries whose tokens include graph or database (or both).
NOT"-graph"Entries whose tokens do not include graph.
Phrase"\"graph database\""Entries whose tokens include graph followed immediately by database.
Proximity"\"graph database\"~5"Entries whose tokens include both graph and database within 5 token positions of each other.
Wildcard"graph*"Entries whose tokens start with graph (e.g., graph, graphics, graphdb).
Wildcard"grap?"Entries whose tokens match with ? as any single character (e.g., graph, grape).
Grouped"(graph OR network) AND database"Entries matching the combined sub-expressions; parentheses control precedence.

Retrieving Nodes or Edges

To find nodes using the full-text index prodDesc where their tokens include graph and database:

GQL
MATCH (n WHERE ~prodDesc CONTAINS "graph database")
RETURN n

To find nodes using the full-text index prodDesc where their tokens include graph or database:

GQL
MATCH (n WHERE ~prodDesc CONTAINS "graph OR database")
RETURN n

To find edges using the full-text index reviewText where their tokens include graph and those start with ult:

GQL
MATCH ()-[e WHERE ~reviewText CONTAINS "graph ult*"]-()
RETURN e

Retrieving Paths

Note: Full-text indexes only apply to the first node in a path pattern when retrieving paths.

For example, this query is not supported:

GQL - Not supported
MATCH p = ()-[]-(WHERE ~prodDesc CONTAINS "graph")
RETURN p

You may revise the query as follows:

GQL
MATCH (n WHERE ~prodDesc CONTAINS "graph")
MATCH p = ()-[]-(n)
RETURN p

This query is not supported either:

GQL - Not supported
MATCH p = ()-[WHERE ~reviewText CONTAINS "ult*"]-()
RETURN p

You may revise the query as follows:

GQL
MATCH ()-[e WHERE ~reviewText CONTAINS "ult*"]-()
MATCH p = ()-[e]-()
RETURN p