Optional: Used for logging purposes. SessionId should contain the session identifier of the user session used to carry out the search.
Maintaining session information for statistical purposes is useful to analyze trends in user behavior.
SearchParameters example:
Namespace: Ankiro.SearchServer.Data.SearchExamples
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ankiro.Suite.Client.SearchSample.SearchService; namespace Ankiro.Suite.Client.SearchSample { public class SearchIdExample { private SearchWebService searchService; public SearchIdExample(SearchWebService service) { searchService = service; SearchProfileId = 1; ResultsPerPage = 10; } public int SearchProfileId { get; set; } public int ResultsPerPage { get; set; } private Guid? _searchId; /// <summary> /// Executes a paged search. Page is assumed to be 1-offset, so that e.g. page=1 retrieves the first 'ResultsPerPage' results. /// </summary> /// <param name="searchString"></param> /// <param name="page"></param> /// <returns></returns> public SearchResult ExecutePagedSearch(string searchString, int page) { if (page < 1) throw new ArgumentException("page"); var result = searchService.Search(new SearchParameters() { SearchProfileId = SearchProfileId, SearchString = searchString, // Calculate the logical offset of the first document to retrieve, taking paging into account. Offset = (page-1) * ResultsPerPage, MaxResults = ResultsPerPage, // Transmit any previously retrieved SearchId to make sure that logging is done correctly. SearchId = _searchId.HasValue ? _searchId.Value : Guid.Empty, // LogSearch is overriden to false if SearchId is not empty LogSearch = true, SessionId = HttpContext.Current.Session.SessionID, RequestedBy = HttpContext.Current.Request.UserHostAddress, }); if (!_searchId.HasValue) _searchId = result.SearchId; return result; } } }
Assembly: Ankiro.SearchServer.Data (in Ankiro.SearchServer.Data.dll) Version: 1.13.770.19207 (1.13.770.19207)
Syntax
Property Value
Type: StringSee Also