Lucene - Core
  1. Lucene - Core
  2. LUCENE-5479

Make default dimension config in FacetConfig adjustable

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.8, 6.0
    • Component/s: modules/facet
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Now it is hardcoded to DEFAULT_DIM_CONFIG. This may be useful for most standard approaches.

      However, I use lots of facets. These facets can be multivalued, I do not know that on beforehand. So what I would like to do is to change the default config to mulitvalued = true.

      Currently I have a working, but rather ugly workaround that subclasses FacetConfig, like this:

      CustomFacetConfig.java
      public class CustomFacetsConfig extends FacetsConfig
      {
      	public final static DimConfig DEFAULT_D2A_DIM_CONFIG = new DimConfig();
      	static
      	{
      		DEFAULT_D2A_DIM_CONFIG.multiValued = true;
      	}
      
      	@Override
      	public synchronized DimConfig getDimConfig( String dimName )
      	{
      		DimConfig ft = super.getDimConfig( dimName );
      
      		if ( DEFAULT_DIM_CONFIG.equals( ft ) )
      		{
      			return DEFAULT_D2A_DIM_CONFIG;
      		}
      		return ft;
      	}
      }
      

      I created a patch to illustrate what I would like to change. By making a protected method it is easier to create a custom subclass of FacetConfig.

      Also, maybe there are better way to accomplish my goal (easy default to multivalue?)

      1. LUCENE-5479.patch
        1 kB
        Rob Audenaerde
      2. LUCENE-5479.patch
        0.7 kB
        Rob Audenaerde

        Activity

        Hide
        Michael McCandless added a comment -

        +1, makes sense!

        Show
        Michael McCandless added a comment - +1, makes sense!
        Hide
        Shai Erera added a comment -

        +1. Can you please document the method?

        Show
        Shai Erera added a comment - +1. Can you please document the method?
        Hide
        Rob Audenaerde added a comment -

        With javadoc.

        Show
        Rob Audenaerde added a comment - With javadoc.
        Hide
        Michael McCandless added a comment -

        Thanks Rob, this looks great; I'll commit shortly.

        Show
        Michael McCandless added a comment - Thanks Rob, this looks great; I'll commit shortly.
        Hide
        ASF subversion and git services added a comment -

        Commit 1573156 from Michael McCandless in branch 'dev/trunk'
        [ https://svn.apache.org/r1573156 ]

        LUCENE-5479: make the default dimension config controllable via subclass of FacetsConfig

        Show
        ASF subversion and git services added a comment - Commit 1573156 from Michael McCandless in branch 'dev/trunk' [ https://svn.apache.org/r1573156 ] LUCENE-5479 : make the default dimension config controllable via subclass of FacetsConfig
        Hide
        ASF subversion and git services added a comment -

        Commit 1573157 from Michael McCandless in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1573157 ]

        LUCENE-5479: make the default dimension config controllable via subclass of FacetsConfig

        Show
        ASF subversion and git services added a comment - Commit 1573157 from Michael McCandless in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1573157 ] LUCENE-5479 : make the default dimension config controllable via subclass of FacetsConfig
        Hide
        Michael McCandless added a comment -

        Thanks Rob!

        I tweaked the javadocs a bit and added a small test case and committed.

        Show
        Michael McCandless added a comment - Thanks Rob! I tweaked the javadocs a bit and added a small test case and committed.
        Hide
        Uwe Schindler added a comment -

        Close issue after release of 4.8.0

        Show
        Uwe Schindler added a comment - Close issue after release of 4.8.0

          People

          • Assignee:
            Michael McCandless
            Reporter:
            Rob Audenaerde
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development