Question
Custom Search Parameters for Elastic Search - Pega 7.4 - defining params for search query
Hello, has anyone attempted to build query params (using pySearchWorkParams) in such a way, to use OR clause for search params?
For example, I have a property in two embedded pages, property "OrderNbr", in Primary.OrderInfo.OrderList(1).OrderNbr and Primary.OrderInfo.QuoteList(1).OrderNbr.OrderNbr.
This property can be present only in one of the pages in the same case. Not in both. So I need my search query to look at both places using an "OR" clause.
Now have enabled following settings:
- Added OrderNbr in custom search property, including it with the appropriate structure (see attached images).
- Ran re-index of my work data.
- In pySearchWorkParams activity, including steps to add params as shown below:
- .pyParams(<APPEND>).pyName = "OrderInfo.OrderList.OrderNbr"
- .pyParams(<LAST>).pyValue = AdvancedSearchCriteriaPage.OrderNbr
- .pyParams(<LAST>).pySection = "Work"
- Similarly, included another step to add params as shown below:
- .pyParams(<APPEND>).pyName = "OrderInfo.QuoteList.OrderNbr"
- .pyParams(<LAST>).pyValue = AdvancedSearchCriteriaPage.OrderNbr
- .pyParams(<LAST>).pySection = "Work"
Options tried:
- Option 1: Add "OR" to second param like pyParams(<APPEND>).pyName = " OR OrderInfo.QuoteList.OrderNbr"
- Option 2: Added another step to add param as shown below:
- .pyParams(<APPEND>).pyName = "OR"
- .pyParams(<LAST>).pyValue = ""
- .pyParams(<LAST>).pySection = "Work"
For both options, Elastic search could not agree. I get below exceptions:
Option 1: Search request failed. Query: [*], Index [work*]
pyParams(9) |
| ||||||||||
pyParams(10) |
|
Option 2: java.lang.IllegalArgumentException: Invalid index type specified:
pyParams(9) |
| ||||||||||
pyParams(10) |
| ||||||||||
pyParams(11) |
|
***Edited by Moderator Marissa to update SR Details***
An OR clause cannot be used with two different pyValue query parameters (if the same pyValue is used on two different query parameters, an OR would be used). To work around this, they have replaced the embedded properties with a pick list property so an OR clause wouldn't be necessary.