UrlEncodeWithIndexId can be used to create HREFs to use in HTML search results. When the user clicks the link, the URL-encoded item will be sent as part of the Query String. A server-based application that receives the URL-encoded item can then use UrlDecodeItem to convert the data in the HREF back into a SearchResults object. This eliminates the need to keep the SearchResults object in memory between requests, making stateless operation possible on web servers.
Encoding an item as a search makes more information available after the search to support features such as multi-color hit highlighting. It also provides a way to URL-encode an item with too many hits to store in a URL.
The indexId parameter provides a way to encode the index location in the URL without exposing the actual location of the index folder. The provided indexId will be stored in the URL as a value named ixid (i.e., "...&ixid=123;&..."). The calling application should extract this ixid value, decode it to the correct path, and then use UrlDecodeItemWithIndex to decode the item with the index path.
The maxLen parameter is used to limit the number of hit offsets written to the generated URL. If asSearch is true, the generated URL will not include any hit offsets and maxLen is ignored.