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

Custom attributes get cleared by SynonymFilter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.10.4
    • None
    • None
    • None
    • New

    Description

      I believe the Lucene API enables users to define their custom attributes (by extending AttributeImpl) which may be added by custom Tokenizers.
      It seems, the clear and copyTo methods must be implemented to clear and restore the state of this custom attribute.

      However, some filters (in our case the SynonymFilter) simply call AttributeSource.clearAttributes without invoking copyTo. Instead the filter just resets some known attributes, simply ignoring all other custom attributes. In the end our custom attribute value is lost.

      Is this a bug in SynonymFilter (and others) or are we using the API in the wrong way?

      A solution might be of course to provide empty implementations of clear and copyTo, but I'm not sure if this has other unwanted effects.

      Attachments

        Activity

          People

            Unassigned Unassigned
            obecker Oliver Becker
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: