cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to use a full text index with different lucene analyzers for indexing and searching in neo4j?

For certain use cases, e.g. with NGram or EdgeNGram tokenizers, it should be possible to define 2 different analyzers for a manual index, one for the index task and one for the search/query task

2 REPLIES 2

A fulltext index always has exactly one analyzer. You could of course create two fulltext indexes over the same label/property combination each using a different analyzer.

It doesn't seem to be possible to add another fulltext index with the same label/property combo but with a different analyzer.

fulltext with english analyzer

CALL db.index.fulltext.createNodeIndex("quickSearchEnglish",
  ["User", "Employee", "Company", "Agency"],
  ["userId", "firstName", "lastName", "employeeId", "emailAddress", "companyId", "name", "agencyId"],
  {
    eventually_consistent: true,
    analyzer: "english"
  }
)

fulltext with dutch analyzer

CALL db.index.fulltext.createNodeIndex("quickSearchDutch",
  ["User", "Employee", "Company", "Agency"],
  ["userId", "firstName", "lastName", "employeeId", "emailAddress", "companyId", "name", "agencyId"],
  {
    eventually_consistent: true,
    analyzer: "dutch"
  }
)

outcome

Neo.ClientError.Schema.IndexAlreadyExists

There already exists an index NODE:label[1], label[0], label[3], label[2](property[8], property[4], property[3], property[2], property[17], property[19], property[18], property[10], property[11], property[5]).

Any ideas how to make it work?