Deserialize LastSearchState

Hello:

In a Search Result Portlet I need to get the value entered in the keyword field in the search bar portlet (both portlet are wired correctly).

From Portlet reference documentation:
Last Search State (lastSearchState)
Facilitates passing the search query value to the Search Result portlet when a user clicks Go
in the Search Bar control. When a user clicks Go, the portlet serializes and converts the
active search query object to a base64-encoded string, which is then set as the value of
this property. If the property has no value, the portlet behaves as if there is no active
search.

The Query String value contains a base 64 serialized object. My question is how can I deserialize the object?

thanks in advance.

regards.

Typically, if your search result page bean java class implements the ISearchPageBean interface and you have configured wiring between the searchbar and searchresult portlets, then the search query would normally have been deserialized automatically. In your search result portlet page bean, you could get the deserialized searchquery object from the provided getActiveSearchQuery API.

See:
http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_ga/My_webMethods/8-2-SP1_CAF_and_MWS_Java_API_Reference/com/webmethods/caf/faces/search/query/ISearchPageBean.html

Or if you want to programatically deserialize it yourself, the search query factory has a method that can take the search state string and return the search query object.

See:
http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_ga/My_webMethods/8-2-SP1_CAF_and_MWS_Java_API_Reference/com/webmethods/caf/faces/search/query/ISearchQueryFactory.html

Thanks Eric.

Another question: what method is executed in the search result portlet when I click the go button in the search result portlet?

public String doSearch() {
	return getSearchBarControl().getControlBean().constructSearchQueryString();
}

I saw this methods configured in other task search bar portlet.

I mean, I cannot understand the mechanism used to specify what method should execute in the search result portlet (refresh) when I click the go button in the search bar portlet.

regards

Ok, the last post was originated because initialize method was not refreshing the search result portlet. Looking in the forums I found that there is an issue and some member recomends to use:

protected void beforeRenderResponse() {
super.beforeRenderResponse();
.
.
.

I use it and I was able to refresh the search result table.

Best regards.

Yes, that is right. The action is processed inside the SearchBar portlet which generates the serialized search state string. That string is then wired to the search result portlet which deserializes it back to the search query object when rendering the SearchResult portlet. If you need to detect when a new search query has been executed, you can use the isQueryChanged method from the SearchResult page bean.

http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_ga/My_webMethods/8-2-SP1_CAF_and_MWS_Java_API_Reference/com/webmethods/caf/faces/bean/search/BaseSearchPageBean.html#isQueryChanged()