Types of Property Accessors in Endeca
Property Accessor play a vital Role in
Processing the Data during the Endeca Indexing . Almost all the applications
will not be without the Accessors written to it.
There are two types of Accessors which is widely
used or it can be defined as we can write accessors by extending the following
two classes.
These can be defined as the based on the
Type of usage we need.
1)
Extending GenerativePropertyAccessor
This type of class can be used only we have
multiple data to be returned during the Indexing. When we are extending this
class then we have to implement the Below method or Override it to make it work
Functional. The Return type of this accessor should be map , so it is
MultiValued .
package com.endeca.index;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import atg.repository.RepositoryItem;
import
atg.repository.search.indexing.Context;
import
atg.repository.search.indexing.GenerativePropertyAccessor;
import
atg.repository.search.indexing.IndexingOutputConfig;
import
atg.repository.search.indexing.specifier.OutputProperty;
import atg.repository.search.indexing.specifier.PropertyTypeEnum;
public class ActivePropertyAccessor extends
GenerativePropertyAccessor {
protected Map<String, Object> getPropertyNamesAndValues(Context
pContext, RepositoryItem pItem, String pPropertyName, PropertyTypeEnum pType,
boolean
pIsMeta) {
Map<String,
Object> res = new HashMap<String, Object>();
// Business Logic for Processing the data
// pItem-Repository item of the Type where we have defined (ie Sku item or product item)
// pPropertyName – property name
return
res;
}
2)
Extending PropertyAccessorImpl
This class can be used when the single
value is used during Indexing.
package com.endeca.index;
import java.util.HashMap;
import java.util.Map;
import atg.repository.RepositoryException;
import atg.repository.RepositoryItem;
import
atg.repository.search.indexing.Context;
import
atg.repository.search.indexing.PropertyAccessorImpl;
import atg.repository.search.indexing.specifier.PropertyTypeEnum;
public class ActivePropertyAccessor extends
PropertyAccessorImpl {
protected Boolean
getTextOrMetaPropertyValue(Context pContext, RepositoryItem pItem, String
pPropertyName,
PropertyTypeEnum
pType) {
//
business logic for parsing data
return
queryPropVal;
}
No comments:
Write comments