apache / apache/lucene

analyzers should be further customizable to allow for better code reuse [LUCENE-5749]

Open
#6,811 4 comments 0 reactions 0 assignees View on GitHub
affects-version:4.8.1 legacy-jira-label:analyzers legacy-jira-priority:Minor module:analysis type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

To promote code reuse, the customizability of the analyzers included with Lucene (e.g. EnglishAnalyzer) ought to be further improved.

To illustrate, it is currently difficult to specify general stemming behavior without having to modify each and every analyzer class. In our case, we had to change the constructors of every analyzer class to accept an AnalyzerOption argument.

The AnalyzerOption class has a getStemStrategy() method. StemStrategy is defined as follows:

public enum StemStrategy { AGGRESSIVE, LIGHT, NONE };

We needed to modify over 20 or so Lucene classes. This is obviously not ideal from a code reuse and maintainability standpoint.

---
Migrated from [LUCENE-5749](https://issues.apache.org/jira/browse/LUCENE-5749) by Jamie
Environment:
```
All
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the analyzer classes, including EnglishAnalyzer, and the constructor changes described in the issue. Determine how stemming options are currently passed and define a reusable customization approach; done means general stemming behavior can be configured without modifying every analyzer class.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.