Article DetailsDetailsHelp DetailsFulltext search in Neo4j is supported by means of fulltext schema indexes. Fulltext schema indexes are created, dropped, and updated transactionally, and are automatically replicated throughout a cluster. Below are two examples to better understand the usage of a Fulltext index using multiple node properties and multiple nodes. Fulltext Index using multiple node properties: Let's create a sample dataset to understand how Full text index can be applied: CREATE (:Movie { title: "the great comedy show", tagline: "a laugh riot from start to end", released: 2020, genre: "comedy" }); CREATE(:Movie { title: "comedy nights forever", tagline: "life is fun when you laugh together", released: 2018, genre: "comedy" }); CREATE(:Movie { title: "love in paris", tagline: "a romantic comedy set in the city of love", released: 2019, genre: "romantic comedy" }); CREATE (:Movie { title: "space adventures", tagline: "a sci-fi comedy that’s out of this world", released: 2021, genre: "sci-fi comedy" }); CREATE(:Movie { title: "mystery lane", tagline: "a detective’s journey with a touch of comedy", released: 2022, genre: "mystery comedy" }); CREATE (:Book { name: "the art of comedy writing", author: "john parker", published: 2015, genre: "humor" }); CREATE(:Book { name: "modern comedy classics", author: "emily thomas", published: 2018, genre: "comedy" }); From above CREATE scripts you can see that Movie node has multiple properties having string values i.e. title and tagline Now if we want to search for Movies that contain the word comedy in either the title or tagline property. The first operation to do is to create a fulltext search index, with the help of the following command: CREATE FULLTEXT INDEX titlesAndDescriptions FOR (n:Movie) ON EACH [n.title, n.tagline]; In above cypher 'titlesAndDescriptions' is the name of the index, then `(n:Movie)` is a node label that will be represented as documents in the titlesAndDescriptions index and then `[n.title, n.tagline]` are the list of properties to be replicated as document fields, note that as of now, only text properties are being replicated. Now that our titlesAndDescriptions index is created, we can query it and test our fulltext search queries. Let’s find all the Movies with the word comedy either in tagline or title: CALL db.index.fulltext.queryNodes("titlesAndDescriptions", "comedy") YIELD node, score RETURN node.title,node.tagline, score; As expected, we get 5 results in the output with the word 'comedy' either in tagline property or title: Fulltext Index using multiple nodes: In the above example, we have created and used fulltext index on multiple node properties. Now in this example, we will explore how to create and use fulltext index using multiple nodes. Let's assume we have one more node Book with property name so this can be added along with Movie node using pipe symbol |while creating fulltext index like below: CREATE FULLTEXT INDEX SearchComedyMaterial FOR (n:Movie|Book) ON EACH [n.title, n.tagline,n.name]; It is worth noting that in the above cypher, we are considering Movie, as well as Book Node and the index also contains properties from Book Node.So, if we now try to create a query that searches for comedy text in the Movie and Book nodes, then there must be 7 records including records from Book node: CALL db.index.fulltext.queryNodes("SearchComedyMaterial", "comedy") YIELD node, score RETURN node.title,node.tagline,node.name, score; This will return all the Movies and Books with the text 'comedy' in their title, tagline or name, and output will look like below: For the full description of fulltext search in Neo4j, see the official documentation available here: Indexes for fulltext search . Fulltext schema indexes are powered by the Apache Lucene indexing and search library. A complete description of the Lucene query syntax can be found in the Lucene documentation. Additional search options: The search example shown above is an example of what can be called searching for a Specific attribute.Searches can also be performed using Single-character wildcard (?)Multi-character wildcard(*)Fuzzy search(~) Single-character wildcard: The single-character wildcard operator ? looks for terms that match that with the single character replaced. CALL db.index.fulltext.queryNodes("titlesAndDescriptions", "title:th?") YIELD node, score RETURN node.title as title, score; Multi-character wildcard: The multi-character wildcard * operator looks for zero or more characters. You can also put the operator in the middle of the term like dre*am. To prevent extremely slow wildcard queries, a term should not start with the wildcard. Bad example: *dream . CALL db.index.fulltext.queryNodes("titlesAndDescriptions", "title:drea*") YIELD node, score RETURN node.title as title, score; Fuzzy search: Fuzzy search ~ works by using mathematical formulae that calculate the similarity between two words. CALL db.index.fulltext.queryNodes("titlesAndDescriptions", "title:dream~") YIELD node, score RETURN node.title as title, score; See also How to perform searches using Full-text search indexes?Can we implement our own full-text custom analyzer in Neo4j Aura ? InformationTitleHow to use Fulltext index on multiple nodes and multiple node properties?Article Created Date3/15/2024, 10:57 PMURL Name13357770874643-How-to-use-Fulltext-index-on-multiple-nodes-and-multiple-node-propertiesLast Modified Date10/31/2025, 10:46 AM