Customizing Faceted Search
Modeled Attribute Visibility in Facets
Modeled attributes appear as facets when they are represented in SearchableAttributesByType.properties.xconf.
By default, SearchableAttributesByType.properties.xconf includes definitions for the advancedSearch property. For example:
<Property name="advancedSearch.wt.part.WTPart"
default=
"thePersistInfo.createStamp,iterationInfo.creator,defaultUnit,lock.locker,state.state,partType,thePersistInfo.modifyStamp,
iterationInfo.modifier,defaultTraceCode,genericType"
/>
If a modeled attribute is represented in the advancedSearch property value, then it is eligible to appear as a result facet.
However, you can explicitly prevent a modeled attribute from appearing by adding the facetSearch property to SearchableAttributesByType.properties.xconf. Once added, only the modeled attributes that are listed in the facetSearch property are eligible to appear. For example:
<Property name="facetSearch.wt.part.WTPart"
default=
"defaultUnit,thePersistInfo.createStamp,thePersistInfo.modifyStamp,"
/>
The entry is type specific. If any particular attribute is to be hidden for multiple types then multiple entries need to be added for applicable types.
Customization for Hiding IBAs from Facets
You can customize the visibility of IBAs appearing on the facet.
Implement the FacetService interface. Update the service entry with custom class in service.properties.
Element
Package
Type
Description
FacetService
Com.ptc.windchill.enterprise.search.facet
Interface
The interface controls the visibility of IBAs on the facet.
Customization Points
Update the service entry with Custom class in "service.properties" as shown in the sample code. In the example, facetCustomClass is the name of custom class.
wt.services/svc/default/com.ptc.windchill.enterprise.search.facet.FacetService/null/null/0=com.ptc.windchill.enterprise.search.facet.FacetCustomClass/duplicate
Implement the inherited methodFacetService.isAttributeVisible(AttributeTypeIdentifier). The isAttributeVisible API returns boolean value which is set to true by default. You can customize theisAttributeVisible API to returnfalsein casethe customer wants to hide any IBAs from facet.
Example:
public booleanisAttributeVisible(AttributeTypeIdentifier ibaAttribute){
if(ibaAttribute.getAttributeName().equals("name of attribute")){
return false;
}
return true;
}
Было ли это полезно?