Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6177

Add CustomAnalyzer - a builder that creates Analyzers from the factory classes

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0, 6.0
    • modules/analysis
    • None
    • New

    Description

      I prepared some "generic Analyzer class CustomAnalyzer, that makes it easy to build analyzers like in Solr or Elasticsearch. Under the hood it uses the factory classes. The class is made like a builder:

      Analyzer ana = CustomAnalyzer.builder(Path.get("/path/to/config/dir"))
        .withTokenizer("standard")
        .addTokenFilter("standard")
        .addTokenFilter("lowercase")
        .addTokenFilter("stop", "ignoreCase", "false", "words", "stopwords.txt", "format", "wordset")
        .build();
      

      It is possible to give the resource loader (used by stopwords and similar). By default it tries to load stuff from context classloader (without any class as reference so paths must be absolute - this is the behaviour ClasspathResourseLoader defaults to).

      In addition you can give a Lucene MatchVersion, by default it would use Version.LATEST (once LUCENE-5900 is completely fixed).

      Attachments

        1. LUCENE-6177.patch
          11 kB
          Uwe Schindler
        2. LUCENE-6177.patch
          20 kB
          Uwe Schindler
        3. LUCENE-6177.patch
          27 kB
          Uwe Schindler
        4. LUCENE-6177.patch
          33 kB
          Uwe Schindler

        Issue Links

          Activity

            People

              uschindler Uwe Schindler
              uschindler Uwe Schindler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: