Building a custom Lucene analyzer for Neo4j

operations

(Neo4j) #1

I wish to use Neo4j’s new built-in full-text search capability to search documents that will contain a mix of Norwegian and English (sometimes either, sometimes both). I understand the indexer is stock Lucene 5.5.0, and with that I can choose to use it with a provided Norwegian analyzer or English analyzer, not both simultaneously.

I would like to experiment with building a hybrid Norwegian/English analyzer. And ideally I’d like to use this fit-for-purpose convenience class for building a custom Lucene analyzer: https://lucene.apache.org/core/5_5_0/analyzers-common/org/apache/lucene/analysis/custom/CustomAnalyzer.html

Would this class be compatible with the method Stefan Armbruster described here? How to add custom Lucene analyzer?


(Wergeland) #2

(Copied my response from the original thread were you asked the same question.)

You can use that analyzer, but you still need to

  1. Configure your CustomAnalyzer instance.
  2. Register it in Neo4j.

Both can be accomplished with a single class CustomAnalyzerProvider that extends AnalyzerProvider .


(Neo4j) #3

Okay, I will use only CustomAnalyzerProvider that comes with Neo4j.