I was using <liferay-ui:search-toggle> tag, and my requirement was to to show only advanced search and no basic search. but by default <liferay-ui:search-toggle> will show basic search unless and until user clicks the advanced search atleast once. I tried all possible ways and finally found the solution, this what i did to make my <liferay-ui:search-toggle>show only "Advanced Search" without "Basic" search toggle link.So what we need to do is,
- We need to override the isAdvancedSearch method of the XDisplayTerms class to always return true, where "X" your class prefix e.g.ArticleDisplayTerms which extends form com.liferay.portal.kernel.dao.search.DisplayTerms
- Update your *_search.jsp which has the <liferay-ui:search-toggle> with the following piece of code
This style overriding will prevent the "<<Basic" search link form being displayed, the next piece of code snippet will make the "Advanced" search displayed by default, we are a kind of triggering the Search link click |
The key piece of code which does sends signal to the underlying liferay code to show only "advanced" is SessionClicks.put(request, key,"advanced");
The same could be achieved when we want to display only basic search and no advanced search just by changing the "advanced" --> "basic"
That is it, once we have done with this our <liferay-ui:search-toggle> will always display only "Advanced" or "Basic" search

