Search Results for

    Show / Hide Table of Contents

    Submit-PnPSearchQuery

    SYNOPSIS

    Executes an arbitrary search query against the SharePoint search index

    SYNTAX

    Limit (Default)

    Submit-PnPSearchQuery [-Query] <String> [-StartRow <Int32>] [-MaxResults <Int32>] [-TrimDuplicates <Boolean>]
     [-Properties <Hashtable>] [-Refiners <String>] [-Culture <Int32>] [-QueryTemplate <String>]
     [-SelectProperties <String[]>] [-RefinementFilters <String[]>] [-SortList <Hashtable>]
     [-RankingModelId <String>] [-ClientType <String>] [-CollapseSpecification <String>]
     [-HiddenConstraints <String>] [-TimeZoneId <Int32>] [-EnablePhonetic <Boolean>] [-EnableStemming <Boolean>]
     [-EnableQueryRules <Boolean>] [-SourceId <Guid>] [-ProcessBestBets <Boolean>]
     [-ProcessPersonalFavorites <Boolean>] [-RelevantResults] [-Connection <PnPConnection>]
     
    

    All

    Submit-PnPSearchQuery [-Query] <String> [-All] [-TrimDuplicates <Boolean>] [-Properties <Hashtable>]
     [-Refiners <String>] [-Culture <Int32>] [-QueryTemplate <String>] [-SelectProperties <String[]>]
     [-RefinementFilters <String[]>] [-SortList <Hashtable>] [-RankingModelId <String>] [-ClientType <String>]
     [-CollapseSpecification <String>] [-HiddenConstraints <String>] [-TimeZoneId <Int32>]
     [-EnablePhonetic <Boolean>] [-EnableStemming <Boolean>] [-EnableQueryRules <Boolean>] [-SourceId <Guid>]
     [-ProcessBestBets <Boolean>] [-ProcessPersonalFavorites <Boolean>] [-RelevantResults] 
     [-Connection <PnPConnection>] 
    

    DESCRIPTION

    Allows to run an arbitrary search query against the SharePoint search index.

    EXAMPLES

    EXAMPLE 1

    Submit-PnPSearchQuery -Query "finance"
    

    Returns the top 500 items with the term finance

    EXAMPLE 2

    Submit-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

    Submit-PnPSearchQuery -Query "Title:Intranet*" -All
    

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

    EXAMPLE 4

    Submit-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

    EXAMPLE 5

    Submit-PnPSearchQuery -Query "contentclass:STS_ListItem_DocumentLibrary" -SelectProperties ComplianceTag,InformationProtectionLabelId -All
    

    Returns absolutely all items indexed by SharePoint Search which represent a document in a document library and instructs explicitly to return the managed properties InformationProtectionLabelId and ComplianceTag which will give insight into the sensitivity and retention labels assigned to the documents

    PARAMETERS

    -All

    Automatically page results until the end to get more than 500. Use with caution!

    Type: SwitchParameter
    Parameter Sets: All
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -ClientType

    Specifies the name of the client which issued the query.

    Type: String
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -CollapseSpecification

    Limit the number of items per the collapse specification. See https://learn.microsoft.com/sharepoint/dev/general-development/customizing-search-results-in-sharepoint#collapse-similar-search-results-using-the-collapsespecification-property for more information.

    Type: String
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -Connection

    Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

    Type: PnPConnection
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -Culture

    The locale for the query.

    Type: Int32
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -EnablePhonetic

    Specifies whether the phonetic forms of the query terms are used to find matches.

    Type: Boolean
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -EnableQueryRules

    Specifies whether Query Rules are enabled for this query.

    Type: Boolean
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -EnableStemming

    Specifies whether stemming is enabled.

    Type: Boolean
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -HiddenConstraints

    The keyword query's hidden constraints.

    Type: String
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -MaxResults

    Maximum amount of search results to return. Default and max per page is 500 search results.

    Type: Int32
    Parameter Sets: Limit
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -ProcessBestBets

    Determines whether Best Bets are enabled.

    Type: Boolean
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -ProcessPersonalFavorites

    Determines whether personal favorites data is processed or not.

    Type: Boolean
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -Properties

    Extra query properties. Can for example be used for Office Graph queries.

    Type: Hashtable
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -Query

    Search query in Keyword Query Language (KQL).

    Type: String
    Parameter Sets: (All)
    
    Required: True
    Position: 0
    Default value: None
    Accept pipeline input: True (ByValue)
    Accept wildcard characters: False
    

    -QueryTemplate

    Specifies the query template that is used at run time to transform the query based on user input.

    Type: String
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -RankingModelId

    The identifier (ID) of the ranking model to use for the query.

    Type: String
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -RefinementFilters

    The set of refinement filters used, separated by a comma.

    Type: String[]
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -Refiners

    The list of refiners to be returned in a search result.

    Type: String
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -RelevantResults

    Specifies whether only relevant results are returned

    Type: SwitchParameter
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -SelectProperties

    The list of properties to return in the search results, separated by a comma. I.e. ComplianceTag,InformationProtectionLabelId.

    Type: String[]
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -SortList

    The list of properties by which the search results are ordered.

    Type: Hashtable
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -SourceId

    Specifies the identifier (ID or name) of the result source to be used to run the query.

    Type: Guid
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -StartRow

    Search result item to start returning the results from. Useful for paging. Leave at 0 to return all results.

    Type: Int32
    Parameter Sets: Limit
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -TimeZoneId

    The identifier for the search query time zone.

    Type: Int32
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -TrimDuplicates

    Specifies whether near duplicate items should be removed from the search results.

    Type: Boolean
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    RELATED LINKS

    Microsoft 365 Patterns and Practices

    Back to top Generated by DocFX spacer