Configuring the InverseRangeIndex plug-in
You can configure the built-in InverseRangeIndex, the com.ibm.websphere.objectgrid.plugins.index.InverseRangeIndex class, with an XML file or programmatically.
Before you begin
- In a partitioned environment, one of the key requirements for InverseRangeIndex is a data partition that is based on the non-range attributes configured for a given index. All cache entries and search keys with the same value of non-range attributes must be routed to the same partition. For more information about partitioning, see Routing cache objects to the same partition.
- InverseRangeIndex is a MapIndexPlugin implementation. MapIndexPlugin can only be accessed from the server-side of the object grid and not the client-side. To perform search operations on the client-side, you can implement the MapGridAgent interface. For more information, see DataGrid API example.
About this task
ProductName | StartPromotionDate | EndPromotionDate | MinimumRAM | MaximumRAM | Condition | Country | Price |
---|---|---|---|---|---|---|---|
PC01 | 01/01/11 | 12/31/11 | 2 | 4 | Good | US | 199 |
PC01 | 01/01/11 | 12/31/11 | 6 | 8 | Good | US | 259 |
PC01 | 01/01/12 | 12/31/12 | 2 | 4 | Good | US | 299 |
PC01 | 01/01/12 | 12/31/12 | 2 | 8 | Good | US | 499 |
PC02 | 01/01/08 | 12/31/10 | 2 | 4 | Good | US | 99 |
PC02 | 01/01/10 | 12/31/11 | 2 | 4 | Good | US | 289 |
PC02 | 01/01/12 | 12/31/12 | 4 | 6 | Good | US | 389 |
public class ProductKey {
String productName;
Date startPromotionDate;
Date endPromotionDate;
Integer minimumRAM;
Integer maximumRAM;
String condition;
String country;
}
The search key class ProductSearchKey has five attributes
that search for range style data: productName, promotionDate, RAM,
condition, and country. The following objects are used in the MapIndexPlugin
operation:public class ProductSearchKey {
String productName;
Date promotionDate;
Integer RAM;
String condition;
String country;
}
Based on these classes, the InverseRangeIndex can be configured with AttributeName property
as: key.productName, promotionDate[key.startPromotionDate, key.endPromotionDate],
RAM[key.minimumRAM,key.maximumRAM], condition[key.condition], key.country
For more information about the syntax of AttributeName, see InverseRangeIndex plug-in attributes.Procedure
Use the backingMapPluginCollections element to define the plug-in:
<bean id="MapIndexPlugin"
className="com.ibm.websphere.objectgrid.plugins.index.InverseRangeIndex">
<property name="Name" type="java.lang.String" value="productData"/>
<property name="AttributeName" type="java.lang.String" value="key.productName,
promotionDate[key.startPromotionDate, key.endPromotionDate],
RAM[key.minimumRAM,key.maximumRAM],
condition[key.condition], key.country"/>
</bean>
For more information about the backingMapPluginCollections
element, see ObjectGrid descriptor XML file.