Class IndexInfo

java.lang.Object
org.basex.query.util.index.IndexInfo

public final class IndexInfo extends Object
This class contains methods for storing information on new index expressions.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • cc

      public final CompileContext cc
      Compilation context.
    • db

      public final IndexDb db
      Index database.
    • step

      public final Step step
      Step with predicate that can be rewritten for index access.
    • optInfo

      public String optInfo
      Optimization info.
    • test

      public NameTest test
      Name test of parent element.
    • expr

      public Expr expr
      Index expression.
    • costs

      public IndexCosts costs
      Costs of index access (null) if no index access is possible).
  • Constructor Details

    • IndexInfo

      public IndexInfo(IndexDb db, CompileContext cc, Step step)
      Constructor.
      Parameters:
      db - index database
      cc - compilation context
      step - step containing the rewritable predicate
  • Method Details

    • type

      public IndexType type(Expr input, IndexType type)
      Checks if the specified expression can be rewritten for index access, and returns the applicable index type.
      Parameters:
      input - input (if null, no optimization will be possible)
      type - index type, predefined by the called expression (can be null)
      Returns:
      supplied type, IndexType.TEXT, IndexType.ATTRIBUTE, or null if index access is not possible
    • create

      public boolean create(Expr search, IndexType type, boolean trim, InputInfo ii) throws QueryException
      Tries to rewrite the specified input for index access.
      Parameters:
      search - expression to find (can be null)
      type - index type (can be null)
      trim - normalize second string
      ii - input info (can be null)
      Returns:
      success flag
      Throws:
      QueryException - query exception
    • create

      public void create(ParseExpr root, boolean parent, String opt, InputInfo ii) throws QueryException
      Creates an index expression with an inverted axis path.
      Parameters:
      root - new root expression
      parent - add parent step
      opt - optimization info
      ii - input info
      Throws:
      QueryException - query exception
    • costs

      public IndexCosts costs(Data data, IndexSearch search)
      Computes costs if the specified data reference exists.
      Parameters:
      data - data reference
      search - index search definition
      Returns:
      costs costs, or null if index access is not possible
    • enforce

      public boolean enforce()
      Indicates if the index rewriting should be enforced.
      Returns:
      result of check