| java.lang.Object org.compass.core.engine.subindex.ModuloSubIndexHash
ModuloSubIndexHash | public class ModuloSubIndexHash implements SubIndexHash,CompassConfigurable(Code) | | Uses a hash function based on hash code computation of alias and ids,
and using the modulo operation against the configured size.
The sub index name is prefix_(hashCode % size) .
If using configuration, expects prefix as the setting name,
and size as the modulo right hand side operation.
author: kimchy |
Constructor Summary | |
public | ModuloSubIndexHash() Constructs a new instance, will have to be configured. | public | ModuloSubIndexHash(String prefix, int size) Constructs a new instance, using the given prefix and size. |
Method Summary | |
public void | configure(CompassSettings settings) Using configuration, expects prefix as the setting name,
and size as the modulo right hand side operation. | public String[] | getSubIndexes() Returns all the sub indexes possible, basically in the form of
prefix_(0..size) (not including size). | public String | mapSubIndex(String alias, Property[] ids) Computes the hash code of alias and all the ids, and then modulo it by size. | public String | toString() |
ModuloSubIndexHash | public ModuloSubIndexHash()(Code) | | Constructs a new instance, will have to be configured.
|
ModuloSubIndexHash | public ModuloSubIndexHash(String prefix, int size)(Code) | | Constructs a new instance, using the given prefix and size.
Parameters: prefix - The prefix sed for the sub index prefix name Parameters: size - The size the modulo will be used |
configure | public void configure(CompassSettings settings) throws CompassException(Code) | | Using configuration, expects prefix as the setting name,
and size as the modulo right hand side operation.
Parameters: settings - The setting to configure by throws: CompassException - |
getSubIndexes | public String[] getSubIndexes()(Code) | | Returns all the sub indexes possible, basically in the form of
prefix_(0..size) (not including size).
|
mapSubIndex | public String mapSubIndex(String alias, Property[] ids) throws SearchEngineException(Code) | | Computes the hash code of alias and all the ids, and then modulo it by size.
The prefix is prepended (with an underscore), and the sub index is constructed.
The formula is: prefix_(hashCode % size) .
|
|
|