We are using OOTB full text search ( using custom search properties ) in our application & retrieval of results is working fine . For the inital search , it shows 20 records & when we click on "Show results in new window" it is showing 1000 records . It is performed using OOTB activity ID:pxRetrieveSearchData : Class : Rule-Obj-Report-Definition & we did not customize anything . But here , the 20 initial search results retrieval is following some logical order ( neither first 20 results nor last 20 results are shown ! ) & not sure where this sort order is set ( it is not set in pyWorkSearch report definition ) . Can someone help me understand more about where this sort order is set and how to change it ?
I did observe the same in pyWorkSearch report definition ,but the results are not getting sorted based on pxUpdateTime during runtime . As the data is not fetched from the database , not sure what is the generated query to fetch the results from work index . Is there any way to view it ?
The search OOTB in pega uses Elastic Search which retrieves records based on RELEVANCE. This is the working functionality of the algorithm coded in ELASTIC SEARCH which is 3rd party software.
To explain what is Relevance, let's assume there are 50 records available.
The first records are created on 11th date, next 10 records created on 12th and so on until 50th records. So everyday 10 records have been created.
One more point to note is the Search OOTB returns almost 20 records in studio window and upto 1000 records in pop-up search results window.
So when you search a work-object with some keyword the elastic search will fetch few records from pool of records to show in studio, but displays all the matched records in pop-up window.
Here, as per above example it will retrieve matched records as per RELEVANCE based on keyword. FEW records created on 11th and FEW on 12th and so on upto 15th. If the retrieved records are more than 20 than Elastic search will ignore the records from 21 and only 20 will be shown in studio and all the records will be shown in popped out search window.
I have capitalized FEW here, it means if there are 5 or more matched cases created on 10th(for example) the elastic search may consider 1 or 2 or 3 or anything during retrieval to show in studio search.
To sort these records in ascending or descending order you have to open pySearchwrapper and at edit Obj-sort method with needed columns(createddatetime, updatedatetime etc).
If you still don't find the latest records, please take unique word available in latest records and try to search, it will and should populate the cases of new cases.