Multi word search on work class properties using Elastic Search
We are trying to build a functionality with full text elastic search where we are giving users option to type in some words in UI and then call Rule-Obj-Report-Definition.pxRetrieveSearchData to get the results based on the Param.pySearchString/Param.pySearchMethod/Param.pySearchOnProperty along with Param.pyReportClassName/Param.pyReportName built in our implementation work layer. We are facing a challenge where multi word search is not supported by pzSearchWorkIndex. We tried to tokenize the search text using below code and pass it to Param.pySearchString but no luck. Our app is in Openshift Container with SRS running as externalized service. We are on Pega V24.1.3 and SRS version is 1.37.3. Please suggest any solution to achieve this functionality. Thanks!
if(pega.getSearchCapabilities().isActivated(com.pega.pegarules.priv.search.nextgen.SearchCapability.ENGINE_SEARCH_DATA)) searchText = pega.getSearcherAPI().escapeQuery(searchText);
searchString =" "; String searchStrings[] = searchText.split(" "); for (String s : searchStrings){ searchString = searchString.concat("pyMetaData1:").concat("*").concat(s).concat("*").concat(" "); } searchString = "("+searchString+")"; String searchString2 = searchString.replaceAll("pyMetaData1", "pyMetaData2"); String searchString3 = searchString.replaceAll("pyMetaData1", "pyObject");
We are trying to build a functionality with full text elastic search where we are giving users option to type in some words in UI and then call Rule-Obj-Report-Definition.pxRetrieveSearchData to get the results based on the Param.pySearchString/Param.pySearchMethod/Param.pySearchOnProperty along with Param.pyReportClassName/Param.pyReportName built in our implementation work layer. We are facing a challenge where multi word search is not supported by pzSearchWorkIndex. We tried to tokenize the search text using below code and pass it to Param.pySearchString but no luck. Our app is in Openshift Container with SRS running as externalized service. We are on Pega V24.1.3 and SRS version is 1.37.3. Please suggest any solution to achieve this functionality. Thanks!
if(pega.getSearchCapabilities().isActivated(com.pega.pegarules.priv.search.nextgen.SearchCapability.ENGINE_SEARCH_DATA)) searchText = pega.getSearcherAPI().escapeQuery(searchText);
searchString =" "; String searchStrings[] = searchText.split(" "); for (String s : searchStrings){ searchString = searchString.concat("pyMetaData1:").concat("*").concat(s).concat("*").concat(" "); } searchString = "("+searchString+")"; String searchString2 = searchString.replaceAll("pyMetaData1", "pyMetaData2"); String searchString3 = searchString.replaceAll("pyMetaData1", "pyObject");
searchString = searchString +"OR"+ searchString2 +"OR"+ searchString3 ;
tools.putParamValue("pySearchString",searchString);