New-SPEnterpriseSearchQueryComponent

 

Applies to: SharePoint Server 2010

Topic Last Modified: 2010-02-11

Adds a query component to a query topology.

Syntax

New-SPEnterpriseSearchQueryComponent -IndexPartition <IndexPartitionPipeBind> -QueryTopology <QueryTopologyPipeBind> -SearchServiceInstance <SearchServiceInstancePipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-FailoverOnly <SwitchParameter>] [-IndexLocation <String>] [-SearchApplication <SearchServiceApplicationPipeBind>] [-ShareName <String>] [-WhatIf [<SwitchParameter>]]

Detailed Description

The New-SPEnterpriseSearchQueryComponent cmdlet is used when the search functionality is initially configured and a new query component is added to a shared search application. A query topology has one or more index partitions and one or more query components. Query components perform user query-generated full-text term search in index partitions.

Parameters

Parameter Required Type Description

IndexPartition

Required

Microsoft.Office.Server.Search.Cmdlet.IndexPartitionPipeBind

Specifies the index partition to use for the query component.

The type must be a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh, or an instance of a valid IndexPartition object.

QueryTopology

Required

Microsoft.Office.Server.Search.Cmdlet.QueryTopologyPipeBind

Specifies the query topology that contains the query component collection.

The type must be a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh, or an instance of a valid QueryTopology object.

SearchServiceInstance

Required

Microsoft.Office.Server.Search.Cmdlet.SearchServiceInstancePipeBind

Specifies the search service instance to host the new query component.

The type must be a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; a valid name of a query server, in the form MyQueryServer; or an instance of a valid SearchServiceInstance object.

AssignmentCollection

Optional

Microsoft.SharePoint.PowerShell.SPAssignmentCollection

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.

Note

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.

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

FailoverOnly

Optional

System.Management.Automation.SwitchParameter

Specifies whether the query component is used for failover.

IndexLocation

Optional

System.String

Specifies the path to the index directory where the full-text index files are created.

The type must be a valid path in either of the following forms:

- C:\ folder_name

- \\server_name\folder_name

SearchApplication

Optional

Microsoft.Office.Server.Search.Cmdlet.SearchServiceApplicationPipeBind

Specifies the search application that contains the query topology.

The type must be a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; a valid search application name (for example, SearchApp1); or an instance of a valid SearchServiceApplication object.

ShareName

Optional

System.String

Specifies the name for the file share at the path specified in IndexLocation. The string must contain only characters valid in a UNC path.

The type must be a valid name of a file share; for example, FileShare1.

WhatIf

Optional

System.Management.Automation.SwitchParameter

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

Input Types

Return Types

Example

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

$ssa = GetSPEnterpriseSearchServiceApplication
$qtOld = $ssa | Get-SPEnterpriseSearchQueryTopology -Active
$ssInstance = Get-SPEnterpriseSearchServiceInstance -Local
$qtNew = $ssa | New-SPEnterpriseSearchQueryTopology -Partitions 1 
$idxPartition = (Get-SPEnterpriseSearchIndexPartition -QueryTopology $qtOld)
$queryComponent = New-SPEnterpriseSearchQuerycomponent -QueryTopology $qtNew -IndexPartition $idxPartition -SearchServiceInstance $ssInstance
$qtNew | Set-SPEnterpriseSearchQueryTopology -Active
$qtOld | Remove-SPEnterpriseSearchQueryTopology

This example creates a query topology with a single partition and creates a query component for that topology. It then sets the newly-created query topology as the active query topology of a search application named MySSA, and deletes the old topology.