Configuring Query Indexes
Indexes are used in querying for efficiency, and are based on the type of a class. The user may further specify the attributes of the class on which indexes are required. Query Indexes can be configured in the following ways:
Add Query Indexes
Using NCache Manager
Click on the cache name in Cache Explorer to open cache settings.
Go to Query Indexes tab.
Click Add.
Select Query Indices wizard will open. Click Browse to browse for required assembly. Select the assembly.
Assembly and all its classes will be listed in Selected Assemblies section.
Select the required classes by checking the check box and click Add Class button.
List of selected classes along with its attributes will be listed down in List of selected Classes section. Select the attributes you want to add indexes for and click OK.
Note
NCache Manager displays all private members and properties of selected class. Select either private members or properties.
Select Query Indexes wizard will close and selected classes and their attributes will appear in ‘Selected Classes and their attributes’ section of ‘Query Indexes’ tab.
Right click on the cache name in Cache Explorer and select Apply Configuration option.
Using Windows PowerShell
Add-QueryIndex
cmdlet enables the user to add query indexes for the objects to be added in the cache.
The following command adds ProductID, ProductName, Category, Supplier and UnitsAvailable attributes from the class Data.Product in query indexes for demoLocalCache
Add-QueryIndex demoLocalCache -AssemblyPath C:\Data.dll -Class Data.Product -Attributes ProductID$ProductName$Category$UnitsAvailable
Removing Query Indexes
Pre-defined query indexes can be removed by the user using the following steps.
Using NCache Manager
Select the Cache name from Cache Explorer for which query indexing is to be removed.
Go to the Query Indexes tab.
Select the Indexes to be removed by checking the box and select Remove.
Using Windows PowerShell
Remove-QueryIndex
cmdlet enables the user to remove pre-defined query indexes
for the objects to be added in the cache.
The following command removes query indexing for the class Customers using default port 8250.
Remove-QueryIndex -CacheName demoClusteredCache -Class Data.Customer