Basic Customization > User Interface Customization > Windchill Search Customization > Customizing Indexing Behavior
  
Customizing Indexing Behavior
You can modify search engine index information that is associated with a Windchill business object.
Configure DefaultIndexObjectBuilder
Provide the implementation for the following method with a signature: protected void setAdditionalAttributes(EPMDocument indexable, TypeInstance ti, WCIndexingObject indexingObject, WTCollection sharedMapCollection) throws WTException
To use a customized DefaultIndexObjectBuilder class, you must update the service.properties file to reflect this change.
The following is the default entry:
# #####################################################
# The wt.index.builder.IndexObjectBuilder service.
# ###########################################################
wt.services/svc/default/wt.index.builder.IndexObjectBuilder/
null/wt.index.Indexable/0=wt.index.builder.DefaultIndexObjectBuilder
/duplicate
For this example, assume that you have a custom DefaultIndexObjectBuilder named DemoIndexObjectBuilder that you want to use to index. If you want to override the default DefaultIndexObjectBuilder, you must add the following line to service.properties : wt.services/svc/default/wt.index.builder.IndexObjectBuilder/null/wt.epm.EPMDocument/0=wt.index.builder.DemoIndexObjectBuilder/duplicate
* 
This value should be entered on one line.
setAdditionalAttributes
You can override the custom_ setAdditionalAttributes(EPMDocument indexable, TypeInstance ti, WCIndexingObject indexingObject, WTCollection sharedMapCollection) method and add your specific code into this method.
Example

import wt.epm.EPMDocument;
import wt.fc.collections.WTCollection;
import wt.index.IndexAttributeInfo;
import wt.index.WCIndexingObject;
import wt.util.WTException;
import com.ptc.core.meta.type.common.TypeInstance;

/**
* Demo IndexObjectBuilder implementation for EPMDocument object type.
*/

public class DemoIndexObjectBuilder extends
DefaultIndexObjectBuilder<EPMDocument> {

/* Override setAdditionalAttributes method to set additional attributes in
* IndexingObject so that it gets indexed to SOLR and is searchable
* The super class already has some implementation, so have to call
* super.setAdditionalAttributes method explicitly Instead we can have a
* custom method that can be overridden and keep it's implementation
* empty in DefaultIndexObjectBuilder
* (non-Javadoc)
* @see wt.index.builder.DefaultIndexObjectBuilder#setAdditionalAttributes
* (wt.index.Indexable, com.ptc.core.meta.type.common.TypeInstance,
* wt.index.WCIndexingObject, wt.fc.collections.WTCollection)
*/

@Override
protected void setAdditionalAttributes(EPMDocument indexable, TypeInstance ti,
WCIndexingObject indexingObject, WTCollection sharedMapCollection)
throws WTException {
//call the setAdditionalAttributes method of super class to keep the
//existing implementation intact

super.setAdditionalAttributes(indexable, ti, indexingObject, sharedMapCollection);

//Get the additional values to be indexed from TypeInstance or any
//other custom implementation

String demoVal = "SOME_VALUE";

//Get the custom for which user wants solr field. Like SOME_ATTRIBUTE
IndexAttributeInfo attributeInfo = getAttributeInfo
("SOME_ATTRIBUTE", demoVal, false);

//If the attribute value needs to be indexed as a separate field in SOLR,
//then add it to unmappedAttInfo list in IndexingObject

indexingObject.addToUnmappedAttInfo(attributeInfo);

//If the attribute value needs to be searchable via keyword, then append the
//value to the metadata field whose content is searchable through keyword
indexingObject.appendMetadataField(demoVal);
}
}