Import-SPEnterpriseSearchPopularQueries

從逗號分隔清單匯入查詢。 搜尋方塊會在使用者輸入時建議這些查詢。

Syntax

Import-SPEnterpriseSearchPopularQueries
      -ResultSource <Source>
      -SearchApplicationProxy <SearchServiceApplicationProxyPipeBind>
      -Web <SPWeb>
      [-AssignmentCollection <SPAssignmentCollection>]
      [-Confirm]
      [-Filename <String>]
      [-WhatIf]
      [<CommonParameters>]

Description

The Import-SPEnterpriseSearchPopularQueries cmdlet imports queries from a comma-separated list. As the user types a query in the search box, the search box will suggest queries from the comma-separated list. The search box bases these suggestions on:

  • 搜尋方塊所在的 SPWeb。
  • 搜尋方塊上設定的結果來源。

例如,如果搜尋方塊位於 「Engineering」 SPWeb 上,則建議的查詢會與搜尋方塊位於 「Management」 SPWeb 上不同。 同樣地,如果搜尋方塊上的 [結果來源] 是 [本機 SharePoint 結果],則建議的查詢會與 [結果來源] 為 [交談] 不同。

逗號分隔清單必須一行顯示一個查詢,其中每行包含下列項目:

查詢文字。 實際的查詢運算式。

查詢計數。 執行此查詢的次數。

按一下 [計數]。 任何使用者針對此查詢按一下任何結果的次數。

Lcid。 查詢語言 (LCID) 地區設定識別碼。

Each line must use the formatting: Query Text,Query Count,Click Count,LCID. For example, Company store,100,80,1033. For suggestions to appear in the search box, the Click Count value must be more than five. The search box ranks query suggestions by their Click Count values (approximately).

如需適用於 SharePoint 產品的 Windows PowerShell 權限及最新資訊,請參閱線上文件 SharePoint Server Cmdlet

範例

--------EXAMPLE--------

$ssap = Get-SPEnterpriseSearchServiceApplicationProxy
$hostname = hostname
$web = get-spsite | get-spweb | where {$_.Url-eq "https://$hostname"}
$owner = new-object Microsoft.Office.Server.Search.Administration.SearchObjectOwner -ArgumentList @([Microsoft.Office.Server.Search.Administration.SearchObjectLevel]::SPWeb,$web)
$mgr = new-object Microsoft.Office.Server.Search.Administration.Query.FederationManager -ArgumentList $ssap
$source = $mgr.GetSourceByName("Local SharePoint Results", $owner)
Import-SPEnterpriseSearchPopularQueries -SearchApplicationProxy $ssap -Filename C:\input.txt -ResultSource $source -Web $web

此範例會使用 Import-SPEnterpriseSearchPopularQueries Cmdlet 匯入查詢檔案 C:\input.txt,並將此檔案關聯至 $source 參照的結果來源及 $web 參照的 SPWeb。 此範例會將變數$web定義為具有 URL https://hostname 的 SPWeb,並將變數$source為$web所參考之 SPWeb 上名為「本機 SharePoint 結果」的結果來源。

參數

-AssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Type:SPAssignmentCollection
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Confirm

在執行命令之前,提示您確認操作。 如需詳細資訊,請輸入下列命令:get-help about_commonparameters

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Filename

指定要匯入之檔案的完整 UNC (通用命名慣例) 路徑。

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-ResultSource

指定要與已匯入查詢建立關聯的結果來源。 此類型必須是有效的來源物件執行個體。

Type:Source
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-SearchApplicationProxy

Specifies the proxy for the search application to which the queries file should be imported. The type must be a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; a valid search application proxy name (for example, SearchAppProxy1); or an instance of a valid SearchServiceApplicationProxy object.

Type:SearchServiceApplicationProxyPipeBind
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Web

指定要與已匯入查詢建立關聯的 SPWeb。 此類型必須是有效的 SPWeb 物件執行個體。

Type:SPWeb
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-WhatIf

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition