UltipaDocs
Try Playground
  • Introduction
  • Terminologies
    • Reserved Words
    • Data Types
    • Alias
    • Operators
    • Expression
    • Filter
    • Prefix
    • Node and Edge Templates
    • Homologous and Heterologous Data
    • Clause Execution Times
    • Graphset
    • Schema
    • Property
    • Insert
    • Overwrite
    • Upsert
    • Update
    • Delete
    • Find Nodes
    • Find Edges
      • AB
      • Autonet
      • Spread
      • Path Template
      • K-Hop
      • K-Hop Template
    • Find Subgraphs
    • GROUP BY
    • ORDER BY
    • SKIP
    • LIMIT
    • WHERE
    • RETURN
    • WITH
    • UNCOLLECT
    • UNION
    • UNION ALL
    • CALL
    • BATCH
      • Schema Checker
      • Equal
      • Not Equal
      • Less Than
      • Greater Than
      • Less Than or Equal
      • Greater Than or Equal
      • Between
      • Between or Equal
      • Beong to
      • Not Belong To
      • CONTAINS | String
      • CONTAINS | Full-Text
      • Regular Match
      • IS NULL
      • IS NOT NULL
      • And
      • Or
      • Not
      • Exclusive OR
      • DISTINCT
      • toString()
      • toInteger()
      • toFloat()
      • toDouble()
      • toDecimal()
      • toSet()
      • castToRaw()
      • now()
      • dateAdd()
      • dateDiff()
      • year()
      • month()
      • day()
      • dayOfWeek()
      • dateFormat()
      • point()
      • distance()
      • pointInPolygon()
      • lower()
      • upper()
      • reverse()
      • startsWith()
      • endsWith()
      • JSON_decode()
      • JSON_merge()
      • trim()
      • ltrim()
      • rtrim()
      • left()
      • right()
      • substring()
      • replace()
      • split()
      • intersection()
      • difference()
      • listUnion()
      • size()
      • head()
      • reduce()
      • listContains()
      • append()
      • pi()
      • pow()
      • sqrt()
      • abs()
      • floor()
      • ceil()
      • round()
      • sin()
      • cos()
      • tan()
      • cot()
      • asin()
      • acos()
      • atan()
      • length()
      • pnodes()
      • pedges()
      • count()
      • sum()
      • max()
      • min()
      • avg()
      • stddev()
      • collect()
      • dedup()
      • CASE
      • table()
      • coalesce()
      • ifnull()
    • Acceleration
    • Index
    • Full-text
    • LTE
    • Real-time Process
    • Backend Task
    • Analytics Node
    • Server Statistics
    • Server Backup
    • Privilege
    • Policy
    • User
  • Trigger
  1. Docs
  2. /
  3. UQL
  4. /
  5. Index | Full-text | LTE

Full-text

Naming Conventions

Full-text index is named by developers. A same name cannot be shared between full-text indexes within a graphset.

  • 2 ~ 64 characters
  • Must start with letters
  • Allow to use letters, underscore and numbers ( _ , A-Z, a-z, 0-9)

Show Full-text

Returned table name: _nodeFulltext, _edgeFulltext
Returned table header: name | properties | schema | status (Name, properties, schema and status [creating|done] of full-text)

Syntax:

Syntax
// To show all full-text indexes in the current graphset (node full-texts and edge full-texts in separate tables)
show().fulltext()

// To show all full-text node indexes in the current graphset
show().node_fulltext()

// To show all full-text edge indexes in the current graphset
show().edge_fulltext()

Create Full-text

Properties of decimal type do not support full-text index.

Syntax:

Syntax
// To create full-text index for a certain property of a certain node schema in the current graphset
create().node_fulltext(@<schema>.<property>,"<name>")

// To create full-text index for a certain property of a certain edge schema in the current graphset
create().edge_fulltext(@<schema>.<property>,"<name>")

Example: Create full-text index named "prodDesc" for @product property description

UQL
create().node_fulltext(@product.description, "prodDesc")

Drop Full-text

Deleting a property will also delete its full-text index.

Syntax:

Syntax
// To delete full-text index for a certain node property from the current graphset
drop().node_fulltext("<name>")

// To delete full-text index for a certain edge property from the current graphset
drop().edge_fulltext("<name>")

Example: Delete the full-text index named 'prodDesc'

UQL
drop.().node_fulltext("prodDesc")

Full-text Filter

Ultipa's full-text filter achieves high speed full-text search, it is an important implementation scenario of Ultipa filter. It uses conditional operator contains to judge whether a full-text index contains ALL the specified keywords. There are two criteria for judging 'contains':

  • Precise search
    • the segmented words totally equal to the keywords
    • when the library of segmented words does not contain the keywords that are being searched, it might lead to no result
  • Fuzzy search
    • the segmented words begin with a keyword
    • maximize the possibility to find the nodes and edges (their properties) that contain the keywords that are being searched, but cost much time than precise search
NOTE

Fuzzy search is always recommended unless user has a clear request of precise matching.

Syntax: {~<fulltext> contains "<keyword1> <keyword2> ..."}

where space is used to separate multiple <keyword>, and should use backslash \ as the prefix if has English double quotation marks in a <keyword>; <keyword> used for fuzzy matching should end with asterisk *.

Node/Edge Query

Example: Find products that contain keywords 'graph' and 'database' by the full-text index named 'prodDesc'

UQL
find().nodes({~prodDesc contains "graph database"}) return nodes

Example: Find products that contain keywords 'graph' or 'database' by the full-text index named 'prodDesc'

UQL
find().nodes({~prodDesc contains "graph" || ~prodDesc contains "database"}) return nodes

Example: Find products that contain 'graph', and words start with 'ult' by the full-text index named 'prodDesc'

UQL
find().nodes({~prodDesc contains "graph ult*"}) return nodes

Template Query

Example: Fuzzy search for 10 paths that start from accounts which have segmented word 'capital*', firstly arrive accounts which have segmented word 'investment*', then arrive accounts which have segmented word 'AI*', use full-text index 'companyName'

UQL
n({~companyName contains "capital*"}).e().n({~companyName contains "investment*"})
  .e().n({~companyName contains "AI*"}) as paths
return paths{*} limit 10

Example: Fuzzy search for 10 paths from 'Sequoia*' accounts to 'Hillhouse*' accounts within 5 steps, use full-text index 'companyName'

UQL
n({~companyName contains "Sequoia*"}).e()[:5].n({~companyName contains "Hillhouse*"}) as paths
return paths{*} limit 10

Note: Given a GP/LP or business knowledge graph network, the query rules above are equivalent to a deep Ad hoc network of 'Sequoia' and 'Hillhouse' companies. The same operation requires massive manual interventions or batch executions in whether a manual or three-check system. Before Ultipa invented the template-based full-text search, a query like this is unthinkable! Now, this can be done with ease, elegance and in real time.