Class Indexer<T>

java.lang.Object
jadex.providedservice.impl.search.Indexer<T>

public class Indexer<T> extends Object
Indexer for values.
  • Field Details

    • INTERSECT_CUTOFF

      public static final int INTERSECT_CUTOFF
      Cutoff value for building index set intersections.
      See Also:
    • keyextractor

      protected IKeyExtractor<T> keyextractor
      Service key extractor.
    • values

      protected Set<T> values
      All values.
    • indexedvalues

      protected Map<String,Map<String,Set<T>>> indexedvalues
      The index of published values. First string is the index key name.
    • includenull

      protected boolean includenull
      Include null values during indexing.
  • Constructor Details

    • Indexer

      public Indexer(IKeyExtractor<T> keyextractor, boolean includenull, String... indextypes)
      Create a new ServiceIndexer.
  • Method Details

    • isIndexed

      public boolean isIndexed(String indexname)
      Test if a property is indexed per name.
      Parameters:
      indexname - The index name.
      Returns:
      True, if is indexed.
    • getValues

      public jadex.common.Tuple2<Set<T>,Object> getValues(List<jadex.common.Tuple3<String,String[],Boolean>> spec)
      Get values per specification. 'And' relates to inter-term, i.e. example type=ICMS, tags=a,b means an object must have both fulfilled. For multi-valued intra-term values it can be 'and' or 'or' as well.
      Parameters:
      spec - The key values (first element is key name and array are values)
      Returns:
      The values matching the spec.
    • getValuesInverted

      public Set<T> getValuesInverted(List<jadex.common.Tuple2<String,String[]>> spec)
      Get values per specification (multivalues considered as OR match, when queries are the values).
      Parameters:
      spec - The key values (first element is key name and array are values)
      Returns:
      The values matching the spec.
    • getValues

      public Set<T> getValues(String keytype, String key)
      Get values per type.
      Parameters:
      keytype - the key type.
      key - The key value.
      Returns:
      The values matching the key.
    • getAllValues

      public Set<T> getAllValues()
      Returns all values.
      Returns:
      All values.
    • addValue

      public void addValue(T value)
      Add a value to the indexer.
      Parameters:
      value - The value.
    • removeValue

      public void removeValue(T value)
      Remove a value from the indexer.
      Parameters:
      value - The value.
    • match

      public boolean match(List<jadex.common.Tuple3<String,String[],Boolean>> spec, T value)
      Tests if the search specification matches a value (spec=query).
      Parameters:
      value - The value.
      Returns:
      True, if the value matches.
    • matchOr

      public boolean matchOr(List<jadex.common.Tuple2<String,String[]>> spec, T value)
      Tests if the search specification matches a value (spec=service, value=query).
      Parameters:
      value - The value.
      Returns:
      True, if the value matches.
    • getKeyExtractor

      public IKeyExtractor<T> getKeyExtractor()
      Gets the key extractor used by the service.
      Returns:
      The key extractor.
    • clear

      public void clear()
      Clears all contained values.
    • updateIndex

      public void updateIndex(String indexname)
      Update an index for all values.