12 Replies Latest reply on Apr 18, 2017 8:50 PM by RJ Nunes

    How to create range dimensions in ATG 11.1

    .omi

      Good day,

       

      I have a flat dimension called "hours" in my PSOC indexing configuration.

       

      <property name="hours" filter="unique" text-searchable="false" is-dimension="true" multiselect-type="multi-or" type="float"/>

       

      It displays in my endeca ref app perfectly, but it's flat. For example.

       

      hours

      -------

      1

      2

      3

      4

       

      My desired output

       

      hours_range

      ----------------

      1 - 2

      3 - 5

       

      How would I convert my hours dimension to range or create a a new range dimension?

       

      I tried editing the index-config.json file (ran set-config command as well) with the addition below but it failed. The range dimension isn't showing.

      "hours_range" : {

        "multiSelectType" : "OR",

        "jcr:primaryType" : "endeca:dimension",

        "rangeComparisonType" : "FLOAT",

        "sourcePropertyNames" : [ "product.hours" ]

        }

       

       

       

      Thanks,

      omi

        • 1. Re: How to create range dimensions in ATG 11.1
          Daciano

          Hi, I see two possibilities,

           

          First, use the current format that you are indexing, make the range filter with Navigation Query,

          for example: ?Nf=product.hours|BTWN+1+5

           

          Second: index a new dimension by grouping the range values.

           

          If you need help creating this new dimension you can return.

           

          I hope I have helped

          • 2. Re: How to create range dimensions in ATG 11.1
            .omi

            Thanks for replying.

             

            Even though the first option seems acceptable, I will need help implementing the second one.

             

            Can you provide some more details?

            • 3. Re: How to create range dimensions in ATG 11.1
              Daciano

              Of course .omi, I'll try to explain.

              You will have to index a new dimension (product.hours_range), and add in the property-accessor=/Atg/commerce/endeca/index/accessor/ActivePriceAccessor.

               

              After that you will have to work on the native component of DCS PriceDimensionValueExporter.properties, this component is responsible for the automatic range, in it will have all range settings, such as defaultFacetDefinitionRangeTiersString, where it defines the result: 0-1, 1-2, 2- 3, 3-4.

               

              You will have to add this component in productCatalogOutputConfig, below a documentation link, I believe it can help you.

               

              Oracle Commerce Platform - Price Range Refinements Configuration

               

              Any doubt returns. I hope I have helped.

              1 person found this helpful
              • 4. Re: How to create range dimensions in ATG 11.1
                .omi

                I'm not seeing the PriceDimensionValueExporter.properties in my instance but I'm assuming I can just add it in /atg/commerce/endeca/index/ path of my app.

                 

                Are you recommending that I use the existing settings and override the dimension name (dimensionName=product.price_range) with my product.hours_range or create a new PriceDimensionValueExporter.properties file and my custom dimension there?

                 

                Thanks

                • 5. Re: How to create range dimensions in ATG 11.1
                  Daciano

                  Good afternoon,

                  yes, you can add PriceDimensionValueExporter.properties

                  and override them as properties according to your implementation.

                  • 6. Re: How to create range dimensions in ATG 11.1
                    RJ Nunes

                    Hi .omi,

                    Just an ideia.

                    Using Property Accessors https://docs.oracle.com/cd/E41069_01/Platform.11-0/ATGEndecaIntegrationGuide/html/s0502usingpropertyaccessors01.html

                     

                    <property name="hours" is-non-repository-property="true" text-searchable="false" type="set" is-dimension="true" multiselect-type="multi-or" property-accessor="/com/accessors/HourRangeAccessor"/>

                     

                    Your .properties file: /com/accessors/HourRangeAccessor

                    $class=com.accessors.HourRangeAccessor
                    
                    

                     

                     

                    Your HourRangeAccessor class extends PropertyAccessorImpl

                     

                    @Override 
                    public Object getTextOrMetaPropertyValue(Context pContext, RepositoryItem pItem, String pPropertyName, PropertyTypeEnum pType) {
                      Set<String> hourRanges = new HashSet<>();
                      Double hour = (Double) pItem.getPropertyValue("hour");
                      if (hour != null) {
                           if (hour > 0D && hour < 3D) {
                                hourRanges.add("1 - 2");
                           } else if (hour >= 3D && hour < 6D) {
                                hourRanges.add("3 - 5");
                           } else {
                                hourRanges.add("6 - to infinity and beyond");
                           }
                           return hourRanges;
                           }
                           return null;
                      }
                    
                    1 person found this helpful
                    • 7. Re: How to create range dimensions in ATG 11.1
                      .omi

                      I'm also looking into this.

                       

                      Does PropertyTypeEnum belong to atg.repository.search.indexing.specifier?

                       

                      So basically,

                      • A custom processor (Hours Processor) used in the PSOC.
                      • Create the HoursDimensionValueExporter properties file dimensionName, sourceOutputPropertyNames etc.just like what's here Oracle Commerce Platform - Price Range Refinements Configuration
                      • Add HoursDimensionValueExporter to the ProductCatalogSimpleIndexingAdmin.properties and SchemaExporter.properties
                      • Update the index-config.json file

                       

                      Do you think I'm missing anything?

                       

                      Regards,

                      omi

                      ProductCatalogSimpleIndexingAdmin.properties
                      • 8. Re: How to create range dimensions in ATG 11.1
                        RJ Nunes

                        Hi .omi

                         

                        Yes, PropertyTypeEnum belong to atg.repository.search.indexing.specifier.

                         

                        What you really need may be simpler.

                        • A custom processor (Hours Processor) used in the PSOC.
                        • Update the index-config.json file
                        • Not necessary create a HoursDimensionValueExporter, because who will generate the range is your custom accessor (getTextOrMetaPropertyValue method in the HourRangeAccessor class extending PropertyAccessorImpl), otherwise you would need the exporter to generate ranges automatically, but as I said, your method will make the range.

                         

                        Regards,

                        Nunes

                        • 9. Re: How to create range dimensions in ATG 11.1
                          .omi

                          Neither approach is working for me.

                           

                          Custom Property Accessor I

                          • Updated PSOC (tried with both type=set and float)

                          <property name=hours_range" output-name="product.credit_hours" is-dimension="true" autogen-dimension-values="false"  text-searchable="false" type="set"

                            is-non-repository-property="true" multiselect-type="multi-or" property-accessor="/atg/commerce/endeca/index/accessor/HoursPropertyAccessor" />

                          • Included HoursPropertyAccessor.properties with $class=atg.repository.search.indexing.accessor.HoursPropertyAccessor
                          • Added class that with the method getTextOrMetaPropertyValue
                          • Updated the index...json file
                          • The range dimension/values doesn't exist

                           

                          Custom Property Accessor II

                          • Updated PSOC (tried with both type=set and float)

                          <property name=hours" output-name="product.credit_hours" is-dimension="true" autogen-dimension-values="false"  text-searchable="false" type="set"

                            is-non-repository-property="true" multiselect-type="multi-or" property-accessor="/atg/commerce/endeca/index/accessor/HoursPropertyAccessor" />

                          • Included HoursPropertyAccessor.properties with $class=atg.repository.search.indexing.accessor.HoursPropertyAccessor
                          • Added class that with the method getTextOrMetaPropertyValue
                          • Updated the index...json file
                          • The range dimension/values doesn't exist

                           

                          My index...json contains

                          "hours_range" : {

                            "multiSelectType" : "OR",

                            "jcr:primaryType" : "endeca:dimension",

                            "rangeComparisonType" : "FLOAT",

                            "sourcePropertyNames" : [ "product.hours" ]

                            }

                           

                          PriceDimensionValueExporter I

                          • Used the same settings Daciano mentioned earlier
                          • Updated dimensionName=hours_range
                          • Updated useCurrencyNumberFormat=false

                          This works for the most part. I have both hours (flat) and hours_range dimensions. The only problem is that I'm overriding the Price range configs.

                          Concern: What happens to price if I decided to use it in the guided navigation as a range dimension.

                           

                          PriceDimensionValueExporter II

                          • Used the same settings Daciano mentioned earlier
                          • For every price related file and config option I created a "hours" one. Example PriceDimensionValueExporter.properties => HoursDimensionValueExporter.properties,

                          This doesn't work because I think I need to create a DynamicPriceValueSynchronization for hours but this seems like I'm going down a rabbit hole. If a future release requires a new range dimension, I'd have to a those 3-5 files.

                          • 10. Re: How to create range dimensions in ATG 11.1
                            RJ Nunes

                            Looking for the first method: Custom Property Accessor I

                             

                            Please ensure, that the value in accessor class is correct.

                             

                            If the property hours is a attribute of product.

                             

                            Then in PSOC file :

                            <item item-descriptor-name="product">

                              <properties>

                                      <property name=hours_range" output-name="product.credit_hours" is-non-repository-property="true" text-searchable="false" type="set" is-dimension="true" multiselect-type="multi-or" property-accessor="/com/accessors/HourRangeAccessor"/>

                             

                             

                            The "hours" property must be exactly the product in the customCatalog.xml (Mapping file of catalog properties), because you use the getPropertyValue.

                                 customCatalog.xml:

                                 <item-descriptor name="product"

                                      <table name=" ................

                                          <property name="hour" data-type="double" column-name="hour" display-name-resource="product.hour" category="categoryInfo">

                             

                                 Accessor Class:

                                 Double hour = (Double) pItem.getPropertyValue("hour");

                             

                            Are these values correct?

                            • 11. Re: How to create range dimensions in ATG 11.1
                              .omi

                              The PSOC looks like what you have, while the customCatalog.xml is:

                               

                                        <table name=" ................

                                            <property name="hours" data-type="double" column-name="course_hours" display-name-resource="hours" category="categoryInfo">

                              • 12. Re: How to create range dimensions in ATG 11.1
                                RJ Nunes

                                Weird, I implemented something similar and it worked.

                                Something is missing...

                                 

                                Custom Property Accessor I

                                In your HourRangeAccessor class, put a debug:

                                @Override
                                public Object getTextOrMetaPropertyValue(Context pContext, RepositoryItem pItem, String pPropertyName, PropertyTypeEnum pType) {
                                    logDebug("Id " + pItem.getRepositoryId());
                                    logDebug("Hour " + pItem.getPropertyValue("hour"));
                                    ................
                                

                                 

                                Run a baseline index in the ProductCatalogSimpleIndexingAdmin.

                                 

                                What do we have in the debug?