dynamic property - while indexing

80 views
Skip to first unread message

KdM

unread,
Sep 20, 2018, 11:34:03 PM9/20/18
to atg_...@googlegroups.com
Hi Experts,

Can we create new properties while we do indexing ? Could you guys please share some thoughts on this,

We are using ProductCatalogSimpleIndexingAdmin, to trigger indexing.

eg:In my case, i have the store_id in a Store repository, need to make an inventory check passing each store
id and create a property for each store like this

for each product  record ,i need to create the below properties also, in addition to what we have in the prod-sku-output-config.xml

product.stock.10001_store : 1
product.stock.20002_store : 0
product.stock.30003_store : 1
product.stock.40004_store : 0


My intention is to leverage on this property, and then use a record filter and remove the records based on Store which has
product.stock.20002_store : 0  and product.stock.40004_store : 0

Note : Store_id we have in the request.



Warm Regards
KdM

Yuvraj Patel

unread,
Sep 20, 2018, 11:39:52 PM9/20/18
to atg_...@googlegroups.com
You can propertyaccessor to manipulate your properties. You can return that as a map and it will get indexed separately.

--
--
You received this message because you are subscribed to the Google Groups "ATG_Tech" group.
To post to this group, send email to atg_...@googlegroups.com
To unsubscribe from this group, send email to atg_tech-u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/atg_tech?hl=en
---
You received this message because you are subscribed to the Google Groups "ATG_Tech" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atg_tech+u...@googlegroups.com.
To post to this group, send email to atg_...@googlegroups.com.
Visit this group at https://groups.google.com/group/atg_tech.
To view this discussion on the web visit https://groups.google.com/d/msgid/atg_tech/CAMD9EGxQH%3DP7Ek_pMWe7sNL4hVpFSSckVyWff6oVSahwD_5Cew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

NewBie

unread,
Sep 21, 2018, 9:46:30 AM9/21/18
to ATG_Tech
But in the pcoc.xml we are specifying the output-name="product.stockStatuses", my case i need to generate these property name dynamic while we do the indexing.
Hope it clarifies my question,

<property name="stockStatuses" multiselect-type="multi-or" is-dimension="true" type="string" property-accessor="/com/BCC/endeca/index/accessor/InStockStoresAccessor"
output-name="product.stockStatuses" is-non-repository-property="true"/>

Yuvraj Patel

unread,
Sep 21, 2018, 9:53:48 AM9/21/18
to atg_...@googlegroups.com
Yes , you can return the map from your accessor

Sushant Sethi

unread,
Sep 23, 2018, 8:55:04 AM9/23/18
to atg_...@googlegroups.com
You can use GenerativePropertyAccessor to create dynamic endeca properties during indexing.

Try to follow what is being done for prices. See the link -

Sample ref-
public class StockAttributesAccessor extends GenerativePropertyAccessor {
    @Override
    protected Map<String, Object> getPropertyNamesAndValues(Context arg0,
            RepositoryItem pItem, String propertyName, PropertyTypeEnum arg3,
            boolean arg4) {
       
      Map<String, Object> outputStockProperties = new HashMap<String, Object>();
          //apply logic for store/stock, and keep adding keys to map. each key is a different endeca property
            outputStockProperties.put("product." + dynamicKeyName, attributeValue);
        return outputStockProperties;
    }
}

PCOC- something like
<property name="stock" text-searchable="true" is-dimension="true property-accessor="/<path to accessor>/StockAttributesAccessor" multiselect-type="multi-or"/>

Hope this helps.

Thanks
Sushant

NewBie

unread,
Sep 28, 2018, 4:59:11 PM9/28/18
to ATG_Tech
Thanks a lot Sushant, GenerativePropertyAccessor is the solution:
Hopefully i should be able use a Query parameter and sort this in reverse order. I will keep you guys posted.

Lakshmi

unread,
Sep 16, 2020, 11:01:13 AM9/16/20
to ATG_Tech
did this worked? Can you send us the code

KdM

unread,
Sep 16, 2020, 11:15:35 AM9/16/20
to atg_...@googlegroups.com
Yes, it worked perfectly,  you can research based on the below sample output..

image.png


Reply all
Reply to author
Forward
0 new messages