Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Version: Windchill 12.0
Use Case: Performing Global Search on "Name & Number" only behavior, without Index Search when users select a check box added next to global search Field
Description:
Hello PTC Community !
I'm looking for a way to implement the use case requested by my client on Windchill 12.0.2.7 and Windchill 13.0.2.6 (upgrade in progress).
At first I proposed to automatically set following user's preferences values when he checks the box:
But this solution implies to save previous users's values to reset them whhile unchecking the box and the client wants that we study a way to implement the use case without impacting those preferences.
So, I tried to override the ootb DATA_ONLY component builder: com.ptc.windchill.enterprise.search.mvc.builders.SearchDataBuilder with following class added in codebase/config/mvc/custom.xml as we do for some other MVC Component Builders customizations.
Please find below an abstract of the code:
package com.client.search.builders;
import com.ptc.mvc.components.OverrideComponentBuilder;
import com.ptc.windchill.enterprise.search.mvc.builders.SearchDataBuilder;
@OverrideComponentBuilder
public class ClientSearchDataBuilder extends SearchDataBuilder {
}
But once deployed, I've this error raised in MethodServer:
org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'com.ptc.windchill.enterprise.search.mvc.builders.SearchDataBuilder' available: expected single matching bean but found 2: com.ptc.windchill.enterprise.search.mvc.builders.SearchDataBuilder#0,com.client.search.builders.ClientSearchDataBuilder#0
I tried many things in addition to make Spring configuration working, but it's still running like if @OverrideComponentBuilder annotation was not taken into account here.
FYI, OOTB SearchDataBuilder is defined like this:
@ComponentBuilder(value = {"search.default.searchResults"}, type = ComponentBuilderType.DATA_ONLY)
public class SearchDataBuilder extends AbstractJcaDataSourceComponentDataBuilder
Thanks in advance for your help/advices/other solutions...
Regards,
Julien
Solved! Go to Solution.
Hello @JulienBlais
Have you changed a mvc Search-configs.xml configuration ? ("\Windchill\codebase\config\mvc\Search-configs.xml")
I guess that there is still the original class and there should be yours new one.
Try to update the xml file configuration and will see if it helps
PetrH
Hello @JulienBlais
Have you changed a mvc Search-configs.xml configuration ? ("\Windchill\codebase\config\mvc\Search-configs.xml")
I guess that there is still the original class and there should be yours new one.
Try to update the xml file configuration and will see if it helps
PetrH
Hello @HelesicPetr,
Thanks for pointing out this config file !
I updated the class name to reference mine, AND removed definition of my class in custom.xml one and it worked !
For me that was feasible without modifying ootb configuration files, but only custom.xml one. Do you know why it's specific here and don't you think I could do some configuration working only using the custom.xml file ?
Thanks !
Hi @JulienBlais
I understand but I just think that the original configuration is not overwritten by the custom.xml file in this case and that is a reason of the error.
Why? who knows 😄
PetrH
Yes I guess you're right, 😄 that could be raised in a ptc case later..
I continue working on it, and let you and community know about the final configuration to close the topic.
Thank you for your quick answers !
This should be an OOTB functionality and should not be a customization. But sadly we have to do as a customization
Hello @plmcore,
you already implemented such use case ?
Otherwise, while continuing the customization, I don't find, as of now, where the value of the preference "Keyword Search Behavior" (/com/ptc/windchill/enterprise/search/controlKeywordSearchBehaviour) is used in the code, does someone has insights ?
Yes Thanks @HelesicPetr , just found it also in //, while debugging it I see that static method IndexSearchUtils.getKeywordBehaviorPreference() is called in a loop from WhereClauseHandler.filterAttributeByType...