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)

Name

Value

pxObjClass

Data-Find-SearchParam

pyValue

7

pyName

OrderInfo.OrderList.OrderNbr

pySection

Work

pyParams(10)

Name

Value

pxObjClass

Data-Find-SearchParam

pyValue

7

pyName

OR OrderInfo.QuoteList.OrderNbr

pySection

Work

Option 2: java.lang.IllegalArgumentException: Invalid index type specified:

pyParams(9)

Name

Value

pxObjClass

Data-Find-SearchParam

pyValue

7

pyName

OrderInfo.OrderList.OrderNbr

pySection

Work

pyParams(10)

Name

Value

pxObjClass

Data-Find-SearchParam

pyValue

Work

pyName

OR

pyParams(11)

Name

Value

pxObjClass

Data-Find-SearchParam

pyValue

7

pyName

OrderInfo.QuoteList.OrderNbr

pySection

Work

***Edited by Moderator Marissa to update SR Details***

Group Tags

Comments

Keep up to date on this post and subscribe to comments

January 4, 2019 - 2:17pm

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.