diff --git a/.gitignore b/.gitignore index 11d7f833d75..1a3e1dbf4e9 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ pom.xml .pydevproject __pycache__ /dev-tools/scripts/scripts.iml + diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 189260938a0..09ef1fab08f 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -30,6 +30,8 @@ Bug fixes Other * LUCENE-8768: Fix Javadocs build in Java 11. (Namgyu Kim) +* LUCENE-8778: Define analyzer SPI names as static final fields and document the names in Javadocs. + (Tomoko Uchida, Uwe Schindler) ======================= Lucene 8.2.0 ======================= diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ar/ArabicNormalizationFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ar/ArabicNormalizationFilterFactory.java index 3bf2227f894..a1b5c2dc51e 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ar/ArabicNormalizationFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ar/ArabicNormalizationFilterFactory.java @@ -33,9 +33,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class ArabicNormalizationFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "arabicNormalization"; + /** Creates a new ArabicNormalizationFilterFactory */ public ArabicNormalizationFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ar/ArabicStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ar/ArabicStemFilterFactory.java index 93864e779c8..5a12a71e927 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ar/ArabicStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ar/ArabicStemFilterFactory.java @@ -34,9 +34,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class ArabicStemFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "arabicStem"; + /** Creates a new ArabicStemFilterFactory */ public ArabicStemFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/bg/BulgarianStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/bg/BulgarianStemFilterFactory.java index 380adbd11e1..980708b6ab9 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/bg/BulgarianStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/bg/BulgarianStemFilterFactory.java @@ -33,9 +33,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class BulgarianStemFilterFactory extends TokenFilterFactory { - + + /** SPI name */ + public static final String NAME = "bulgarianStem"; + /** Creates a new BulgarianStemFilterFactory */ public BulgarianStemFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/bn/BengaliNormalizationFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/bn/BengaliNormalizationFilterFactory.java index d537f220dbb..975805bb571 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/bn/BengaliNormalizationFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/bn/BengaliNormalizationFilterFactory.java @@ -32,9 +32,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 7.1.0 + * @lucene.spi {@value #NAME} */ public class BengaliNormalizationFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "bengaliNormalization"; + public BengaliNormalizationFilterFactory(Map args) { super(args); if (!args.isEmpty()) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/bn/BengaliStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/bn/BengaliStemFilterFactory.java index 7383dbbe277..999e1c156e4 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/bn/BengaliStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/bn/BengaliStemFilterFactory.java @@ -32,9 +32,13 @@ import java.util.Map; * </analyzer> * </fieldType> * @since 7.1.0 + * @lucene.spi {@value #NAME} */ public class BengaliStemFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "bengaliStem"; + public BengaliStemFilterFactory(Map args) { super(args); if (!args.isEmpty()) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/br/BrazilianStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/br/BrazilianStemFilterFactory.java index 065bdcc2db9..bcf00d643f4 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/br/BrazilianStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/br/BrazilianStemFilterFactory.java @@ -34,8 +34,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class BrazilianStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "brazilianStem"; /** Creates a new BrazilianStemFilterFactory */ public BrazilianStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterFactory.java index 8ad1488274d..372e3498d49 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterFactory.java @@ -35,8 +35,13 @@ import java.util.regex.Pattern; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class HTMLStripCharFilterFactory extends CharFilterFactory { + + /** SPI name */ + public static final String NAME = "htmlStrip"; + final Set escapedTags; static final Pattern TAG_NAME_PATTERN = Pattern.compile("[^\\s,]+"); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/MappingCharFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/MappingCharFilterFactory.java index de0e22bff89..dbf93581fb1 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/MappingCharFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/MappingCharFilterFactory.java @@ -40,10 +40,14 @@ import org.apache.lucene.analysis.util.ResourceLoaderAware; * </fieldType> * * @since Solr 1.4 + * @lucene.spi {@value #NAME} */ public class MappingCharFilterFactory extends CharFilterFactory implements ResourceLoaderAware { + /** SPI name */ + public static final String NAME = "mapping"; + protected NormalizeCharMap normMap; private final String mapping; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKBigramFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKBigramFilterFactory.java index e0c60977b88..c5100d62715 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKBigramFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKBigramFilterFactory.java @@ -36,8 +36,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class CJKBigramFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "cjkBigram"; + final int flags; final boolean outputUnigrams; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKWidthFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKWidthFilterFactory.java index 6754bf52e7d..6c9aa837d76 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKWidthFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKWidthFilterFactory.java @@ -34,8 +34,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class CJKWidthFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "cjkWidth"; /** Creates a new CJKWidthFilterFactory */ public CJKWidthFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ckb/SoraniNormalizationFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ckb/SoraniNormalizationFilterFactory.java index b552ae9978b..9237cc108c6 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ckb/SoraniNormalizationFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ckb/SoraniNormalizationFilterFactory.java @@ -32,9 +32,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 4.7.0 + * @lucene.spi {@value #NAME} */ public class SoraniNormalizationFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "soraniNormalization"; + /** Creates a new SoraniNormalizationFilterFactory */ public SoraniNormalizationFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ckb/SoraniStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ckb/SoraniStemFilterFactory.java index 50aa9719294..1b18c444452 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ckb/SoraniStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ckb/SoraniStemFilterFactory.java @@ -33,9 +33,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 4.7.0 + * @lucene.spi {@value #NAME} */ public class SoraniStemFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "soraniStem"; + /** Creates a new SoraniStemFilterFactory */ public SoraniStemFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/commongrams/CommonGramsFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/commongrams/CommonGramsFilterFactory.java index 77ba8a86f0a..523601b6fcf 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/commongrams/CommonGramsFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/commongrams/CommonGramsFilterFactory.java @@ -39,9 +39,14 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class CommonGramsFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { - // TODO: shared base class for Stop/Keep/CommonGrams? + + /** SPI name */ + public static final String NAME = "commonGrams"; + + // TODO: shared base class for Stop/Keep/CommonGrams? private CharArraySet commonWords; private final String commonWordFiles; private final String format; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/commongrams/CommonGramsQueryFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/commongrams/CommonGramsQueryFilterFactory.java index 2d65c57a791..0431b58511a 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/commongrams/CommonGramsQueryFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/commongrams/CommonGramsQueryFilterFactory.java @@ -34,9 +34,12 @@ import org.apache.lucene.analysis.TokenStream; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class CommonGramsQueryFilterFactory extends CommonGramsFilterFactory { + public static final String NAME = "commonGramsQuery"; + /** Creates a new CommonGramsQueryFilterFactory */ public CommonGramsQueryFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/DictionaryCompoundWordTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/DictionaryCompoundWordTokenFilterFactory.java index db475e378c5..ee80e1e7e70 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/DictionaryCompoundWordTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/DictionaryCompoundWordTokenFilterFactory.java @@ -38,8 +38,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class DictionaryCompoundWordTokenFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "dictionaryCompoundWord"; + private CharArraySet dictionary; private final String dictFile; private final int minWordSize; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/HyphenationCompoundWordTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/HyphenationCompoundWordTokenFilterFactory.java index 6b018d60531..b7f3037b59e 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/HyphenationCompoundWordTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/HyphenationCompoundWordTokenFilterFactory.java @@ -58,8 +58,13 @@ import org.xml.sax.InputSource; * * @see HyphenationCompoundWordTokenFilter * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class HyphenationCompoundWordTokenFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "hyphenationCompoundWord"; + private CharArraySet dictionary; private HyphenationTree hyphenator; private final String dictFile; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/DecimalDigitFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/DecimalDigitFilterFactory.java index 2db789a427f..1ebca988a38 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/DecimalDigitFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/DecimalDigitFilterFactory.java @@ -32,8 +32,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 5.4.0 + * @lucene.spi {@value #NAME} */ public class DecimalDigitFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "decimalDigit"; /** Creates a new DecimalDigitFilterFactory */ public DecimalDigitFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/FlattenGraphFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/FlattenGraphFilterFactory.java index 1021c743891..c3afe4f6ba9 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/FlattenGraphFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/FlattenGraphFilterFactory.java @@ -27,9 +27,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * * @lucene.experimental * @since 6.4.0 + * @lucene.spi {@value #NAME} */ public class FlattenGraphFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "flattenGraph"; + /** Creates a new FlattenGraphFilterFactory */ public FlattenGraphFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/KeywordTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/KeywordTokenizerFactory.java index f2d84f442e3..125647200a0 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/KeywordTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/KeywordTokenizerFactory.java @@ -40,8 +40,13 @@ import static org.apache.lucene.analysis.standard.StandardTokenizer.MAX_TOKEN_LE * * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class KeywordTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "keyword"; + private final int maxTokenLen; /** Creates a new KeywordTokenizerFactory */ diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/LetterTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/LetterTokenizerFactory.java index ab5cefda7e5..6cb92426d14 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/LetterTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/LetterTokenizerFactory.java @@ -42,8 +42,13 @@ import static org.apache.lucene.analysis.standard.StandardTokenizer.MAX_TOKEN_LE * * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class LetterTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "letter"; + private final int maxTokenLen; /** Creates a new LetterTokenizerFactory */ diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/LowerCaseFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/LowerCaseFilterFactory.java index d0e079164e6..f47b86049e3 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/LowerCaseFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/LowerCaseFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class LowerCaseFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "lowercase"; /** Creates a new LowerCaseFilterFactory */ public LowerCaseFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/StopFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/StopFilterFactory.java index 3806b83fcb3..a2b5b806c8f 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/StopFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/StopFilterFactory.java @@ -71,8 +71,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class StopFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "stop"; + public static final String FORMAT_WORDSET = "wordset"; public static final String FORMAT_SNOWBALL = "snowball"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/TypeTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/TypeTokenFilterFactory.java index ffa0853ff7b..920f24fd78a 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/TypeTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/TypeTokenFilterFactory.java @@ -39,8 +39,13 @@ import java.util.Set; * </analyzer> * </fieldType> * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class TypeTokenFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "type"; + private final boolean useWhitelist; private final String stopTypesFiles; private Set stopTypes; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/UpperCaseFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/UpperCaseFilterFactory.java index 24515d22bdc..5d1e1b7631b 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/UpperCaseFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/UpperCaseFilterFactory.java @@ -37,8 +37,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * when you require uppercase tokens. Use the {@link LowerCaseFilterFactory} for * general search matching * @since 4.7.0 + * @lucene.spi {@value #NAME} */ public class UpperCaseFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "uppercase"; /** Creates a new UpperCaseFilterFactory */ public UpperCaseFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/WhitespaceTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/WhitespaceTokenizerFactory.java index b04e9ac50e4..c2aac5da6a0 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/WhitespaceTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/core/WhitespaceTokenizerFactory.java @@ -47,8 +47,13 @@ import static org.apache.lucene.analysis.standard.StandardTokenizer.MAX_TOKEN_LE * * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class WhitespaceTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "whitespace"; + public static final String RULE_JAVA = "java"; public static final String RULE_UNICODE = "unicode"; private static final Collection RULE_NAMES = Arrays.asList(RULE_JAVA, RULE_UNICODE); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/cz/CzechStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/cz/CzechStemFilterFactory.java index 2e4ff76415c..75c8851bd89 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/cz/CzechStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/cz/CzechStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class CzechStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "czechStem"; /** Creates a new CzechStemFilterFactory */ public CzechStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanLightStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanLightStemFilterFactory.java index b85faa466c1..63b44683924 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanLightStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanLightStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class GermanLightStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "germanLightStem"; /** Creates a new GermanLightStemFilterFactory */ public GermanLightStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanMinimalStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanMinimalStemFilterFactory.java index f0ccfa9464b..0e0eb78647e 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanMinimalStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanMinimalStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class GermanMinimalStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "germanMinimalStem"; /** Creates a new GermanMinimalStemFilterFactory */ public GermanMinimalStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanNormalizationFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanNormalizationFilterFactory.java index bed32037c6a..b99c305c8c5 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanNormalizationFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanNormalizationFilterFactory.java @@ -33,9 +33,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class GermanNormalizationFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "germanNormalization"; + /** Creates a new GermanNormalizationFilterFactory */ public GermanNormalizationFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanStemFilterFactory.java index 545fcfff8e2..567b126bef7 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/de/GermanStemFilterFactory.java @@ -34,8 +34,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class GermanStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "germanStem"; /** Creates a new GermanStemFilterFactory */ public GermanStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/el/GreekLowerCaseFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/el/GreekLowerCaseFilterFactory.java index 17e7adf8aaa..4149c41edb3 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/el/GreekLowerCaseFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/el/GreekLowerCaseFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class GreekLowerCaseFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "greekLowerCase"; /** Creates a new GreekLowerCaseFilterFactory */ public GreekLowerCaseFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/el/GreekStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/el/GreekStemFilterFactory.java index 4ced77949fc..66e415f8e95 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/el/GreekStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/el/GreekStemFilterFactory.java @@ -33,9 +33,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class GreekStemFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "greekStem"; + /** Creates a new GreekStemFilterFactory */ public GreekStemFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/EnglishMinimalStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/EnglishMinimalStemFilterFactory.java index 062579bff7f..99953ea69b8 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/EnglishMinimalStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/EnglishMinimalStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class EnglishMinimalStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "englishMinimalStem"; /** Creates a new EnglishMinimalStemFilterFactory */ public EnglishMinimalStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/EnglishPossessiveFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/EnglishPossessiveFilterFactory.java index ef090937c7d..dbefeec6afb 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/EnglishPossessiveFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/EnglishPossessiveFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class EnglishPossessiveFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "englishPossessive"; /** Creates a new EnglishPossessiveFilterFactory */ public EnglishPossessiveFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/KStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/KStemFilterFactory.java index b72c805b33d..0bf1a71b27b 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/KStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/KStemFilterFactory.java @@ -34,9 +34,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.3.0 + * @lucene.spi {@value #NAME} */ public class KStemFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "kStem"; + /** Creates a new KStemFilterFactory */ public KStemFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/PorterStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/PorterStemFilterFactory.java index b62865c90d5..10fba1f081f 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/PorterStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/en/PorterStemFilterFactory.java @@ -34,8 +34,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class PorterStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "porterStem"; /** Creates a new PorterStemFilterFactory */ public PorterStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/es/SpanishLightStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/es/SpanishLightStemFilterFactory.java index 7ad81faccfa..a9cc48763aa 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/es/SpanishLightStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/es/SpanishLightStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class SpanishLightStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "spanishLightStem"; /** Creates a new SpanishLightStemFilterFactory */ public SpanishLightStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianCharFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianCharFilterFactory.java index 1f59ecf0a15..1084e503ed0 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianCharFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianCharFilterFactory.java @@ -33,9 +33,13 @@ import org.apache.lucene.analysis.util.CharFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class PersianCharFilterFactory extends CharFilterFactory { + /** SPI name */ + public static final String NAME = "persian"; + /** Creates a new PersianCharFilterFactory */ public PersianCharFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianNormalizationFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianNormalizationFilterFactory.java index 256b5015707..1801bd33799 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianNormalizationFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianNormalizationFilterFactory.java @@ -34,8 +34,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class PersianNormalizationFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "persianNormalization"; /** Creates a new PersianNormalizationFilterFactory */ public PersianNormalizationFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/fi/FinnishLightStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/fi/FinnishLightStemFilterFactory.java index 02719ff781d..e8311aea45d 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/fi/FinnishLightStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/fi/FinnishLightStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class FinnishLightStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "finnishLightStem"; /** Creates a new FinnishLightStemFilterFactory */ public FinnishLightStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchLightStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchLightStemFilterFactory.java index 1f957d23008..368289fb522 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchLightStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchLightStemFilterFactory.java @@ -34,8 +34,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class FrenchLightStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "frenchLightStem"; /** Creates a new FrenchLightStemFilterFactory */ public FrenchLightStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchMinimalStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchMinimalStemFilterFactory.java index b6e91a2ec3c..08f7071b908 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchMinimalStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchMinimalStemFilterFactory.java @@ -34,8 +34,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class FrenchMinimalStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "frenchMinimalStem"; /** Creates a new FrenchMinimalStemFilterFactory */ public FrenchMinimalStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ga/IrishLowerCaseFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ga/IrishLowerCaseFilterFactory.java index abaad3de6fc..2e551a5bf0e 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ga/IrishLowerCaseFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ga/IrishLowerCaseFilterFactory.java @@ -32,9 +32,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class IrishLowerCaseFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "irishLowerCase"; + /** Creates a new IrishLowerCaseFilterFactory */ public IrishLowerCaseFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/gl/GalicianMinimalStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/gl/GalicianMinimalStemFilterFactory.java index c739c7ed416..6c635833aee 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/gl/GalicianMinimalStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/gl/GalicianMinimalStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class GalicianMinimalStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "galicianMinimalStem"; /** Creates a new GalicianMinimalStemFilterFactory */ public GalicianMinimalStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/gl/GalicianStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/gl/GalicianStemFilterFactory.java index bd4bcf1409d..0d11dac7822 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/gl/GalicianStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/gl/GalicianStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class GalicianStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "galicianStem"; /** Creates a new GalicianStemFilterFactory */ public GalicianStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hi/HindiNormalizationFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hi/HindiNormalizationFilterFactory.java index fbc0a24f307..8c366fd4b02 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hi/HindiNormalizationFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hi/HindiNormalizationFilterFactory.java @@ -32,8 +32,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class HindiNormalizationFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "hindiNormalization"; /** Creates a new HindiNormalizationFilterFactory */ public HindiNormalizationFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hi/HindiStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hi/HindiStemFilterFactory.java index e0562a46cff..32f5287137f 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hi/HindiStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hi/HindiStemFilterFactory.java @@ -32,8 +32,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class HindiStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "hindiStem"; /** Creates a new HindiStemFilterFactory */ public HindiStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hu/HungarianLightStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hu/HungarianLightStemFilterFactory.java index 6720fd18b48..3b57a408961 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hu/HungarianLightStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hu/HungarianLightStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class HungarianLightStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "hungarianLightStem"; /** Creates a new HungarianLightStemFilterFactory */ public HungarianLightStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/HunspellStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/HunspellStemFilterFactory.java index 3e9b9ba001b..73de215fc84 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/HunspellStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/HunspellStemFilterFactory.java @@ -49,8 +49,13 @@ import org.apache.lucene.util.IOUtils; * See http://wiki.apache.org/solr/Hunspell * @lucene.experimental * @since 3.5.0 + * @lucene.spi {@value #NAME} */ public class HunspellStemFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "hunspellStem"; + private static final String PARAM_DICTIONARY = "dictionary"; private static final String PARAM_AFFIX = "affix"; // NOTE: this one is currently unused?: diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/id/IndonesianStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/id/IndonesianStemFilterFactory.java index d81426b151c..f9754186753 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/id/IndonesianStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/id/IndonesianStemFilterFactory.java @@ -33,8 +33,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class IndonesianStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "indonesianStem"; + private final boolean stemDerivational; /** Creates a new IndonesianStemFilterFactory */ diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/in/IndicNormalizationFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/in/IndicNormalizationFilterFactory.java index e4a6900a447..d7391d1078e 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/in/IndicNormalizationFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/in/IndicNormalizationFilterFactory.java @@ -32,8 +32,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class IndicNormalizationFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "indicNormalization"; /** Creates a new IndicNormalizationFilterFactory */ public IndicNormalizationFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/it/ItalianLightStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/it/ItalianLightStemFilterFactory.java index 2c324a4fc30..53f56bf6e05 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/it/ItalianLightStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/it/ItalianLightStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class ItalianLightStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "italianLightStem"; /** Creates a new ItalianLightStemFilterFactory */ public ItalianLightStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/lv/LatvianStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/lv/LatvianStemFilterFactory.java index 0be282891d6..b00a3c1f37a 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/lv/LatvianStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/lv/LatvianStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.2.0 + * @lucene.spi {@value #NAME} */ public class LatvianStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "latvianStem"; /** Creates a new LatvianStemFilterFactory */ public LatvianStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/minhash/MinHashFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/minhash/MinHashFilterFactory.java index f93f65b66bc..70132f2d7c6 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/minhash/MinHashFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/minhash/MinHashFilterFactory.java @@ -25,8 +25,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; /** * {@link TokenFilterFactory} for {@link MinHashFilter}. * @since 6.2.0 + * @lucene.spi {@value #NAME} */ public class MinHashFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "minHash"; + private int hashCount = MinHashFilter.DEFAULT_HASH_COUNT; private int bucketCount = MinHashFilter.DEFAULT_BUCKET_COUNT; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ASCIIFoldingFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ASCIIFoldingFilterFactory.java index 4dabd88c262..8a3a803ac40 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ASCIIFoldingFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ASCIIFoldingFilterFactory.java @@ -33,8 +33,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class ASCIIFoldingFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "asciiFolding"; + private static final String PRESERVE_ORIGINAL = "preserveOriginal"; private final boolean preserveOriginal; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/CapitalizationFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/CapitalizationFilterFactory.java index 0397de7f82d..f0c79884ed5 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/CapitalizationFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/CapitalizationFilterFactory.java @@ -56,8 +56,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since solr 1.3 + * @lucene.spi {@value #NAME} */ public class CapitalizationFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "capitalization"; + public static final String KEEP = "keep"; public static final String KEEP_IGNORE_CASE = "keepIgnoreCase"; public static final String OK_PREFIX = "okPrefix"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/CodepointCountFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/CodepointCountFilterFactory.java index abadf2579c9..2f13dc6e45a 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/CodepointCountFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/CodepointCountFilterFactory.java @@ -32,8 +32,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 4.5.1 + * @lucene.spi {@value #NAME} */ public class CodepointCountFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "codepointCount"; + final int min; final int max; public static final String MIN_KEY = "min"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilterFactory.java index 5d8ccbacf3d..2b0aab9e68c 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConcatenateGraphFilterFactory.java @@ -44,9 +44,13 @@ import org.apache.lucene.util.automaton.TooComplexToDeterminizeException; * * @see ConcatenateGraphFilter * @since 7.4.0 + * @lucene.spi {@value #NAME} */ public class ConcatenateGraphFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "concatenateGraph"; + private boolean preserveSep; private boolean preservePositionIncrements; private int maxGraphExpansions; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConditionalTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConditionalTokenFilterFactory.java index 6296082a9ee..deddbc65a7c 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConditionalTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ConditionalTokenFilterFactory.java @@ -32,9 +32,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * Abstract parent class for analysis factories that create {@link ConditionalTokenFilter} instances * * @since 7.4.0 + * @lucene.spi {@value #NAME} */ public abstract class ConditionalTokenFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + /** SPI name */ + public static final String NAME = "conditional"; + private List innerFilters; protected ConditionalTokenFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/DateRecognizerFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/DateRecognizerFilterFactory.java index 7a426c50f6c..4e0a2ad35d1 100755 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/DateRecognizerFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/DateRecognizerFilterFactory.java @@ -42,9 +42,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * format of the system. The {@code locale} is optional and if omitted the filter will be created with * {@link Locale#ENGLISH}. * @since 5.5.0 + * @lucene.spi {@value #NAME} */ public class DateRecognizerFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "dateRecognizer"; + public static final String DATE_PATTERN = "datePattern"; public static final String LOCALE = "locale"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/DelimitedTermFrequencyTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/DelimitedTermFrequencyTokenFilterFactory.java index 422da77b2e8..a9479c19227 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/DelimitedTermFrequencyTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/DelimitedTermFrequencyTokenFilterFactory.java @@ -32,8 +32,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 7.0.0 + * @lucene.spi {@value #NAME} */ public class DelimitedTermFrequencyTokenFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "delimitedTermFrequency"; + public static final String DELIMITER_ATTR = "delimiter"; private final char delimiter; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FingerprintFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FingerprintFilterFactory.java index 70bc6686747..89556c549c4 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FingerprintFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FingerprintFilterFactory.java @@ -32,9 +32,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * {@link FingerprintFilter} for an explanation of its use. * * @since 5.4.0 + * @lucene.spi {@value #NAME} */ public class FingerprintFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "fingerprint"; + public static final String MAX_OUTPUT_TOKEN_SIZE_KEY = "maxOutputTokenSize"; public static final String SEPARATOR_KEY = "separator"; final int maxOutputTokenSize; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FixBrokenOffsetsFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FixBrokenOffsetsFilterFactory.java index 1f58841d929..04503e42439 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FixBrokenOffsetsFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/FixBrokenOffsetsFilterFactory.java @@ -25,9 +25,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; /** * Factory for {@link FixBrokenOffsetsFilter}. * @since 7.0.0 + * @lucene.spi {@value #NAME} */ public class FixBrokenOffsetsFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "fixBrokenOffsets"; + /** Sole constructor */ public FixBrokenOffsetsFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/HyphenatedWordsFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/HyphenatedWordsFilterFactory.java index f55a49df8da..3b9804aa142 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/HyphenatedWordsFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/HyphenatedWordsFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class HyphenatedWordsFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "hyphenatedWords"; /** Creates a new HyphenatedWordsFilterFactory */ public HyphenatedWordsFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeepWordFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeepWordFilterFactory.java index b1c4baef9b6..64a83caa445 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeepWordFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeepWordFilterFactory.java @@ -37,8 +37,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class KeepWordFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "keepWord"; + private final boolean ignoreCase; private final String wordFiles; private CharArraySet words; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeywordMarkerFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeywordMarkerFilterFactory.java index e9293bc5a9a..efc0159861c 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeywordMarkerFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeywordMarkerFilterFactory.java @@ -37,8 +37,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class KeywordMarkerFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "keywordMarker"; + public static final String PROTECTED_TOKENS = "protected"; public static final String PATTERN = "pattern"; private final String wordFiles; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeywordRepeatFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeywordRepeatFilterFactory.java index 900b357010d..717a7ee9196 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeywordRepeatFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/KeywordRepeatFilterFactory.java @@ -29,8 +29,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * later in the analysis chain will be in the document twice. Therefore, consider adding * {@link RemoveDuplicatesTokenFilterFactory} later in the analysis chain. * @since 4.3.0 + * @lucene.spi {@value #NAME} */ public final class KeywordRepeatFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "keywordRepeat"; /** Creates a new KeywordRepeatFilterFactory */ public KeywordRepeatFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LengthFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LengthFilterFactory.java index 29d789d7fc8..01f4b7772c4 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LengthFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LengthFilterFactory.java @@ -33,8 +33,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class LengthFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "length"; + final int min; final int max; public static final String MIN_KEY = "min"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenCountFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenCountFilterFactory.java index 547bd9b89ef..b36aab047e1 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenCountFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenCountFilterFactory.java @@ -35,9 +35,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * The {@code consumeAllTokens} property is optional and defaults to {@code false}. * See {@link LimitTokenCountFilter} for an explanation of its use. * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class LimitTokenCountFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "limitTokenCount"; + public static final String MAX_TOKEN_COUNT_KEY = "maxTokenCount"; public static final String CONSUME_ALL_TOKENS_KEY = "consumeAllTokens"; final int maxTokenCount; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenOffsetFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenOffsetFilterFactory.java index fd01e875f6e..954be4b9f7b 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenOffsetFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenOffsetFilterFactory.java @@ -34,9 +34,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; *

* The {@code consumeAllTokens} property is optional and defaults to {@code false}. * @since 5.2.0 + * @lucene.spi {@value #NAME} */ public class LimitTokenOffsetFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "limitTokenOffset"; + public static final String MAX_START_OFFSET = "maxStartOffset"; public static final String CONSUME_ALL_TOKENS_KEY = "consumeAllTokens"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenPositionFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenPositionFilterFactory.java index a6c055b176f..8b5bdf2342a 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenPositionFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/LimitTokenPositionFilterFactory.java @@ -34,9 +34,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * The {@code consumeAllTokens} property is optional and defaults to {@code false}. * See {@link LimitTokenPositionFilter} for an explanation of its use. * @since 4.3.0 + * @lucene.spi {@value #NAME} */ public class LimitTokenPositionFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "limitTokenPosition"; + public static final String MAX_TOKEN_POSITION_KEY = "maxTokenPosition"; public static final String CONSUME_ALL_TOKENS_KEY = "consumeAllTokens"; final int maxTokenPosition; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ProtectedTermFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ProtectedTermFilterFactory.java index c52899681a2..65c8edf57e0 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ProtectedTermFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ProtectedTermFilterFactory.java @@ -77,9 +77,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; *

See related {@link org.apache.lucene.analysis.custom.CustomAnalyzer.Builder#whenTerm(Predicate)} * * @since 7.4.0 + * @lucene.spi {@value #NAME} */ public class ProtectedTermFilterFactory extends ConditionalTokenFilterFactory implements ResourceLoaderAware { + public static final String NAME = "protectedTerm"; + public static final String PROTECTED_TERMS = "protected"; public static final char FILTER_ARG_SEPARATOR = '.'; public static final char FILTER_NAME_ID_SEPARATOR = '-'; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/RemoveDuplicatesTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/RemoveDuplicatesTokenFilterFactory.java index 0c97245e962..70a3678c6a0 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/RemoveDuplicatesTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/RemoveDuplicatesTokenFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class RemoveDuplicatesTokenFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "removeDuplicates"; /** Creates a new RemoveDuplicatesTokenFilterFactory */ public RemoveDuplicatesTokenFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ScandinavianFoldingFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ScandinavianFoldingFilterFactory.java index ae6465d0e03..62beb64389d 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ScandinavianFoldingFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ScandinavianFoldingFilterFactory.java @@ -32,9 +32,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 4.4.0 + * @lucene.spi {@value #NAME} */ public class ScandinavianFoldingFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "scandinavianFolding"; + public ScandinavianFoldingFilterFactory(Map args) { super(args); if (!args.isEmpty()) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ScandinavianNormalizationFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ScandinavianNormalizationFilterFactory.java index f58d42da5da..3d40daa0eec 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ScandinavianNormalizationFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/ScandinavianNormalizationFilterFactory.java @@ -32,9 +32,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 4.4.0 + * @lucene.spi {@value #NAME} */ public class ScandinavianNormalizationFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "scandinavianNormalization"; + public ScandinavianNormalizationFilterFactory(Map args) { super(args); if (!args.isEmpty()) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/StemmerOverrideFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/StemmerOverrideFilterFactory.java index eb6654c2c3b..9373454a384 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/StemmerOverrideFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/StemmerOverrideFilterFactory.java @@ -37,8 +37,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class StemmerOverrideFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "stemmerOverride"; + private StemmerOverrideMap dictionary; private final String dictionaryFiles; private final boolean ignoreCase; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TrimFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TrimFilterFactory.java index 4f00e41f1e6..285fc72c7af 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TrimFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TrimFilterFactory.java @@ -35,8 +35,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * @see TrimFilter * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class TrimFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "trim"; /** Creates a new TrimFilterFactory */ public TrimFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TruncateTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TruncateTokenFilterFactory.java index 83800cdbef3..1c37d1e92ad 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TruncateTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TruncateTokenFilterFactory.java @@ -37,9 +37,13 @@ import java.util.Map; * </analyzer> * </fieldType> * @since 4.8.0 + * @lucene.spi {@value #NAME} */ public class TruncateTokenFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "truncate"; + public static final String PREFIX_LENGTH_KEY = "prefixLength"; private final byte prefixLength; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TypeAsSynonymFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TypeAsSynonymFilterFactory.java index 84878779d7c..8dc0c462fca 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TypeAsSynonymFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/TypeAsSynonymFilterFactory.java @@ -38,8 +38,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * the emitted synonym will have text "_type_<URL>". * * @since 7.3.0 + * @lucene.spi {@value #NAME} */ public class TypeAsSynonymFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "typeAsSynonym"; + private final String prefix; public TypeAsSynonymFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java index 8e29ac26dac..3cd13e4601d 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java @@ -54,9 +54,14 @@ import static org.apache.lucene.analysis.miscellaneous.WordDelimiterFilter.*; * the search time analyzer. * * @since 3.1 + * @lucene.spi {@value #NAME} */ @Deprecated public class WordDelimiterFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "wordDelimiter"; + public static final String PROTECTED_TOKENS = "protected"; public static final String TYPES = "types"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterGraphFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterGraphFilterFactory.java index 4666c7d3682..7b936f6a477 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterGraphFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterGraphFilterFactory.java @@ -49,8 +49,13 @@ import static org.apache.lucene.analysis.miscellaneous.WordDelimiterIterator.*; * </analyzer> * </fieldType> * @since 6.5.0 + * @lucene.spi {@value #NAME} */ public class WordDelimiterGraphFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "wordDelimiterGraph"; + public static final String PROTECTED_TOKENS = "protected"; public static final String TYPES = "types"; public static final String OFFSETS = "adjustOffsets"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramFilterFactory.java index efabafb4cf0..6b02208c37c 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramFilterFactory.java @@ -34,8 +34,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class EdgeNGramFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "edgeNGram"; + private final int maxGramSize; private final int minGramSize; private final boolean preserveOriginal; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerFactory.java index 4cc3d2f6aed..4ba1a475890 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerFactory.java @@ -33,8 +33,13 @@ import java.util.Map; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class EdgeNGramTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "edgeNGram"; + private final int maxGramSize; private final int minGramSize; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramFilterFactory.java index a04a1076d30..3c9c4d27fa4 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramFilterFactory.java @@ -34,8 +34,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class NGramFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "nGram"; + private final int maxGramSize; private final int minGramSize; private final boolean preserveOriginal; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizerFactory.java index b6c55ba8504..12d60d79e23 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizerFactory.java @@ -35,8 +35,13 @@ import java.util.Map; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class NGramTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "nGram"; + private final int maxGramSize; private final int minGramSize; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/no/NorwegianLightStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/no/NorwegianLightStemFilterFactory.java index 5f6be56829a..b4f54e3944f 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/no/NorwegianLightStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/no/NorwegianLightStemFilterFactory.java @@ -36,8 +36,12 @@ import static org.apache.lucene.analysis.no.NorwegianLightStemmer.NYNORSK; * </analyzer> * </fieldType> * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class NorwegianLightStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "norwegianLightStem"; private final int flags; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/no/NorwegianMinimalStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/no/NorwegianMinimalStemFilterFactory.java index 03d5090a318..d07ad476a5e 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/no/NorwegianMinimalStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/no/NorwegianMinimalStemFilterFactory.java @@ -36,8 +36,12 @@ import static org.apache.lucene.analysis.no.NorwegianLightStemmer.NYNORSK; * </analyzer> * </fieldType> * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class NorwegianMinimalStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "norwegianMinimalStem"; private final int flags; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/path/PathHierarchyTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/path/PathHierarchyTokenizerFactory.java index aebd6bd309c..cbe30927464 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/path/PathHierarchyTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/path/PathHierarchyTokenizerFactory.java @@ -68,8 +68,13 @@ import org.apache.lucene.util.AttributeFactory; * * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class PathHierarchyTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "pathHierarchy"; + private final char delimiter; private final char replacement; private final boolean reverse; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternCaptureGroupFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternCaptureGroupFilterFactory.java index d0df49b60d5..20ce2f64e5c 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternCaptureGroupFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternCaptureGroupFilterFactory.java @@ -35,8 +35,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * * @see PatternCaptureGroupTokenFilter * @since 4.4.0 + * @lucene.spi {@value #NAME} */ public class PatternCaptureGroupFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "patternCaptureGroup"; + private Pattern pattern; private boolean preserveOriginal = true; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceCharFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceCharFilterFactory.java index 6b71c763512..99b5ae8d66c 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceCharFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceCharFilterFactory.java @@ -35,8 +35,13 @@ import org.apache.lucene.analysis.util.CharFilterFactory; * </fieldType> * * @since Solr 3.1 + * @lucene.spi {@value #NAME} */ public class PatternReplaceCharFilterFactory extends CharFilterFactory { + + /** SPI name */ + public static final String NAME = "patternReplace"; + private final Pattern pattern; private final String replacement; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceFilterFactory.java index 8c4572ca8e5..03d66429a43 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternReplaceFilterFactory.java @@ -38,8 +38,13 @@ import java.util.regex.Pattern; * @see PatternReplaceFilter * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class PatternReplaceFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "patternReplace"; + final Pattern pattern; final String replacement; final boolean replaceAll; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternTokenizerFactory.java index b919daed550..2a79482830a 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/PatternTokenizerFactory.java @@ -57,8 +57,13 @@ import org.apache.lucene.util.AttributeFactory; * * @see PatternTokenizer * @since solr1.2 + * @lucene.spi {@value #NAME} */ public class PatternTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "pattern"; + public static final String PATTERN = "pattern"; public static final String GROUP = "group"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/SimplePatternSplitTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/SimplePatternSplitTokenizerFactory.java index 200a975c82a..5518ed842c2 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/SimplePatternSplitTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/SimplePatternSplitTokenizerFactory.java @@ -55,8 +55,13 @@ import org.apache.lucene.util.automaton.RegExp; * @see SimplePatternSplitTokenizer * * @since 6.5.0 + * @lucene.spi {@value #NAME} */ public class SimplePatternSplitTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "simplePatternSplit"; + public static final String PATTERN = "pattern"; private final Automaton dfa; private final int maxDeterminizedStates; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/SimplePatternTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/SimplePatternTokenizerFactory.java index 5c73ad8d8ee..b605115029d 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/SimplePatternTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pattern/SimplePatternTokenizerFactory.java @@ -55,8 +55,13 @@ import org.apache.lucene.util.automaton.RegExp; * @see SimplePatternTokenizer * * @since 6.5.0 + * @lucene.spi {@value #NAME} */ public class SimplePatternTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "simplePattern"; + public static final String PATTERN = "pattern"; private final Automaton dfa; private final int maxDeterminizedStates; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/DelimitedPayloadTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/DelimitedPayloadTokenFilterFactory.java index f0bcd027220..f55293ce464 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/DelimitedPayloadTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/DelimitedPayloadTokenFilterFactory.java @@ -35,8 +35,13 @@ import java.util.Map; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class DelimitedPayloadTokenFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "delimitedPayload"; + public static final String ENCODER_ATTR = "encoder"; public static final String DELIMITER_ATTR = "delimiter"; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterFactory.java index 0d3a23fa143..be2ad6ca8ac 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterFactory.java @@ -32,8 +32,13 @@ import java.util.Map; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class NumericPayloadTokenFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "numericPayload"; + private final float payload; private final String typeMatch; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterFactory.java index 1836f969333..5518eff762c 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class TokenOffsetPayloadTokenFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "tokenOffsetPayload"; /** Creates a new TokenOffsetPayloadTokenFilterFactory */ public TokenOffsetPayloadTokenFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterFactory.java index 5209758ac64..016176db2f4 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class TypeAsPayloadTokenFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "typeAsPayload"; /** Creates a new TypeAsPayloadTokenFilterFactory */ public TypeAsPayloadTokenFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseLightStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseLightStemFilterFactory.java index 10601791c0d..8bfca4cae4e 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseLightStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseLightStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class PortugueseLightStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "portugueseLightStem"; /** Creates a new PortugueseLightStemFilterFactory */ public PortugueseLightStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseMinimalStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseMinimalStemFilterFactory.java index 15b4fd08dc4..cab3174a402 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseMinimalStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseMinimalStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class PortugueseMinimalStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "portugueseMinimalStem"; /** Creates a new PortugueseMinimalStemFilterFactory */ public PortugueseMinimalStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseStemFilterFactory.java index c9e082fba2e..cbdf1dd64c7 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class PortugueseStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "portugueseStem"; /** Creates a new PortugueseStemFilterFactory */ public PortugueseStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/reverse/ReverseStringFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/reverse/ReverseStringFilterFactory.java index f186b954444..c51018d9509 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/reverse/ReverseStringFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/reverse/ReverseStringFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since solr 1.4 + * @lucene.spi {@value #NAME} */ public class ReverseStringFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "reverseString"; /** Creates a new ReverseStringFilterFactory */ public ReverseStringFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ru/RussianLightStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ru/RussianLightStemFilterFactory.java index 64769a39091..673db07aa67 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ru/RussianLightStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ru/RussianLightStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class RussianLightStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "russianLightStem"; /** Creates a new RussianLightStemFilterFactory */ public RussianLightStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/FixedShingleFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/FixedShingleFilterFactory.java index 0176d1c2753..83ae48530cf 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/FixedShingleFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/FixedShingleFilterFactory.java @@ -33,9 +33,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * * * @since 7.4.0 + * @lucene.spi {@value #NAME} */ public class FixedShingleFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "fixedShingle"; + private final int shingleSize; private final String tokenSeparator; private final String fillerToken; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/ShingleFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/ShingleFilterFactory.java index 3c86e9b5b54..612a5d9715a 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/ShingleFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/shingle/ShingleFilterFactory.java @@ -34,8 +34,13 @@ import java.util.Map; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class ShingleFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "shingle"; + private final int minShingleSize; private final int maxShingleSize; private final boolean outputUnigrams; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/snowball/SnowballPorterFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/snowball/SnowballPorterFilterFactory.java index 181f7adb43a..f61d73268c6 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/snowball/SnowballPorterFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/snowball/SnowballPorterFilterFactory.java @@ -43,8 +43,13 @@ import org.tartarus.snowball.SnowballProgram; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class SnowballPorterFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "snowballPorter"; + public static final String PROTECTED_TOKENS = "protected"; private final String language; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/sr/SerbianNormalizationFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/sr/SerbianNormalizationFilterFactory.java index c47d4714ffc..e2f87ca307b 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/sr/SerbianNormalizationFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/sr/SerbianNormalizationFilterFactory.java @@ -35,8 +35,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 5.0.0 + * @lucene.spi {@value #NAME} */ public class SerbianNormalizationFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "serbianNormalization"; + final String haircut; /** Creates a new SerbianNormalizationFilterFactory */ diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicFilterFactory.java index a81dcd61445..2eff55c66d4 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class ClassicFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "classic"; /** Creates a new ClassicFilterFactory */ public ClassicFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicTokenizerFactory.java index 04c1fd6bfc0..83ac4d5e8d0 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicTokenizerFactory.java @@ -32,8 +32,13 @@ import java.util.Map; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class ClassicTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "classic"; + private final int maxTokenLength; /** Creates a new ClassicTokenizerFactory */ diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/StandardTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/StandardTokenizerFactory.java index 74467a279e1..2866bae70dd 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/StandardTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/StandardTokenizerFactory.java @@ -32,8 +32,13 @@ import java.util.Map; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class StandardTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "standard"; + private final int maxTokenLength; /** Creates a new StandardTokenizerFactory */ diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/UAX29URLEmailTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/UAX29URLEmailTokenizerFactory.java index 526f5f6af77..250fd14f05b 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/UAX29URLEmailTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/UAX29URLEmailTokenizerFactory.java @@ -32,8 +32,13 @@ import java.util.Map; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class UAX29URLEmailTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "uaX29UrlEmail"; + private final int maxTokenLength; /** Creates a new UAX29URLEmailTokenizerFactory */ diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/sv/SwedishLightStemFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/sv/SwedishLightStemFilterFactory.java index c7eb11978d9..dd9bb9a12d3 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/sv/SwedishLightStemFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/sv/SwedishLightStemFilterFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class SwedishLightStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "swedishLightStem"; /** Creates a new SwedishLightStemFilterFactory */ public SwedishLightStemFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymFilterFactory.java index b0addcf8dae..c9e575af32e 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymFilterFactory.java @@ -78,9 +78,14 @@ import org.apache.lucene.analysis.util.TokenizerFactory; * use {@link FlattenGraphFilterFactory} at index time (not at search time) as well. * * @since 3.1 + * @lucene.spi {@value #NAME} */ @Deprecated public class SynonymFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "synonym"; + private final boolean ignoreCase; private final String tokenizerFactory; private final String synonyms; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymGraphFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymGraphFilterFactory.java index 4fe68bc3cd9..f94f6877087 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymGraphFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymGraphFilterFactory.java @@ -74,8 +74,13 @@ import org.apache.lucene.analysis.util.TokenizerFactory; * * @lucene.experimental * @since 6.4.0 + * @lucene.spi {@value #NAME} */ public class SynonymGraphFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "synonymGraph"; + private final boolean ignoreCase; private final String tokenizerFactory; private final String synonyms; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/th/ThaiTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/th/ThaiTokenizerFactory.java index 04c91e77c5e..f798d154f06 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/th/ThaiTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/th/ThaiTokenizerFactory.java @@ -33,8 +33,12 @@ import org.apache.lucene.util.AttributeFactory; * </fieldType> * * @since 4.10.0 + * @lucene.spi {@value #NAME} */ public class ThaiTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "thai"; /** Creates a new ThaiTokenizerFactory */ public ThaiTokenizerFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/ApostropheFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/ApostropheFilterFactory.java index 47161ae5c2c..65439784404 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/ApostropheFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/ApostropheFilterFactory.java @@ -33,9 +33,13 @@ import java.util.Map; * </analyzer> * </fieldType> * @since 4.8.0 + * @lucene.spi {@value #NAME} */ public class ApostropheFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "apostrophe"; + public ApostropheFilterFactory(Map args) { super(args); if (!args.isEmpty()) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/TurkishLowerCaseFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/TurkishLowerCaseFilterFactory.java index be43d343b7a..d5152b6f039 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/TurkishLowerCaseFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/TurkishLowerCaseFilterFactory.java @@ -32,8 +32,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class TurkishLowerCaseFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "turkishLowerCase"; /** Creates a new TurkishLowerCaseFilterFactory */ public TurkishLowerCaseFilterFactory(Map args) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/AnalysisSPILoader.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/AnalysisSPILoader.java index 13f5028e9ec..8e79c3e107b 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/AnalysisSPILoader.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/AnalysisSPILoader.java @@ -17,15 +17,18 @@ package org.apache.lucene.analysis.util; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; -import java.util.Arrays; +import java.lang.reflect.Modifier; import java.util.Collections; +import java.util.LinkedHashSet; import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.LinkedHashMap; import java.util.Set; import java.util.ServiceConfigurationError; +import java.util.regex.Pattern; import org.apache.lucene.util.SPIClassIterator; @@ -36,24 +39,17 @@ import org.apache.lucene.util.SPIClassIterator; public final class AnalysisSPILoader { private volatile Map> services = Collections.emptyMap(); + private volatile Set originalNames = Collections.emptySet(); private final Class clazz; - private final String[] suffixes; - + + private static final Pattern SERVICE_NAME_PATTERN = Pattern.compile("^[a-zA-Z][a-zA-Z0-9_]+$"); + public AnalysisSPILoader(Class clazz) { - this(clazz, new String[] { clazz.getSimpleName() }); + this(clazz, null); } - public AnalysisSPILoader(Class clazz, ClassLoader loader) { - this(clazz, new String[] { clazz.getSimpleName() }, loader); - } - - public AnalysisSPILoader(Class clazz, String[] suffixes) { - this(clazz, suffixes, null); - } - - public AnalysisSPILoader(Class clazz, String[] suffixes, ClassLoader classloader) { + public AnalysisSPILoader(Class clazz, ClassLoader classloader) { this.clazz = clazz; - this.suffixes = suffixes; // if clazz' classloader is not a parent of the given one, we scan clazz's classloader, too: final ClassLoader clazzClassloader = clazz.getClassLoader(); if (classloader == null) { @@ -64,7 +60,7 @@ public final class AnalysisSPILoader { } reload(classloader); } - + /** * Reloads the internal SPI list from the given {@link ClassLoader}. * Changes to the service list are visible after the method ends, all @@ -78,22 +74,35 @@ public final class AnalysisSPILoader { */ public synchronized void reload(ClassLoader classloader) { Objects.requireNonNull(classloader, "classloader"); - final LinkedHashMap> services = - new LinkedHashMap<>(this.services); + final LinkedHashMap> services = new LinkedHashMap<>(this.services); + final LinkedHashSet originalNames = new LinkedHashSet<>(this.originalNames); final SPIClassIterator loader = SPIClassIterator.get(clazz, classloader); while (loader.hasNext()) { final Class service = loader.next(); - final String clazzName = service.getSimpleName(); String name = null; - for (String suffix : suffixes) { - if (clazzName.endsWith(suffix)) { - name = clazzName.substring(0, clazzName.length() - suffix.length()).toLowerCase(Locale.ROOT); - break; + String originalName = null; + Throwable cause = null; + try { + // Lookup "NAME" field with appropriate modifiers. + // Also it must be a String class and declared in the service class. + final Field field = service.getField("NAME"); + int modifier = field.getModifiers(); + if (Modifier.isStatic(modifier) && Modifier.isFinal(modifier) && + field.getType().equals(String.class) && + Objects.equals(field.getDeclaringClass(), service)) { + originalName = ((String)field.get(null)); + name = originalName.toLowerCase(Locale.ROOT); + if (!isValidName(originalName)) { + throw new ServiceConfigurationError("The name " + originalName + " for " + service.getName() + + " is invalid: Allowed characters are (English) alphabet, digits, and underscore. It should be started with an alphabet."); + } } + } catch (NoSuchFieldException | IllegalAccessException e) { + cause = e; } if (name == null) { throw new ServiceConfigurationError("The class name " + service.getName() + - " has wrong suffix, allowed are: " + Arrays.toString(suffixes)); + " has no service name field: [public static final String NAME]", cause); } // only add the first one for each name, later services will be ignored // this allows to place services before others in classpath to make @@ -105,11 +114,26 @@ public final class AnalysisSPILoader { // When changing this be careful to allow reload()! if (!services.containsKey(name)) { services.put(name, service); + // preserve (case-sensitive) original name for reference + originalNames.add(originalName); } } - this.services = Collections.unmodifiableMap(services); + + // make sure that the number of lookup keys is same to the number of original names. + // in fact this constraint should be met in existence checks of the lookup map key, + // so this is more like an assertion rather than a status check. + if (services.keySet().size() != originalNames.size()) { + throw new ServiceConfigurationError("Service lookup key set is inconsistent with original name set!"); + } + + this.services = Map.copyOf(services); + this.originalNames = Set.copyOf(originalNames); } - + + private boolean isValidName(String name) { + return SERVICE_NAME_PATTERN.matcher(name).matches(); + } + public S newInstance(String name, Map args) { final Class service = lookupClass(name); return newFactoryClassInstance(service, args); @@ -127,7 +151,7 @@ public final class AnalysisSPILoader { } public Set availableServices() { - return services.keySet(); + return originalNames; } /** Creates a new instance of the given {@link AbstractAnalysisFactory} by invoking the constructor, passing the given argument map. */ diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ElisionFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ElisionFilterFactory.java index 3e67c3c1fad..ee4e9eeaac2 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ElisionFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ElisionFilterFactory.java @@ -37,8 +37,13 @@ import org.apache.lucene.analysis.fr.FrenchAnalyzer; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class ElisionFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "elision"; + private final String articlesFile; private final boolean ignoreCase; private CharArraySet articles; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/TokenFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/TokenFilterFactory.java index f18b4de062f..72c407094b8 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/TokenFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/TokenFilterFactory.java @@ -31,9 +31,8 @@ import org.apache.lucene.analysis.TokenStream; public abstract class TokenFilterFactory extends AbstractAnalysisFactory { private static final AnalysisSPILoader loader = - new AnalysisSPILoader<>(TokenFilterFactory.class, - new String[] { "TokenFilterFactory", "FilterFactory" }); - + new AnalysisSPILoader<>(TokenFilterFactory.class); + /** looks up a tokenfilter by name from context classpath */ public static TokenFilterFactory forName(String name, Map args) { return loader.newInstance(name, args); diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/wikipedia/WikipediaTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/wikipedia/WikipediaTokenizerFactory.java index e9833af50e9..b2cedb6a5c5 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/wikipedia/WikipediaTokenizerFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/wikipedia/WikipediaTokenizerFactory.java @@ -33,8 +33,13 @@ import org.apache.lucene.util.AttributeFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class WikipediaTokenizerFactory extends TokenizerFactory { + + /** SPI name */ + public static final String NAME = "wikipedia"; + public static final String TOKEN_OUTPUT = "tokenOutput"; public static final String UNTOKENIZED_TYPES = "untokenizedTypes"; diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestAnalysisSPILoader.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestAnalysisSPILoader.java index 098b98b0410..2398c1e822c 100644 --- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestAnalysisSPILoader.java +++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestAnalysisSPILoader.java @@ -30,7 +30,7 @@ import org.apache.lucene.util.Version; public class TestAnalysisSPILoader extends LuceneTestCase { private Map versionArgOnly() { - return new HashMap() {{ + return new HashMap() {{ put("luceneMatchVersion", Version.LATEST.toString()); }}; } @@ -113,7 +113,7 @@ public class TestAnalysisSPILoader extends LuceneTestCase { public void testAvailableTokenFilters() { assertTrue(TokenFilterFactory.availableTokenFilters().contains("lowercase")); - assertTrue(TokenFilterFactory.availableTokenFilters().contains("removeduplicates")); + assertTrue(TokenFilterFactory.availableTokenFilters().contains("removeDuplicates")); } public void testLookupCharFilter() { @@ -149,6 +149,6 @@ public class TestAnalysisSPILoader extends LuceneTestCase { } public void testAvailableCharFilters() { - assertTrue(CharFilterFactory.availableCharFilters().contains("htmlstrip")); + assertTrue(CharFilterFactory.availableCharFilters().contains("htmlStrip")); } } diff --git a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUFoldingFilterFactory.java b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUFoldingFilterFactory.java index 8825c665ebb..b6e7df2fcf0 100644 --- a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUFoldingFilterFactory.java +++ b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUFoldingFilterFactory.java @@ -35,8 +35,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class ICUFoldingFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "icuFolding"; + private final Normalizer2 normalizer; /** Creates a new ICUFoldingFilterFactory */ diff --git a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUNormalizer2CharFilterFactory.java b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUNormalizer2CharFilterFactory.java index 57a8ee16ad5..8a4db89c971 100644 --- a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUNormalizer2CharFilterFactory.java +++ b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUNormalizer2CharFilterFactory.java @@ -43,8 +43,13 @@ import org.apache.lucene.analysis.util.CharFilterFactory; * @see FilteredNormalizer2 * * @since 4.10.0 + * @lucene.spi {@value #NAME} */ public class ICUNormalizer2CharFilterFactory extends CharFilterFactory { + + /** SPI name */ + public static final String NAME = "icuNormalizer2"; + private final Normalizer2 normalizer; /** Creates a new ICUNormalizer2CharFilterFactory */ diff --git a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUNormalizer2FilterFactory.java b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUNormalizer2FilterFactory.java index 93b9f40672b..d4e1ecd644a 100644 --- a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUNormalizer2FilterFactory.java +++ b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUNormalizer2FilterFactory.java @@ -42,8 +42,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * @see Normalizer2 * @see FilteredNormalizer2 * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class ICUNormalizer2FilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "icuNormalizer2"; + private final Normalizer2 normalizer; /** Creates a new ICUNormalizer2FilterFactory */ diff --git a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUTransformFilterFactory.java b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUTransformFilterFactory.java index b70d477bd89..b2b24dda97e 100644 --- a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUTransformFilterFactory.java +++ b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/ICUTransformFilterFactory.java @@ -34,8 +34,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * * @see Transliterator * @since 3.1.0 + * @lucene.spi {@value #NAME} */ public class ICUTransformFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "icuTransform"; + private final Transliterator transliterator; // TODO: add support for custom rules diff --git a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/ICUTokenizerFactory.java b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/ICUTokenizerFactory.java index b57117ee10b..b2e3446b5ca 100644 --- a/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/ICUTokenizerFactory.java +++ b/lucene/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/ICUTokenizerFactory.java @@ -74,8 +74,13 @@ import com.ibm.icu.text.RuleBasedBreakIterator; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class ICUTokenizerFactory extends TokenizerFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "icu"; + static final String RULEFILES = "rulefiles"; private final Map tailored; private ICUTokenizerConfig config; diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseBaseFormFilterFactory.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseBaseFormFilterFactory.java index 504953b28b9..5d59b110065 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseBaseFormFilterFactory.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseBaseFormFilterFactory.java @@ -33,9 +33,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class JapaneseBaseFormFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "japaneseBaseForm"; + /** Creates a new JapaneseBaseFormFilterFactory */ public JapaneseBaseFormFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseIterationMarkCharFilterFactory.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseIterationMarkCharFilterFactory.java index 568989acc28..c865a733236 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseIterationMarkCharFilterFactory.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseIterationMarkCharFilterFactory.java @@ -33,9 +33,13 @@ import org.apache.lucene.analysis.util.CharFilterFactory; * </fieldType> * * @since 4.0.0 + * @lucene.spi {@value #NAME} */ public class JapaneseIterationMarkCharFilterFactory extends CharFilterFactory { + /** SPI name */ + public static final String NAME = "japaneseIterationMark"; + private static final String NORMALIZE_KANJI_PARAM = "normalizeKanji"; private static final String NORMALIZE_KANA_PARAM = "normalizeKana"; diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseKatakanaStemFilterFactory.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseKatakanaStemFilterFactory.java index d5b240b8a0a..7ba5df92072 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseKatakanaStemFilterFactory.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseKatakanaStemFilterFactory.java @@ -34,8 +34,13 @@ import java.util.Map; * </fieldType> * * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class JapaneseKatakanaStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "japaneseKatakanaStem"; + private static final String MINIMUM_LENGTH_PARAM = "minimumLength"; private final int minimumLength; diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseNumberFilterFactory.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseNumberFilterFactory.java index 471f6cbd033..2584266a22e 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseNumberFilterFactory.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseNumberFilterFactory.java @@ -37,9 +37,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * It is important that punctuation is not discarded by the tokenizer so use * {@code discardPunctuation="false"} in your {@link JapaneseTokenizerFactory}. * @since 6.0.0 + * @lucene.spi {@value #NAME} */ public class JapaneseNumberFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "japaneseNumber"; + public JapaneseNumberFilterFactory(Map args) { super(args); if (!args.isEmpty()) { diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapanesePartOfSpeechStopFilterFactory.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapanesePartOfSpeechStopFilterFactory.java index 059457f65f1..6ca368fd9ef 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapanesePartOfSpeechStopFilterFactory.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapanesePartOfSpeechStopFilterFactory.java @@ -40,8 +40,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class JapanesePartOfSpeechStopFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + public static final String NAME = "japanesePartOfSpeechStop"; + private final String stopTagFiles; private Set stopTags; diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseReadingFormFilterFactory.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseReadingFormFilterFactory.java index 082eae8c248..f23aac7f589 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseReadingFormFilterFactory.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseReadingFormFilterFactory.java @@ -34,8 +34,13 @@ import java.util.Map; * </fieldType> * * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class JapaneseReadingFormFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "japaneseReadingForm"; + private static final String ROMAJI_PARAM = "useRomaji"; private final boolean useRomaji; diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizerFactory.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizerFactory.java index a45b3c158bf..1eaecd7c5b7 100644 --- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizerFactory.java +++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizerFactory.java @@ -78,8 +78,13 @@ import org.apache.lucene.analysis.util.ResourceLoaderAware; * modes, but it makes the most sense to use them with NORMAL mode. * * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class JapaneseTokenizerFactory extends TokenizerFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "japanese"; + private static final String MODE = "mode"; private static final String USER_DICT_PATH = "userDictionary"; diff --git a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilterFactory.java b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilterFactory.java index 4afc370a80f..8b2841cc9f2 100644 --- a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilterFactory.java +++ b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilterFactory.java @@ -49,8 +49,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * * @see Morfologik web site * @since 4.0.0 + * @lucene.spi {@value #NAME} */ public class MorfologikFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "morfologik"; + /** Dictionary resource attribute (should have {@code ".dict"} suffix), loaded from {@link ResourceLoader}. */ public static final String DICTIONARY_ATTRIBUTE = "dictionary"; diff --git a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanPartOfSpeechStopFilterFactory.java b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanPartOfSpeechStopFilterFactory.java index b79ecaced28..c60848f2d44 100644 --- a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanPartOfSpeechStopFilterFactory.java +++ b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanPartOfSpeechStopFilterFactory.java @@ -43,8 +43,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * @lucene.experimental * * @since 7.4.0 + * @lucene.spi {@value #NAME} */ public class KoreanPartOfSpeechStopFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "koreanPartOfSpeechStop"; + private Set stopTags; /** Creates a new KoreanPartOfSpeechStopFilterFactory */ diff --git a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanReadingFormFilterFactory.java b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanReadingFormFilterFactory.java index 2225a1d2b5a..1a08df123c4 100644 --- a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanReadingFormFilterFactory.java +++ b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanReadingFormFilterFactory.java @@ -34,9 +34,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * @lucene.experimental * * @since 7.4.0 + * @lucene.spi {@value #NAME} */ public class KoreanReadingFormFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "koreanReadingForm"; + /** Creates a new KoreanReadingFilterFactory */ public KoreanReadingFormFilterFactory(Map args) { super(args); diff --git a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanTokenizerFactory.java b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanTokenizerFactory.java index f722273684a..f63922ddaba 100644 --- a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanTokenizerFactory.java +++ b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanTokenizerFactory.java @@ -62,8 +62,13 @@ import org.apache.lucene.analysis.ko.KoreanTokenizer.DecompoundMode; * @lucene.experimental * * @since 7.4.0 + * @lucene.spi {@value #NAME} */ public class KoreanTokenizerFactory extends TokenizerFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "korean"; + private static final String USER_DICT_PATH = "userDictionary"; private static final String USER_DICT_ENCODING = "userDictionaryEncoding"; private static final String DECOMPOUND_MODE = "decompoundMode"; diff --git a/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPChunkerFilterFactory.java b/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPChunkerFilterFactory.java index 96eb6724524..b723c7a3d86 100644 --- a/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPChunkerFilterFactory.java +++ b/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPChunkerFilterFactory.java @@ -39,8 +39,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 7.3.0 + * @lucene.spi {@value #NAME} */ public class OpenNLPChunkerFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "openNlpChunker"; + public static final String CHUNKER_MODEL = "chunkerModel"; private final String chunkerModelFile; diff --git a/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPLemmatizerFilterFactory.java b/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPLemmatizerFilterFactory.java index 90a0e43cade..bb2aa0fa61d 100644 --- a/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPLemmatizerFilterFactory.java +++ b/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPLemmatizerFilterFactory.java @@ -43,8 +43,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 7.3.0 + * @lucene.spi {@value #NAME} */ public class OpenNLPLemmatizerFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "openNlpLemmatizer"; + public static final String DICTIONARY = "dictionary"; public static final String LEMMATIZER_MODEL = "lemmatizerModel"; diff --git a/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPPOSFilterFactory.java b/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPPOSFilterFactory.java index 952218f533c..873f005a00e 100644 --- a/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPPOSFilterFactory.java +++ b/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPPOSFilterFactory.java @@ -37,8 +37,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 7.3.0 + * @lucene.spi {@value #NAME} */ public class OpenNLPPOSFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "openNlppos"; + public static final String POS_TAGGER_MODEL = "posTaggerModel"; private final String posTaggerModelFile; diff --git a/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPTokenizerFactory.java b/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPTokenizerFactory.java index a60f23f6bdb..1e46083bb2d 100644 --- a/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPTokenizerFactory.java +++ b/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPTokenizerFactory.java @@ -38,8 +38,13 @@ import org.apache.lucene.util.AttributeFactory; * </analyzer> * </fieldType> * @since 7.3.0 + * @lucene.spi {@value #NAME} */ public class OpenNLPTokenizerFactory extends TokenizerFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "openNlp"; + public static final String SENTENCE_MODEL = "sentenceModel"; public static final String TOKENIZER_MODEL = "tokenizerModel"; diff --git a/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/BeiderMorseFilterFactory.java b/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/BeiderMorseFilterFactory.java index d13e052daa0..566f86c546c 100644 --- a/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/BeiderMorseFilterFactory.java +++ b/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/BeiderMorseFilterFactory.java @@ -40,8 +40,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </analyzer> * </fieldType> * @since 3.6.0 + * @lucene.spi {@value #NAME} */ public class BeiderMorseFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "beiderMorse"; + private final PhoneticEngine engine; private final LanguageSet languageSet; diff --git a/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/DaitchMokotoffSoundexFilterFactory.java b/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/DaitchMokotoffSoundexFilterFactory.java index a304324b90e..59310384fda 100644 --- a/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/DaitchMokotoffSoundexFilterFactory.java +++ b/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/DaitchMokotoffSoundexFilterFactory.java @@ -43,8 +43,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * * @lucene.experimental * @since 5.0.0 + * @lucene.spi {@value #NAME} */ public class DaitchMokotoffSoundexFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "daitchMokotoffSoundex"; + /** parameter name: true if encoded tokens should be added as synonyms */ public static final String INJECT = "inject"; // boolean diff --git a/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/DoubleMetaphoneFilterFactory.java b/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/DoubleMetaphoneFilterFactory.java index 112944a6f7f..c261743cff3 100644 --- a/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/DoubleMetaphoneFilterFactory.java +++ b/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/DoubleMetaphoneFilterFactory.java @@ -33,9 +33,14 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class DoubleMetaphoneFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "doubleMetaphone"; + /** parameter name: true if encoded tokens should be added as synonyms */ public static final String INJECT = "inject"; /** parameter name: restricts the length of the phonetic code */ diff --git a/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/PhoneticFilterFactory.java b/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/PhoneticFilterFactory.java index e580d6e15e1..8d5ae5ac188 100644 --- a/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/PhoneticFilterFactory.java +++ b/lucene/analysis/phonetic/src/java/org/apache/lucene/analysis/phonetic/PhoneticFilterFactory.java @@ -64,8 +64,13 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * @see PhoneticFilter * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class PhoneticFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "phonetic"; + /** parameter name: either a short name or a full class name */ public static final String ENCODER = "encoder"; /** parameter name: true if encoded tokens should be added as synonyms */ diff --git a/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/HMMChineseTokenizerFactory.java b/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/HMMChineseTokenizerFactory.java index 5d30459141b..545f27c4d27 100644 --- a/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/HMMChineseTokenizerFactory.java +++ b/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/HMMChineseTokenizerFactory.java @@ -32,9 +32,13 @@ import org.apache.lucene.util.AttributeFactory; * @lucene.experimental * * @since 4.10.0 + * @lucene.spi {@value #NAME} */ public final class HMMChineseTokenizerFactory extends TokenizerFactory { + /** SPI name */ + public static final String NAME = "hmmChinese"; + /** Creates a new HMMChineseTokenizerFactory */ public HMMChineseTokenizerFactory(Map args) { super(args); diff --git a/lucene/analysis/stempel/src/java/org/apache/lucene/analysis/stempel/StempelPolishStemFilterFactory.java b/lucene/analysis/stempel/src/java/org/apache/lucene/analysis/stempel/StempelPolishStemFilterFactory.java index 3b6e28603f7..c3d6f0c87aa 100644 --- a/lucene/analysis/stempel/src/java/org/apache/lucene/analysis/stempel/StempelPolishStemFilterFactory.java +++ b/lucene/analysis/stempel/src/java/org/apache/lucene/analysis/stempel/StempelPolishStemFilterFactory.java @@ -26,8 +26,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; /** * Factory for {@link StempelFilter} using a Polish stemming table. * @since 3.1.0 + * @lucene.spi {@value #NAME} */ -public class StempelPolishStemFilterFactory extends TokenFilterFactory { +public class StempelPolishStemFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "stempelPolishStem"; /** Creates a new StempelPolishStemFilterFactory */ public StempelPolishStemFilterFactory(Map args) { diff --git a/lucene/common-build.xml b/lucene/common-build.xml index 22620503e5b..ff2ad425a92 100644 --- a/lucene/common-build.xml +++ b/lucene/common-build.xml @@ -2119,6 +2119,8 @@ ${ant.project.name}.test.dependencies=${test.classpath.list} description="WARNING: This API is experimental and might change in incompatible ways in the next release."/> + * * @since 5.0.0 + * @lucene.spi {@value #NAME} */ - public class SuggestStopFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { +public class SuggestStopFilterFactory extends TokenFilterFactory implements ResourceLoaderAware { + + /** SPI name */ + public static final String NAME = "suggestStop"; + /** the default format, one word per line, whole line comments start with "#" */ public static final String FORMAT_WORDSET = "wordset"; /** multiple words may be specified on each line, trailing comments start with "|" */ diff --git a/lucene/tools/src/groovy/check-source-patterns.groovy b/lucene/tools/src/groovy/check-source-patterns.groovy index ccfcc493a42..779496331e3 100644 --- a/lucene/tools/src/groovy/check-source-patterns.groovy +++ b/lucene/tools/src/groovy/check-source-patterns.groovy @@ -75,6 +75,7 @@ def blockBoundaryPattern = ~$/----\s*/$; def blockTitlePattern = ~$/\..*/$; def unescapedSymbolPattern = ~$/(?<=[^\\]|^)([-=]>|<[-=])/$; // SOLR-10883 def extendsLuceneTestCasePattern = ~$/public.*?class.*?extends.*?LuceneTestCase[^\n]*?\n/$; +def validSPINameJavadocTag = ~$/(?s)\s*\*\s*@lucene\.spi\s+\{@value #NAME\}/$; def isLicense = { matcher, ratDocument -> licenseMatcher.reset(); @@ -177,6 +178,16 @@ ant.fileScanner{ reportViolation(f, 'invalid logger name [log, uses static class name, not specialized logger]') } } + // make sure that SPI names of all tokenizers/charfilters/tokenfilters are documented + if (!f.name.contains("Test") && !f.name.contains("Mock") && !text.contains("abstract class") && + !f.name.equals("TokenizerFactory.java") && !f.name.equals("CharFilterFactory.java") && !f.name.equals("TokenFilterFactory.java") && + (f.name.contains("TokenizerFactory") && text.contains("extends TokenizerFactory") || + f.name.contains("CharFilterFactory") && text.contains("extends CharFilterFactory") || + f.name.contains("FilterFactory") && text.contains("extends TokenFilterFactory"))) { + if (!validSPINameJavadocTag.matcher(text).find()) { + reportViolation(f, 'invalid spi name documentation') + } + } checkLicenseHeaderPrecedes(f, 'package', packagePattern, javaCommentPattern, text, ratDocument); if (f.name.contains("Test")) { checkMockitoAssume(f, text); diff --git a/solr/core/src/java/org/apache/solr/analysis/LowerCaseTokenizerFactory.java b/solr/core/src/java/org/apache/solr/analysis/LowerCaseTokenizerFactory.java index 953d04685b3..4f14a7f40c4 100644 --- a/solr/core/src/java/org/apache/solr/analysis/LowerCaseTokenizerFactory.java +++ b/solr/core/src/java/org/apache/solr/analysis/LowerCaseTokenizerFactory.java @@ -41,10 +41,14 @@ import static org.apache.lucene.analysis.standard.StandardTokenizer.MAX_TOKEN_LE * else {@link CharTokenizer}::DEFAULT_MAX_WORD_LEN * * @deprecated Use {@link org.apache.lucene.analysis.core.LetterTokenizerFactory} and {@link LowerCaseFilterFactory} + * @lucene.spi {@value #NAME} */ @Deprecated public class LowerCaseTokenizerFactory extends TokenizerFactory { + /** SPI name */ + public static final String NAME = "lowercase"; + private final int maxTokenLen; /** diff --git a/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilterFactory.java b/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilterFactory.java index a1917b8c334..a71cd0ed610 100644 --- a/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilterFactory.java +++ b/solr/core/src/java/org/apache/solr/analysis/ReversedWildcardFilterFactory.java @@ -61,8 +61,12 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; * </fieldType> * * @since 3.1 + * @lucene.spi {@value #NAME} */ public class ReversedWildcardFilterFactory extends TokenFilterFactory { + + /** SPI name */ + public static final String NAME = "reversedWildcard"; private char markerChar = ReverseStringFilter.START_OF_HEADING_MARKER; private boolean withOriginal; diff --git a/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedStopFilterFactory.java b/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedStopFilterFactory.java index 5b6fcb76dd0..29f3476f7f3 100644 --- a/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedStopFilterFactory.java +++ b/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedStopFilterFactory.java @@ -29,9 +29,13 @@ import org.apache.solr.rest.ManagedResource; * TokenFilterFactory that uses the ManagedWordSetResource implementation * for managing stop words using the REST API. * @since 4.8.0 + * @lucene.spi {@value #NAME} */ public class ManagedStopFilterFactory extends BaseManagedTokenFilterFactory { + /** SPI name */ + public static final String NAME = "managedStop"; + // this only gets changed once during core initialization and not every // time an update is made to the underlying managed word set. private CharArraySet stopWords = null; diff --git a/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedSynonymFilterFactory.java b/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedSynonymFilterFactory.java index 259e4cd2ffa..8d77c53976c 100644 --- a/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedSynonymFilterFactory.java +++ b/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedSynonymFilterFactory.java @@ -55,9 +55,13 @@ import org.slf4j.LoggerFactory; * @deprecated Use {@link ManagedSynonymGraphFilterFactory} instead, but be sure to also * use {@link FlattenGraphFilterFactory} at index time (not at search time) as well. * @since 4.8.0 + * @lucene.spi {@value #NAME} */ @Deprecated public class ManagedSynonymFilterFactory extends BaseManagedTokenFilterFactory { + + /** SPI name */ + public static final String NAME = "managedSynonym"; private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedSynonymGraphFilterFactory.java b/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedSynonymGraphFilterFactory.java index caef307736d..80d6a7076a1 100644 --- a/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedSynonymGraphFilterFactory.java +++ b/solr/core/src/java/org/apache/solr/rest/schema/analysis/ManagedSynonymGraphFilterFactory.java @@ -51,9 +51,13 @@ import org.slf4j.LoggerFactory; * TokenFilterFactory and ManagedResource implementation for * doing CRUD on synonyms using the REST API. * @since 7.0.0 + * @lucene.spi {@value #NAME} */ public class ManagedSynonymGraphFilterFactory extends BaseManagedTokenFilterFactory { + /** SPI name */ + public static final String NAME = "managedSynonymGraph"; + private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); public static final String SYNONYM_MAPPINGS = "synonymMappings"; diff --git a/solr/core/src/test/org/apache/solr/handler/tagger/WordLengthTaggingFilterFactory.java b/solr/core/src/test/org/apache/solr/handler/tagger/WordLengthTaggingFilterFactory.java index dbfc5381bb6..c0db6cf631b 100644 --- a/solr/core/src/test/org/apache/solr/handler/tagger/WordLengthTaggingFilterFactory.java +++ b/solr/core/src/test/org/apache/solr/handler/tagger/WordLengthTaggingFilterFactory.java @@ -30,8 +30,14 @@ import org.apache.lucene.analysis.util.TokenFilterFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * @lucene.spi {@value #NAME} + */ public class WordLengthTaggingFilterFactory extends TokenFilterFactory { + /** SPI name */ + public static final String NAME = "wordLengthTagging"; + private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); public static final String MIN_LENGTH = "minLength";