Add-QueryIndex
The Add-QueryIndex PowerShell cmdlet enables the user to add query indexes for the objects to be added in the cache. These query indexes can later be used by the user to search for items in the cache.
Warning
Make sure that the cache has been stopped before proceeding to execute this cmdlet.
Add-QueryIndex -CacheName –AssemblyPath –Attributes -Class [-Server] [-Port] [-Credentials] [-NoLogo]
Examples
- This command adds query index for the attributes CustomerID and FirstName in cache.
Add-QueryIndex -CacheName demoCache -AssemblyPath C:\Data.dll -Class Data.Customer -Attributes CustomerID$FirstName
- This command adds query index for the attribute CustomerID and FirstName in cache on server 20.200.20.11.
Add-QueryIndex -CacheName demoCache -AssemblyPath C:\Data.dll -Class Data.Customer -Attributes CustomerID$FirstName -Server 20.200.20.11
- This command adds JSON-based query index for the attributes CustomerID and FirstName whose data type will be String and Integer respectively in cache on server 20.200.20.11.
Add-QueryIndex -CacheName demoCache -JsonFilePath C:\data.json -Class Data.Customer -Attributes CustomerID$FirstName -AttributeTypes Integer$String -Server 20.200.20.11
- This command adds query index for the attributes CustomerID and FirstName in cache using security credentials.
Add-QueryIndex -CacheName demoCache -AssemblyPath C:\Data.dll -Class Data.Customer -Attributes CustomerID$FirstName -Credentials(Get-Credential john_smith)
Properties
Note
The parameters with asterisk (*) on their names are the required parameters and the rest are optional.
| Parameters | Data Types | Description | Default Value |
|---|---|---|---|
-CacheName* |
<String> |
Specifies the name of the cache for which query indexing needs to be done. Note: The cache must already exist on the source server. |
- |
-AssemblyPath* |
<String> |
Specifies the path of the assembly which needs to be configured. | - |
-Attributes* |
<String> |
Specifies the attributes for query indexing. If multiple attributes need to be indexed; they are separated by a ‘$’. | - |
-Class* |
<String> |
Specifies the fully qualified class name for query indexing. | - |
-Server |
<String> |
Specifies a server name where the NCache Service is running and a cache with the specified cache-name is registered. | IP of local machine |
-Port |
<Integer> |
Specifies the server port where NCache Service is listening. | 8250 |
-Credentials |
<pscredential> |
Specifies the user credentials required to authorize access for the specified operation. These credentials should belong to a user with the appropriate permissions at the node. | - |
-NoLogo |
<SwitchParameter> |
Suppresses display of the logo banner. | False |