Reference Library
SearchQuery Object
The SearchQuery object is based on the query information that SmartHub receives as a query from SharePoint.
The most important properties of this class are described below:
Property | Description |
---|---|
string QueryText | The search terms entered by the user. |
ResultType ResultTypes |
Flags indicating which type of results should be returned.
Note: The SharePoint 2013 SSA backend returns all result types that match your query, regardless of the values that are specified.
|
int StartRow | Return results starting from this result number (0-based). |
int RowsPerPage | Return this number of results (maximum). |
string Refiners | A comma (,) separated list of refiner names that can be returned for the search results. |
StringCollection SelectProperties | The property names that each search result should contain. |
SortCollection SortList |
This property specifies how the results should be sorted. Each sort in SortList is either a managed property or a rank profile. |
StringCollection RefinementFilters |
A collection of the user-applied refinements. Each string is a refinement token used by SharePoint, which can be deserialized using the |
bool EnableQueryRules |
The default value is |
Guid SiteId | The identifier (ID) for the site associated with the query. |
Guid SourceId | The identifier (ID) for the result source to be used to run the query. |
bool IsPeopleQuery |
Specifies if the query represents a People Search Query. Property assigned within SmartHub according to the result source used for the query. |
bool ShouldProcessQuery |
Should be assigned within backend level query pipeline stages and specifies if the query will be executed against the backend. The default value is |
bool EnableInterleaving |
The default value is |
The SearchQuery
object contains all the properties of the SharePoint KeywordQueryProperties
object, except for the following:
AlertInfo
AuthenticationType
HighlightedSentenceCount
PagingCookie
For more information about the SharePoint KeywordQueryProperties object, see: KeywordQueryProperties members
The SearchQuery
class also contains:
Property | Description |
---|---|
Dictionary<string, object> ExtendedProperties | Reserved for future use. |
SearchResults Object
Member | Description |
---|---|
RelevantResults | The main search results, as a list of SearchResult objects. |
RefinementResults | The refinements to the search, as a list of RefinementResult objects. |
SpecialTermResults | Special term results. |
BestBetResults | Best Bet results. |
VisualBestBetResults | Visual best bet results. |
InterleavedResults | Specifies how result tables generated by the query rules are interleaved within the result set for the original query. |
HighConfidenceResults | High-confidence results. |
QueryTerms | Gets or sets a list of the search terms used by the query. |
ExecutedQuery |
A full copy of the SearchQuery object used to return the results. |
FederatorErrorCollection RuntimeErrors |
Contains the following message types that are generated during a query:
|
PerformanceInfo PerformanceInformation | Stores information about SmartHub performance (time intervals in milliseconds). |
String BackendName | The name of the backend the results came from. |
Boolean SuppressPagination | If true the pagination is ignored, false otherwise. The default value is false. |
Dictionary<string, object> TableCollectionProperties |
Stores the The properties of the main backend have priority in the mixing algorithm. |
Dictionary<string, List<KeyValuePair<string, object>>> TableProperties | Stores the table properties for each result table that is received from the backend (refinement and interleaved results for example). |
Dictionary<string, object> RelevantResultsProperties | Stores the RelevantResults table properties. |
List<ResultBlock> ResultBlocks | Each ResultBlock object contains a list of relevant results that belong to a SharePoint 2013 result block and the result block properties. |
List<PersonalFavoriteResult> PersonalFavoriteResults | Personal favorite results. |
IgnoredNoiseWords | Gets, or sets, the list of ignored noise words. |
SpellingSuggestion |
The Did You Mean? value returned to the user. Only the suggestions from the main backend are returned. |
TotalRelevantResults | The total number of relevant search results. |
TotalRelevantResults IncludingDuplicates |
The total number of relevant search results, including duplicates. |
PeopleSuggestions | A list of strings representing the names of the People results that are returned as suggestions. |
ResultSuggestions | A list of FederatorPersonalResultSuggestion objects that represent item results that are returned as suggestions. |
QuerySuggestions | A list of FederatorQuerySuggestion objects that represent queries that are returned as suggestions. |
A SearchResult
object contains multiple properties that correspond to the SelectProperties
items from the SearchQuery
object (SharePoint asks for some specific list of properties of the search results, such as:
-
Title
-
Url
Description
.)
To work with those properties, you can use the following helper functions defined for the SearchResult
class:
Method | Comments |
---|---|
SearchResultProperty FindProperty(string propertyName)
|
Finds a property in the set of properties of this search result. |
bool ContainsProperty(string propertyName)
|
Check if this search result contains a specific property. |
object GetProperty(string propertyName)
|
Gets the value of a property, or null if the property does not exist. |
void AddProperty(String name, object value)
|
Adds a property to the search result's list of properties. |
void AddOrChangeProperty
(string propertyName, object value)
|
Updates or adds a property to the search result's list of properties. |
Notes
-
All of the above methods use case-insensitive search.
-
The
Properties
property is also available. -
This is a list of
SearchResultProperty
objects. -
A
SearchResultProperty
object contains aName
(string) and aValue
(object). -
The FederatorMetadata property should be ignored, because it is populated and used by SmartHub after the results are returned.
RefineResult Object
Property | Description |
---|---|
RefinerName
|
The name of the refiner (category). |
RefinementName
|
The display name of the refinement (filter item). |
RefinementValue
|
A hidden string bound to the refinement (which the backends can see when the user chooses this refinement). |
RefinementCount
|
Number of results for this refinement. |
FederatorPersonalResultSuggestion Object
Property | Description |
---|---|
Title
|
The title of the result. |
Url
|
The URL of the result suggestion. |
IsBestBet
|
Specifies if the returned result is a best bet item. |
HighlightedTitle
|
The title including hit highlighting for the current query. |
ClickCount
|
Number of times the suggestion was selected. |
FederatorQuerySuggestion Object
Property | Description |
---|---|
IsPersonal
|
Specifies whether the suggestion is generated based on the current user running the search. |
Query
|
The text of the query suggestion being returned. |
QueryBeforeHithighlighting
|
The text of the query suggestion without hit highlighting. |