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

Improve CustomAnalyzer to also allow to specify factory directly (for compile-time safety)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.4
    • Fix Version/s: 5.5, 6.0
    • Component/s: modules/analysis
    • Labels:
      None
    • Lucene Fields:
      New
    • Flags:
      Patch

      Description

      Currently CustomAnalyzer only allows to specify the SPI names of factories. As the fluent builder pattern is mostly used inside Java code, it is better for type safety to optionally also specify the factory class directly (using compile-time safe patterns like .withTokenizer(WhitespaceTokenizerFactory.class)). With the string names, you get the error only at runtime. Of course this does not help with wrong, spelled parameter names, but it also has the side effect that you can click on the class name in your code to get javadocs with the parameter names.

      This issue will add this functionality and update the docs/example.

      Thanks to Shai Erera for suggesting this!

        Attachments

        1. LUCENE-6958.patch
          16 kB
          Uwe Schindler
        2. LUCENE-6958.patch
          14 kB
          Uwe Schindler

          Issue Links

            Activity

              People

              • Assignee:
                thetaphi Uwe Schindler
                Reporter:
                thetaphi Uwe Schindler
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: