SearchParameters ClassAnkiro Enterprise Suite Reference Documentation
The SearchParameters class encapsulates the mandatory and optional parameters used to specify how to carry out a search.
Examples

SearchParameters example:
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;
        }
    }
}
Inheritance Hierarchy

System Object
  Ankiro.SearchServer.Data.Search SearchParameters

Namespace: Ankiro.SearchServer.Data.Search
Assembly: Ankiro.SearchServer.Data (in Ankiro.SearchServer.Data.dll) Version: 1.13.770.19207 (1.13.770.19207)
Syntax

public class SearchParameters : IExtensibleDataObject

The SearchParameters type exposes the following members.

Constructors

  NameDescription
Public methodSearchParameters 
Initializes a new instance of the SearchParameters class
Public methodSearchParameters(Int32, String)
Initializes a new instance of the SearchParameters class
Top
Methods

  NameDescription
Public methodAddFacetParameter(String, Parameter)
Public methodAddFacetParameter(String,  String )
Public methodAddParameter(String, Parameter)
Public methodAddParameter(String,  String )
Public methodStatic memberDeserializeParameter
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsValidForLogging
Public methodStatic memberSerializeParameter
Public methodStatic memberSerializeParameterToTextWriter
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Top
Properties

  NameDescription
Public propertyCacheForPreviewSearch
If true, the search will be cached for future preview searches. Set to false for non-standard searches. If not set, some heuristics will be applied. Default value: null
Public propertyCustomExcludedProperties
Optional: If specified, excluded document property property values are excluded from the returned result, regardless of whether the property is specified as 'return with result' on the index level, or is included in the 'CustomReturnedProperties' collection.
Public propertyCustomProcessingParameters
Optional: Only parameter names specified in this list can be the target of custom parameter processing. If the list is null or empty, no restrictions on parameters are applied. To disable processing completely use the DisableCustomParameterProcessing property.
Public propertyCustomReturnedProperties
Optional: If specified, only document property values in this list are returned for matched documents, regardless of any 'return with result' setting on the index level. If the collection is null or empty (default case), 'return with result' settings on the index level is used to control whether document property data are returned in the search result.
Public propertyDisableAdaptiveRanking
If true, disables the adaptive ranking algorithm. The adaptive ranking algorithm improves search quality using the logged searches and clicks. Disabling this feature may have some performance benefits at the cost of search quality.
Public propertyDisableCustomParameterProcessing
Optional: If true, any custom search parameter processing active on the server will be disabled. This only applies to solutions that use ontology integration or other custom pre-processing of search parameters. Default value: false.
Public propertyEmptySearchStringMatchesAll
Optional: If true and SearchString is null or empty, all documents are matched by the search. Use this parameter in conjunction with the GroupSummation construct to retrieve information about the number of documents across distinct property values. Default value: false
Public propertyExtensionData
Public propertyFacetParameters
Optional: Facet parameters to use for the search. The Parameters and FacetParameters collections form a logical 'union' of parameters, which will all be reflected in the final search result. The difference between the two collections is that when FacetParameters is populated, an extra search is carried out internally by AES which populates SearchResult.PreFacetInfo with the group info and group summation information that would have been obtained _without_ the specified facet parameters. Please refer to the documentation site for more information.
Public propertyFailOnError
If true, a FaultException is emitted if an error occurs during search. Otherwise an empty search result is returned. Default behavior: Fail on error.
Public propertyLogSearch
If true, the search is logged, otherwise the search is not logged. Default value: true
Public propertyLogSearchParameters
If true, search parameters that have LogParameterValues=true and which are specified in the Parameters collection will be logged for the search. Default value: false
Public propertyMaxResults
Specifies the maximum number of results to retrieve when searching. The number of documents returned may be less than the number specified, if the search matches fewer than MaxResults-Offset documents. The maximum allowed value for MaxResults is 1000.
Public propertyOffset
Logical offset (zero-based) of the first document to retrieve in the total result set. The offset parameter is used to control paging, i.e. in order to control whether documents should be returned for the 'first' page of a search result, or for a subsequent page.
Public propertyParameters
Optional: Search profile parameters to use for the search. Parameters are used to control dynamic aspects of a search, and interacts with the xml definition of a search profile. Please refer to the documentation site for more information.
Public propertyPositionLimiter
Optional: Limits search results based on a DocumentData.Position match. Use of this parameters assumes the existence/reference of a search profile criterion targeting the built-in property 'Ankiro.Position'.
Public propertyRefreshCache
If true, the search result cache is bypassed for this search making sure the search is re-executed.
Public propertyRequestedBy
Optional: Used for logging purposes. RequestedBy should contain the ip adress or similar identifiable information for the user on whose behalf the search is carried out. This is logged in the database if LogSearch=true.
Public propertyReturnDiagnostics
If true, diagnostics regarding search time will be returned in the search result.
Public propertyReturnHotspotInformation
If true, populates the HotspotInformation field of matched ResultDocument entries, revealing which terms were matched in individual documents.
Public propertyReturnLegacySearchResult
If true, a legacy XML result will be attached to the SearchResult instance returned by the Search.
Public propertyRoleNames
Optional: Used to filter the search result based on datasource role access information. The collection should contain the set of global user or role names that the user has access to.
Examples

SearchParameters example:
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;
        }
    }
}
Public propertySearchId
SearchId is used in conjunction with paging to control how statistics are saved. When a user performs a search, reviews the first page of returned results and then navigates to a subsequent result page, the documents for the subsequent result page is actually obtained by performing a new search with an updated Offset. SearchId should be used when performing these subsequent searches, setting the value of SearchId to the SearchId returned in the initial SearchResult.
Examples

SearchParameters example:
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;
        }
    }
}
Public propertySearchPaths
Optional: Used to filter the search result based on datasource path hierarchy information. Per default, if the SearchPaths collection is null or empty, all data sources associated with searched index(es) are searched. If at least one entry is contained in the SearchPaths collection, the SearchPaths collection must specify all datasource paths that should be searched (or NOT search through usage of the Exclude SearchBehavior type of the SearchPath class).
Public propertySearchProfileId
Id of the search profile to use when searching.
Public propertySearchString
Specifies the primary search string to search for. The SearchString parameter is accessed in search profile definitions through the 'search-string' parameter.
Public propertySessionId
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.
Examples

SearchParameters example:
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;
        }
    }
}
Public propertySpellcheckSearchString
Optional: If true, the search string is spellchecked and spellcheck suggestions are included in the search. Spellchecking is carried out according to the specified SearchLanguage, controlling the set of phonetic and language-specific rules used, and the dictionaries spellchecked against. Default value: false
Top
See Also