Full-Text is created and online but is not working

Neo4j v4.2.0

EDIT:

Issue link: Full-Text indexes not working when an analyzer is specified. · Issue #12662 · neo4j/neo4j · GitHub

After double-checking the issue it seems that passing the config parameter { analyzer: "standard-analyzer"} to the createNodeIndex function breaks the Full-Text.

This works:
CALL db.index.fulltext.createNodeIndex("PortfolioCodeFT",["Portfolio"],["code"])

This doesn't work:
CALL db.index.fulltext.createNodeIndex("PortfolioCodeFT",["Portfolio"],["code"], {analyzer:"standard-folding"})

I have a cypher script where I load data, create nodes and relationships, and also create Full-Text indexes.

It's done like this:

:begin
CREATE INDEX ClientName FOR (c:Client) ON (c.name);
:commit
:begin
CALL db.index.fulltext.createNodeIndex("ClientCodeFT",["Client"],["code"], { analyzer: "standard-folding" });
:commit

When I query :schema on Neo4j Desktop I can see the list of CONSTRAINTS and Indexes created and I can see that "ClientCodeFT" is ONLINE.

If I query using the Full-Text index like this:

CALL db.index.fulltext.queryNodes('ClientCodeFT', '*SOMECODE*') YIELD node
RETURN node LIMIT 25;

All I get is (no changes, no records)

If I manually drop the Index:

CALL db.index.fulltext.drop("ClientCodeFT");

Then re-create it again (note I don't specify the analyzer) :

CALL db.index.fulltext.createNodeIndex("ClientCodeFT",["Client"],["code"]);

And run the same query again:

CALL db.index.fulltext.queryNodes('ClientCodeFT', '*SOMECODE*') YIELD node
RETURN node LIMIT 25;

Then I get the nodes. Why is that?

Looks like a bug, can you raise this on

Thanks Michael, I will submit an issue :slight_smile:

The issue Full-Text indexes not working when an analyzer is specified. · Issue #12662 · neo4j/neo4j · GitHub

So you create an index on the Client Label and the property of name

But your FTS index on on the Client label and the code property.

Is that correct? Do your Client nodes have a code property?

I ran this on the Movies db and it worked:

CALL db.index.fulltext.createNodeIndex("testft2",["Movie"],["title"], { analyzer: "standard-folding" });

CALL db.index.fulltext.queryNodes('testft2', '*matrix*')

I had 3 nodes returned.

Sorry it was a typo, the constraint is created on the same property the full text index.

Are you thus all set and this was down to a typo? mark the issue solved?

It's a bug.

Yes, the typo is in the CONSTRAINT name and property. It should be

CREATE INDEX ClientCode FOR (c:Client) ON (c.code);

An UNIQUENESS constraint is created before the FullText search index.

Just to keep this post updated.

A member of the developer team has been able to reproduce this bug and is working on a solution.

1 Like