cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Translate the entire conversation x

Search Component Data Builder customization

JulienBlais
4-Participant

Search Component Data Builder customization

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:

  • Enable Index Search to "No"
    /com/ptc/windchill/enterprise/search/includeIndexGlobalSearch
  • Keyword Search Behavior to "Name & Number" (3)
    /com/ptc/windchill/enterprise/search/controlKeywordSearchBehaviour

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

ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire II
(To:JulienBlais)

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. 

HelesicPetr_0-1756454332635.png

 

Try to update the xml file configuration and will see if it helps

 

PetrH

View solution in original post

9 REPLIES 9
HelesicPetr
22-Sapphire II
(To:JulienBlais)

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. 

HelesicPetr_0-1756454332635.png

 

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 !

HelesicPetr
22-Sapphire II
(To:JulienBlais)

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 !

plmcore
14-Alexandrite
(To:JulienBlais)

This should be an OOTB functionality and should not be a customization.  But sadly we have to do as a customization

HelesicPetr
22-Sapphire II
(To:plmcore)

@plmcore 

That happens all the time 😄 

PetrH

JulienBlais
4-Participant
(To:plmcore)

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 ?

HelesicPetr
22-Sapphire II
(To:JulienBlais)

Hi @JulienBlais 

It is used in two classes 

IndexSearchUtils.class

SearchConstants.class

 

PetrH

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...

Announcements
Top Tags