Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-17185

Open ValueAugmenter in ValueAugmenterFactory for extension

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 9.6
    • Response Writers
    • None

    Description

      Opening up the class `ValueAugmenter` in the `ValueAugmenterFactory` to `public` access level eases the creation of custom document transformers.

      Currently, we have to place our custom document transformers in the `org.apache.solr.response.transform` package to be able to access the package private `ValueAugmenter`. Changing the visibility to `public` enables building custom document transformers very slim and quick like the following one in any package:

      ```
      public class CollectionAugmenterFactory extends TransformerFactory {

      @Override
      public DocTransformer create(String field, SolrParams params, SolrQueryRequest req)

      { String v = ComponentUtils.getCollectionNameFrom(req.getCore()).orElse("[unknown]"); return new ValueAugmenterFactory.ValueAugmenter(field, v); }

      }
      ```

      I'll supply a GitHub PR for this.

      Attachments

        Activity

          People

            mkhl Mikhail Khludnev
            tboeghk Torsten Bøgh Köster
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h 40m
                2h 40m