How does maxRows work on a MemSearch?
Does it process everything and then returns the maxRows or does it stop at maxRows?
The MemSearch API call may not return the total number of possible results (this depends on the maxRows setting). If you need this information, you would need to set the MaxRows to 0 and the filter the results yourself.
The following is the process flow for a search:
- Search criteria is standardized and derived, generating bucket data and comparison strings.
- The bucket data is used to retrieve a list of candidate records via the mpi_membktd table.
- Each of the candidate records are then compared to the search criteria via the comparison strings from the mpi_memcmpd table. At this point, no filtering has yet been performed.
- Each candidate record is scored and the results are sorted by score in descending order (highest score on top).
- The Engine now looks at the maxRows and only takes the top rows up to what maxRows is set to.
- The Engine goes back to the various member tables to retrieve the data requested via the SegCodeFilter, SegAttrFilter and RecStatFilter.
Effectively, the filtering is run after all of the searching is completed, but prior to retrieving the record data.
When GETTYPE is ASENTITY, the behaviour of maxRows is different and based on the following:
Sets the maximum number of members/entities to return in the output.
A setting of zero indicates that any number of members may be returned.
The meaning of this setting is modified by the getType parameter used.
If the getType is ASMEMBER, then up to (maxRows) members can be returned. If the gettype is ASENTITY, then up to (maxRows) entities can be returned.
Any Filters set on the IXN will be applied after MaxRows which may cause less then maxRows to be returned .