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

Overriding FullTextSearchController in PCMBackoffice

pratik_a_soni
Participant
0 Likes
1,127

I'm trying to override the FullTextSearchController in PCM Backoffice to not populate the product list at the time user logs in. I want user to explicitly search for the product.

I'm able to do that by overriding the FullTextSearchController and defining my own controller instead.

The problem I'm running with is that when I click the catalog selection, that event doesn't update the content in the content browser. It is working fine with OOTB FullTextSearchController.

I've copied the socket connections.

Attached is my definition.xml file. definition.xml

Attached is my widgets.xml file. widgets.xml

Accepted Solutions (1)

Accepted Solutions (1)

former_member437308
Active Participant
0 Likes

Hi

By your customization you protect against executing search when text is not blank. If user leaves empty input and click on catalog selection, add some filter, your search will also skip. In order to handling search execution if user clicks on catalog, catalog version (search input is empty) you have to build more complex condition based on AdvancedSearchData structure.

 @Override
 protected boolean doSimpleSearch()
 {
     boolean searchExecuted = false;

     final AdvancedSearchInitContext context = getValue(MODEL_INIT_CONTEXT,AdvancedSearchInitContext.class);

     final List<SearchConditionData> catalogVersionConditions = context.getAdvancedSearchData().getConditions("catalogVersion");

     if (StringUtils.isNotBlank(getSearchText()) || CollectionUtils.isNotEmpty(catalogVersionConditions))
     {
         searchExecuted = super.doSimpleSearch();
     }

     return searchExecuted;
 }

Of course above code is not final solution. You have to take into consideration other search parts like filters. All that data are stored in context.getAdvancedSearchData() so you should carefully verify them.

I hope that I roughly explained how it works. Cheers!

pratik_a_soni
Participant
0 Likes

Hi Tomasz, I appreciate your help on this. Though this method is not even invoked when I click on the catalog version. There is some issue with the socket communication is what I can guess.

pratik_a_soni
Participant
0 Likes

My bad, I overridden the initializeWithContext method but didn't declare the annotation that are responsible to add the listener to the socket.

I removed this method in my class and it works good.

Thanks Pratik

Answers (0)

Ask a Question