Search Manual / Version 2010
Table Of ContentsA feedable is an object which is generated from the data of a content bean and which the CAE Feeder sends to the Search Engine for indexing. Customizing feedables means that you define which content of a content bean is mapped to fields of the feedable and is therefore added to the index if a corresponding Solr index field exists. The following paragraphs describe the involved classes.
The FeedableContentBeanEvaluator
creates feedables from
ContentBean
objects. You can find the configuration in the
file caefeeder-triggers.xml
, which is located in the classpath
/framework/spring/caefeeder
.
<bean name="contentEvaluator" class= "com.coremedia.amaro.cae.feeder.FeedableContentBeanEvaluator"> <property name="contentBeanFactory" ref="contentBeanFactory"/> <property name="keyTransformer" ref="feederKeyTransformer"/> <property name="feedableFactory" ref="feedableFactory"/> <property name="feedablePopulator" ref="errorHandlingFeedablePopulator"/> </bean>
Example 5.4. Definition of FeedableContentBeanEvaluator
An implementation of com.coremedia.cap.feeder.persistentcache.KeyTransformer is used to create identifiers for Search Engine documents in the index. The default KeyTransformer implementation creates identifiers of the same format as the IdProvider of the CoreMedia CAE.
Example: a content bean for the content with the numerical id 42
is
represented by an Apache Solr document with the value
contentbean:42
in the field id
. Search applications can use the
IdProvider
to get a content bean for the identifier again.
The FeedableContentBeanEvaluator
uses an implementation of
com.coremedia.cap.feeder.populate.FeedablePopulator
to fill the elements of the feedable with the values of a content bean. By default, a
BeanMappingFeedablePopulator
is used which maps Java bean properties of
ContentBean
objects to elements of the created feedable as configured.
If required, you can configure additional FeedablePopulator
implementations in the property populators
of the bean
compositeFeedablePopulator
. The property takes a list of
FeedablePopulator<T>
beans, which makes it possible to combine data from different
implementations into the same feedable. The type parameter <T>
of a configured
FeedablePopulator
bean must be ContentBean
, Content
or a super type
of these. You can find some existing FeedablePopulator
implementations in package
com.coremedia.cap.feeder.populate. For example, you may configure
an additional PropertyPathFeedablePopulator to index certain nested values of struct properties.
If a bean property's get method throws an exception, the CAE
Feeder will index a so-called error document in the index as placeholder. Error
documents can be recognized by the value ERROR
in the index field
feederstate
. The stack trace of the exception is stored in the index field
feederinfo
. Do not forget to always add a feederstate:SUCCESS
clause to your queries to find successfully indexed documents. Bean feeding will by default
automatically be retried after 10 minutes or if a dependency is invalidated that was
accessed before the exception was thrown. Errors are handled by an instance of class
com.coremedia.cap.feeder.populate.ErrorHandlingFeedablePopulator
which wraps all FeedablePopulator
instances. It is available in the Spring
Context as bean errorHandlingFeedablePopulator
and can be customized as
described in its API documentation.