java.lang.Object
org.apache.lucene.analysis.Analyzer
com.atlassian.confluence.impl.search.v2.lucene.analysis.analyzer.exact.ExactFilenameAnalyzer
All Implemented Interfaces:
Closeable, AutoCloseable

public class ExactFilenameAnalyzer extends org.apache.lucene.analysis.Analyzer
Custom analyzer designed for supporting exact matching on file names.

Use when indexing for fields which should support exact matches or when searching for fields which support exact matches for filenames.

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.lucene.analysis.Analyzer

    org.apache.lucene.analysis.Analyzer.GlobalReuseStrategy, org.apache.lucene.analysis.Analyzer.PerFieldReuseStrategy, org.apache.lucene.analysis.Analyzer.ReuseStrategy, org.apache.lucene.analysis.Analyzer.TokenStreamComponents
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExactFilenameAnalyzer(org.apache.lucene.util.Version version)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.apache.lucene.analysis.Analyzer.TokenStreamComponents
    createComponents(String fieldName, Reader reader)
    Only create tokens by whitespace, and lowercase each token.

    Methods inherited from class org.apache.lucene.analysis.Analyzer

    close, getOffsetGap, getPositionIncrementGap, initReader, tokenStream, tokenStream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExactFilenameAnalyzer

      public ExactFilenameAnalyzer(org.apache.lucene.util.Version version)
  • Method Details

    • createComponents

      protected org.apache.lucene.analysis.Analyzer.TokenStreamComponents createComponents(String fieldName, Reader reader)
      Only create tokens by whitespace, and lowercase each token. Filenames will also be split into tokens by the file extension delimiter ".", but all tokens have the same position. The original filename will also be a token.

      e.g. "filename.txt" -> {"filename.txt", "filename", "txt"}

      Searching for the original filename, the name or the extension will match.

      Only one of the tokens will be matched per search, consider them alternative names for the file to match on.

      Specified by:
      createComponents in class org.apache.lucene.analysis.Analyzer