Issue with pySearchString (Enhanced Search)

We have implemented enhanced search using API Call (pxRetreiveSearchData) with EXACT method.
When we are trying to fetch the documents with multiple words in search string by changing the order of words in search text it is fetching different results.

eg: 1) Search text: “Enhanced Search String”
If we search with the above search string it is fetching 4 results.
2) Search text: “Search Enhanced String”
When we are trying to search with this string it is fetching 2 results.

Note: We have configured pySearchString as (columnname1: SearchText, columnname2: SearchText)

Please help me with actual search functionality how it is working with the above pySearchString

@GeetaShaliniB

Hi Geeta,

Please note that it might be related to the way you build the actual search string. E.g.: if you use:

PropertyA:wordA wordB

Then it is not equivalent to:

PropertyA:wordB wordA

as only first word is searched through the PropertyA in both examples, so first search string will look for documents with wordA in PropertyA and wordB in default (FTS) field, while second with do opposite - search for wordB in PropertyA and wordA in FTS field.

To cover it you might want to try this:

PropertyA:(wordA wordB)

Hopefully this should solve the inconsistent results problem

Pawel

@GeetaShaliniB can you please help how exactly you formed the search string using multiple columns with multiple value

@JasmineS Got any update on this?

@JasmineS @Naga Malleswara Rao To use advanced search with pxRetrieveSearchData on multiple columns, you can customize the activity parameters. In the pySearchString field, you can specify multiple search terms using AND, OR, or NOT operators. For example, you can enter “Term1 AND Term2” to search for records containing both terms.

Additionally, you can use parentheses to group search terms and create more complex queries, such as “(Term1 OR Term2) AND Term3”. This will help you retrieve specific results based on multiple columns.

When using pxRetrieveSearchData with the EXACT method and multiple words in the search string, you should use parentheses to group the words for each column.

For example, if you want to search for ‘wordA’ and ‘wordB’ in both ‘columnname1’ and ‘columnname2’, you should configure the pySearchString as follows: (columnname1:(wordA wordB), columnname2:(wordA wordB)). This will ensure that the search is performed correctly, considering both words in each column.

This answer came from a Pega gen-AI assistant using the below references. As a Support Center moderator, I reviewed the answer and references for accuracy:

Using the search API

Pega search API > Domain Specific Language

If you both still need help, please post a New Question with exact details of your own scenario and how you have already configured it, and what errors or behaviour you are seeing.