public class Indexer<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
includenull
Include null values during indexing.
|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<T>>> |
indexedvalues
The index of published values.
|
static int |
INTERSECT_CUTOFF
Cutoff value for building index set intersections.
|
protected IKeyExtractor<T> |
keyextractor
Service key extractor.
|
protected java.util.Set<T> |
values
All values.
|
Constructor and Description |
---|
Indexer(IKeyExtractor<T> keyextractor,
boolean includenull,
java.lang.String... indextypes)
Create a new ServiceIndexer.
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(T value)
Add a value to the indexer.
|
void |
clear()
Clears all contained values.
|
java.util.Set<T> |
getAllValues()
Returns all values.
|
IKeyExtractor<T> |
getKeyExtractor()
Gets the key extractor used by the service.
|
java.util.Set<T> |
getValues(java.util.List<Tuple3<java.lang.String,java.lang.String[],java.lang.Boolean>> spec)
Get values per specification.
|
java.util.Set<T> |
getValues(java.lang.String keytype,
java.lang.String key)
Get values per type.
|
java.util.Set<T> |
getValuesInverted(java.util.List<Tuple2<java.lang.String,java.lang.String[]>> spec)
Get values per specification (multivalues considered as OR match, when queries are the values).
|
boolean |
isIndexed(java.lang.String indexname)
Test if a property is indexed per name.
|
static void |
main(java.lang.String[] args)
Main for testing.
|
boolean |
match(java.util.List<Tuple3<java.lang.String,java.lang.String[],java.lang.Boolean>> spec,
T value)
Tests if the search specification matches a value (spec=query).
|
boolean |
matchOr(java.util.List<Tuple2<java.lang.String,java.lang.String[]>> spec,
T value)
Tests if the search specification matches a value (spec=service, value=query).
|
void |
removeValue(T value)
Remove a value from the indexer.
|
void |
updateIndex(java.lang.String indexname)
Update an index for all values.
|
public static final int INTERSECT_CUTOFF
protected IKeyExtractor<T> keyextractor
protected java.util.Set<T> values
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<T>>> indexedvalues
protected boolean includenull
public Indexer(IKeyExtractor<T> keyextractor, boolean includenull, java.lang.String... indextypes)
public boolean isIndexed(java.lang.String indexname)
indexname
- The index name.public java.util.Set<T> getValues(java.util.List<Tuple3<java.lang.String,java.lang.String[],java.lang.Boolean>> spec)
spec
- The key values (first element is key name and array are values)public java.util.Set<T> getValuesInverted(java.util.List<Tuple2<java.lang.String,java.lang.String[]>> spec)
spec
- The key values (first element is key name and array are values)public java.util.Set<T> getValues(java.lang.String keytype, java.lang.String key)
keytype
- the key type.key
- The key value.public java.util.Set<T> getAllValues()
public void addValue(T value)
value
- The value.public void removeValue(T value)
value
- The value.public boolean match(java.util.List<Tuple3<java.lang.String,java.lang.String[],java.lang.Boolean>> spec, T value)
value
- The value.public boolean matchOr(java.util.List<Tuple2<java.lang.String,java.lang.String[]>> spec, T value)
value
- The value.public IKeyExtractor<T> getKeyExtractor()
public void clear()
public void updateIndex(java.lang.String indexname)
public static void main(java.lang.String[] args)