Ultipa's full-text filter can be considered as an extension of Ultipa filter, which uses an exclusive conditional operator contains
to judge whether the word-segmentation results of a full-text index contain all the specified keywords, in order to achieve Ultipa high speed full-text search. 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
Fuzzy search is always recommended unless user has a clear request of precise matching, however there is no reason why full-text search is needed under these circumstances.
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 *
.
Applications: Node/Edge Query
Example: Find products that contain keywords 'graph' and 'database' by the full-text index named 'prodDesc'
find().nodes({~prodDesc contains "graph database"}) return nodes
Example: Find products that contain keywords 'graph' or 'database' by the full-text index named 'prodDesc'
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'
find().nodes({~prodDesc contains "graph ult*"}) return nodes
Applications: 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'
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'
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.