Cli-microsoft365: New command: get search results

Created on 12 Feb 2018  路  6Comments  路  Source: pnp/cli-microsoft365

Execute SharePoint Search query

command: spo search -q|--query <query> --sourceId [sourceId] --sourceName [sourceName] --trimDuplicates [trimDuplicates] --allResults -p|--selectProperties [selectProperties] --refinementFilters [refinementFilters] --queryTemplate [queryTemplate] --sortList [sortList] --startRow [startRow] --rowLimit [rowLimit] --rowsPerPage [rowsPerPage] --rankingModelId [rankingModelId] --culture [culture] --refiners [refiners] --hiddenConstraints [hiddenConstraints] --enableStemming [enableStemming] --enablePhonetic [enablePhonetic] --processBestBets [processBestBets] --clientType [clientType] --properties [properties] --enableQueryRules [enableQueryRules] --processPersonalFavorites [processPersonalFavorites] --allResults

  • you can specify either sourceId or sourceName but not both
  • when you specify sourceName and properties the values should be merged into a single properties string
  • allResults - set to retrieve all results

_The goal would be to bring all different parameters to provide full feature to Search like PowerShell._

For more information about the meaning and usage of the different options see https://docs.microsoft.com/en-us/sharepoint/dev/general-development/sharepoint-search-rest-api-overview

For more information about the sample implementation see the Submit-PnPSearchQuery cmdlet

For information about setting the result source name see: http://www.techmikael.com/2015/01/how-to-query-using-result-source-name.html

new feature work in progress

Most helpful comment

@waldekmastykarz because I had too much time on my hands ;)

All 6 comments

Great idea @sebastienlevert. @wobba care to help to spec this command? Eg, which options do you think would be the most valuable (at least for the beginning)?

@waldekmastykarz in prioritized order:

  • query <- KQL
  • sourcename <- better than resultsourceid. SPSite,Name
  • trimduplicates <- default set to false
  • allresults <- loop internally for paging to get all results
  • selectproperties <- specify other mp's than the oob ones
  • refinementfilters <- could be an option to get these instead of results(?)
  • querytemplate
  • sortlist

And then there are all the parameterts of Submit-PnPSearchQuery

How about this spec @wobba? Would this work or missing something important?

@waldekmastykarz should work, but not sure you need all params as @sebastienlevert listed :) But you could them all if you want.

And then there are all the parameterts of Submit-PnPSearchQuery

If I'm not mistaken they are all supported in PnP PoSh 馃槃

@waldekmastykarz because I had too much time on my hands ;)

Was this page helpful?
0 / 5 - 0 ratings