Full-Text Search in Neo4j
Create and query Neo4j full-text indexes with Lucene syntax: wildcards, fuzzy matching, boolean operators, and relevance scoring for text search.
In this 40-minute lab, you will learn
This lab teaches you how to build fast, forgiving text search in Neo4j using full-text indexes. In around 40 minutes you will go from exact-match lookups to a complete movie search feature that handles typos, partial words, and mixed capitalization, and returns each result enriched with its cast and crew.
Searching text in a database sounds straightforward until you try it. Exact Full definition for property (opens in a new tab)A named value stored on a node or a relationship. lookups work when you know the precise value, but users rarely search that way. They type "matrix" in lowercase, misspell it as "matrx", or remember only one word of a title. A standard property index cannot help with any of these, and the common toLower() CONTAINS workaround forces the database to scan every Full definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties.. Full-text indexes, backed by Apache Lucene, solve the problem at index time: text is split into lowercase tokens when the index is built, so searches match pre-processed tokens instead of transforming every property on every query.
Full-text indexes
Create full-text indexes on node properties for efficient text search.
Search operators
Use wildcards, fuzzy matching, and boolean operators to find results.
Relevance scoring
Understand what the relevance score means and use it to filter and rank search results.
Who this course is for
This lab is for developers and data practitioners who need search functionality on data stored in Neo4j — a movie catalogue, a product listing, a directory of people. It is also for anyone who has already hit the problem the hard way: if you have written a query that wraps a Full definition for property (opens in a new tab)A named value stored on a node or a relationship. in
toLower()and watched it slow down as the data grew, this lab shows you the indexed alternative and explains why it performs differently. You should be comfortable reading and writing basic Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. from Cypher Fundamentals, but you need no prior experience with Lucene or search engines — every operator is introduced from scratch.What you'll do
This is a hands-on lab. You work in an embedded sandbox connected to a live Neo4j database loaded with the movies dataset:
MovieFull definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties. withtitleandtaglineFull definition for property (opens in a new tab)A named value stored on a node or a relationship., andPersonnodes connected to them byACTED_INandDIRECTEDFull definition for relationship (opens in a new tab)A named, directed connection between two nodes. Every relationship has a type, a start node and an end node..You start by seeing exactly why exact-match queries and
toLower()workarounds fall short. Then you create your own full-text index withCREATE FULLTEXT INDEX, query it with thedb.index.fulltext.queryNodesprocedure, and work through the search operators Lucene provides: wildcards for partial words,~for fuzzy matching, double quotes for phrase matching, andAND/ORfor combining terms. Along the way you learn what the relevance score attached to each result means and how to use it to filter and rank. Each challenge checks a real query against the live database, and the final one combines search, score filtering, and list comprehensions into one production-shaped query returning title, score, cast, and crew.Where to go next
Graph Type Schema Enforcement is the next lab in the Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. path: it shows you how to define and enforce a schema so the data your searches run against stays clean and consistent. Cypher Indexes and Constraints gives you the broader picture of index types in Neo4j alongside the full-text indexes you used here. The skills you build also count toward the Neo4j Certified Professional exam, a recognised credential that covers indexes and search.
Posts from the GraphAcademy blog.
My five favorite cards in Aura Dashboards
When Dashboards first became available in Aura, I started to move my reporting away from custom tools. Here are the five cards I use the most, and a Cypher statement behind them.
SQL to Cypher - 10 Queries You Already Know
You already know how to write these queries. This article shows you what they look like when the joins go away.
Writing Cypher Queries That Don't Lose Your Data
The query trap that hides your newest data, and the query shape that brings it back.