Table of contents
TOC
Collapse the table of content
Expand the table of content

Submit-PnPSearchQuery

Bert Jansen|Last Updated: 2/20/2017
|
1 Contributor

Executes an arbitrary search query against the SharePoint search index

Syntax

Submit-PnPSearchQuery -Query <String>
                      [-StartRow <Int>]
                      [-MaxResults <Int>]
                      [-TrimDuplicates <Boolean>]
                      [-Properties <Hashtable>]
                      [-Refiners <String>]
                      [-Culture <Int>]
                      [-QueryTemplate <String>]
                      [-SelectProperties <String[]>]
                      [-RefinementFilters <String[]>]
                      [-SortList <Hashtable>]
                      [-RankingModelId <String>]
                      [-ClientType <String>]
                      [-HiddenConstraints <String>]
                      [-TimeZoneId <Int>]
                      [-EnablePhonetic <Boolean>]
                      [-EnableStemming <Boolean>]
                      [-EnableQueryRules <Boolean>]
                      [-SourceId <Guid>]
                      [-ProcessBestBets <Boolean>]
                      [-ProcessPersonalFavorites <Boolean>]
                      [-Web <WebPipeBind>]
Submit-PnPSearchQuery -Query <String>
                      [-All [<SwitchParameter>]]
                      [-TrimDuplicates <Boolean>]
                      [-Properties <Hashtable>]
                      [-Refiners <String>]
                      [-Culture <Int>]
                      [-QueryTemplate <String>]
                      [-SelectProperties <String[]>]
                      [-RefinementFilters <String[]>]
                      [-SortList <Hashtable>]
                      [-RankingModelId <String>]
                      [-ClientType <String>]
                      [-HiddenConstraints <String>]
                      [-TimeZoneId <Int>]
                      [-EnablePhonetic <Boolean>]
                      [-EnableStemming <Boolean>]
                      [-EnableQueryRules <Boolean>]
                      [-SourceId <Guid>]
                      [-ProcessBestBets <Boolean>]
                      [-ProcessPersonalFavorites <Boolean>]
                      [-Web <WebPipeBind>]

Returns

List

Parameters

ParameterTypeRequiredDescription
QueryStringTrueSearch query in Keyword Query Language (KQL).
AllSwitchParameterFalseAutomatically page results until the end to get more than 500. Use with caution!
ClientTypeStringFalseSpecifies the name of the client which issued the query.
CultureIntFalseThe locale for the query.
EnablePhoneticBooleanFalseSpecifies whether the phonetic forms of the query terms are used to find matches.
EnableQueryRulesBooleanFalseSpecifies whether Query Rules are enabled for this query.
EnableStemmingBooleanFalseSpecifies whether stemming is enabled.
HiddenConstraintsStringFalseThe keyword query’s hidden constraints.
MaxResultsIntFalseMaximum amount of search results to return. Default and max per page is 500 search results.
ProcessBestBetsBooleanFalseDetermines whether Best Bets are enabled.
ProcessPersonalFavoritesBooleanFalseDetermines whether personal favorites data is processed or not.
PropertiesHashtableFalseExtra query properties. Can for example be used for Office Graph queries.
QueryTemplateStringFalseSpecifies the query template that is used at run time to transform the query based on user input.
RankingModelIdStringFalseThe identifier (ID) of the ranking model to use for the query.
RefinementFiltersString[]FalseThe set of refinement filters used.
RefinersStringFalseThe list of refiners to be returned in a search result.
SelectPropertiesString[]FalseThe list of properties to return in the search results.
SortListHashtableFalseThe list of properties by which the search results are ordered.
SourceIdGuidFalseSpecifies the identifier (ID or name) of the result source to be used to run the query.
StartRowIntFalseSearch result item to start returning the results from. Useful for paging. Leave at 0 to return all results.
TimeZoneIdIntFalseThe identifier for the search query time zone.
TrimDuplicatesBooleanFalseSpecifies whether near duplicate items should be removed from the search results.
WebWebPipeBindFalseThe web to apply the command to. Omit this parameter to use the current web.

Examples

Example 1

PS:> Get-PnPSearchQuery -Query "finance"

Returns the top 500 items with the term finance

Example 2

PS:> Get-PnPSearchQuery -Query "Title:Intranet*" -MaxResults 10

Returns the top 10 items indexed by SharePoint Search of which the title starts with the word Intranet

Example 3

PS:> Get-PnPSearchQuery -Query "Title:Intranet*" -All

Returns absolutely all items indexed by SharePoint Search of which the title starts with the word Intranet

Example 4

PS:> Get-PnPSearchQuery -Query "Title:Intranet*" -Refiners "contentclass,FileType(filter=6/0/*)"

Returns absolutely all items indexed by SharePoint Search of which the title starts with the word Intranet, and return refiners for contentclass and FileType managed properties

© 2017 Microsoft