org.compass.core.engine.subindex
Class ConstantSubIndexHash

java.lang.Object
  extended by org.compass.core.engine.subindex.ConstantSubIndexHash
All Implemented Interfaces:
CompassConfigurable, SubIndexHash

public class ConstantSubIndexHash
extends Object
implements SubIndexHash, CompassConfigurable

Alwats returns a constant sub index for any hashing.

If using configuration, expects subIndex as the setting name, and the sub index value as the setting value.

Author:
kimchy

Constructor Summary
ConstantSubIndexHash()
          Construts a new instances, will have to call configure(org.compass.core.config.CompassSettings) in order to configure the sub index.
ConstantSubIndexHash(String subIndex)
          Constructs a new instance based on the given sub index.
 
Method Summary
 void configure(CompassSettings settings)
          Configures the constant sub index hash, expects subIndex as the setting name, and the sub index value as the setting value.
 String[] getSubIndexes()
          Returns the single constant sub index.
 String mapSubIndex(String alias, Property[] ids)
          Returns the single constant sub index.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstantSubIndexHash

public ConstantSubIndexHash()
Construts a new instances, will have to call configure(org.compass.core.config.CompassSettings) in order to configure the sub index.


ConstantSubIndexHash

public ConstantSubIndexHash(String subIndex)
Constructs a new instance based on the given sub index.

Parameters:
subIndex - The constant sub index to use
Method Detail

configure

public void configure(CompassSettings settings)
               throws CompassException
Configures the constant sub index hash, expects subIndex as the setting name, and the sub index value as the setting value.

Specified by:
configure in interface CompassConfigurable
Parameters:
settings - The settings to configure by
Throws:
CompassException

getSubIndexes

public String[] getSubIndexes()
Returns the single constant sub index.

Specified by:
getSubIndexes in interface SubIndexHash

mapSubIndex

public String mapSubIndex(String alias,
                          Property[] ids)
                   throws SearchEngineException
Returns the single constant sub index. Does not take into account either the alias, or the ids.

Specified by:
mapSubIndex in interface SubIndexHash
Parameters:
alias - The alias to compute the sub index by (optional)
ids - The set of ids to compute the sub index by (optional)
Returns:
The hashed sub index
Throws:
SearchEngineException

toString

public String toString()
Overrides:
toString in class Object


Copyright (c) 2004-2008 The Compass Project.