[ 
https://issues.apache.org/jira/browse/LUCENE-5479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rob Audenaerde updated LUCENE-5479:
-----------------------------------

    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:

{code:title=CustomFacetConfig.java|borderStyle=solid}
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;
        }
}
{code}

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?)


  was:
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:

{code:title=CustomFacetConfig.java|borderStyle=solid}
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;
        }
}
{code}

I created a patch to illustrate what I would like to change.

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



> Make default dimension config in FacetConfig adjustable 
> --------------------------------------------------------
>
>                 Key: LUCENE-5479
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5479
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Rob Audenaerde
>            Priority: Minor
>         Attachments: LUCENE-5479.patch
>
>
> 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:
> {code:title=CustomFacetConfig.java|borderStyle=solid}
> 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;
>       }
> }
> {code}
> 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?)



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to