java.lang.Object
org.alfresco.repo.search.impl.elasticsearch.query.language.lucene.LuceneXPathHandler
All Implemented Interfaces:
org.jaxen.saxpath.XPathHandler

public class LuceneXPathHandler extends Object implements org.jaxen.saxpath.XPathHandler
  • Field Details

    • MAX_PATH_LENGTH

      public static final int MAX_PATH_LENGTH
      Elasticsearch does not support span near queries with unlimited slop. Instead we support wildcard xpaths by using a hard coded maximum that is larger than we expect any path query to use.
      See Also:
  • Constructor Details

    • LuceneXPathHandler

      public LuceneXPathHandler(String field)
  • Method Details

    • startXPath

      public void startXPath()
      Specified by:
      startXPath in interface org.jaxen.saxpath.XPathHandler
    • endXPath

      public void endXPath()
      Specified by:
      endXPath in interface org.jaxen.saxpath.XPathHandler
    • getQuery

      public org.apache.lucene.queries.spans.SpanQuery getQuery()
      Get the resulting query
      Returns:
      - the query
    • startAbsoluteLocationPath

      public void startAbsoluteLocationPath()
      An absolute location xPath starts with /
      Specified by:
      startAbsoluteLocationPath in interface org.jaxen.saxpath.XPathHandler
    • startRelativeLocationPath

      public void startRelativeLocationPath()
      A relative location xPath starts with //
      Specified by:
      startRelativeLocationPath in interface org.jaxen.saxpath.XPathHandler
    • startAllNodeStep

      public void startAllNodeStep(int axis)
      Any time we meet a //, we close a near span e.g. /a/b//c Once we meet // we close the /a/b span
      Specified by:
      startAllNodeStep in interface org.jaxen.saxpath.XPathHandler
      Parameters:
      axis -
    • endAbsoluteLocationPath

      public void endAbsoluteLocationPath()
      Any time an absolute XPath ends, we close a near span e.g. /a/b//c Once we meet the end we close the c span
      Specified by:
      endAbsoluteLocationPath in interface org.jaxen.saxpath.XPathHandler
    • endRelativeLocationPath

      public void endRelativeLocationPath()
      Any time a relative XPath ends, we close a near span e.g. /a/b//* Once we meet the end we close the * span adding a wildcard span term
      Specified by:
      endRelativeLocationPath in interface org.jaxen.saxpath.XPathHandler
    • startNameStep

      public void startNameStep(int axis, String nameSpace, String localName)
      Any time we meet a namespace:localName in the path we reach this point: e.g. /namespace:a//namespace:b namespace:a calls this method descending a child axis namespace:b calls this method descending a child axis
      Specified by:
      startNameStep in interface org.jaxen.saxpath.XPathHandler
      Parameters:
      axis - - the XPath axis we are descending into
      nameSpace - - the nameSpace of the current element
      localName - - the local name of the current element
    • endNameStep

      public void endNameStep()
      Specified by:
      endNameStep in interface org.jaxen.saxpath.XPathHandler
    • endAllNodeStep

      public void endAllNodeStep()
      Specified by:
      endAllNodeStep in interface org.jaxen.saxpath.XPathHandler
    • endAdditiveExpr

      public void endAdditiveExpr(int op)
      Specified by:
      endAdditiveExpr in interface org.jaxen.saxpath.XPathHandler
    • endAndExpr

      public void endAndExpr(boolean create)
      Specified by:
      endAndExpr in interface org.jaxen.saxpath.XPathHandler
    • endCommentNodeStep

      public void endCommentNodeStep()
      Specified by:
      endCommentNodeStep in interface org.jaxen.saxpath.XPathHandler
    • endEqualityExpr

      public void endEqualityExpr(int op)
      Specified by:
      endEqualityExpr in interface org.jaxen.saxpath.XPathHandler
    • endFilterExpr

      public void endFilterExpr()
      Specified by:
      endFilterExpr in interface org.jaxen.saxpath.XPathHandler
    • endFunction

      public void endFunction()
      Specified by:
      endFunction in interface org.jaxen.saxpath.XPathHandler
    • endMultiplicativeExpr

      public void endMultiplicativeExpr(int op)
      Specified by:
      endMultiplicativeExpr in interface org.jaxen.saxpath.XPathHandler
    • endOrExpr

      public void endOrExpr(boolean create)
      Specified by:
      endOrExpr in interface org.jaxen.saxpath.XPathHandler
    • endPathExpr

      public void endPathExpr()
      Specified by:
      endPathExpr in interface org.jaxen.saxpath.XPathHandler
    • endPredicate

      public void endPredicate()
      Specified by:
      endPredicate in interface org.jaxen.saxpath.XPathHandler
    • endProcessingInstructionNodeStep

      public void endProcessingInstructionNodeStep()
      Specified by:
      endProcessingInstructionNodeStep in interface org.jaxen.saxpath.XPathHandler
    • endRelationalExpr

      public void endRelationalExpr(int op)
      Specified by:
      endRelationalExpr in interface org.jaxen.saxpath.XPathHandler
    • endTextNodeStep

      public void endTextNodeStep()
      Specified by:
      endTextNodeStep in interface org.jaxen.saxpath.XPathHandler
    • endUnaryExpr

      public void endUnaryExpr(int op)
      Specified by:
      endUnaryExpr in interface org.jaxen.saxpath.XPathHandler
    • endUnionExpr

      public void endUnionExpr(boolean create)
      Specified by:
      endUnionExpr in interface org.jaxen.saxpath.XPathHandler
    • literal

      public void literal(String arg0) throws org.jaxen.saxpath.SAXPathException
      Specified by:
      literal in interface org.jaxen.saxpath.XPathHandler
      Throws:
      org.jaxen.saxpath.SAXPathException
    • number

      public void number(double arg0) throws org.jaxen.saxpath.SAXPathException
      Specified by:
      number in interface org.jaxen.saxpath.XPathHandler
      Throws:
      org.jaxen.saxpath.SAXPathException
    • number

      public void number(int arg0) throws org.jaxen.saxpath.SAXPathException
      Specified by:
      number in interface org.jaxen.saxpath.XPathHandler
      Throws:
      org.jaxen.saxpath.SAXPathException
    • startAdditiveExpr

      public void startAdditiveExpr()
      Specified by:
      startAdditiveExpr in interface org.jaxen.saxpath.XPathHandler
    • startAndExpr

      public void startAndExpr()
      Specified by:
      startAndExpr in interface org.jaxen.saxpath.XPathHandler
    • startCommentNodeStep

      public void startCommentNodeStep(int arg0)
      Specified by:
      startCommentNodeStep in interface org.jaxen.saxpath.XPathHandler
    • startEqualityExpr

      public void startEqualityExpr()
      Specified by:
      startEqualityExpr in interface org.jaxen.saxpath.XPathHandler
    • startFilterExpr

      public void startFilterExpr()
      Specified by:
      startFilterExpr in interface org.jaxen.saxpath.XPathHandler
    • startFunction

      public void startFunction(String arg0, String arg1)
      Specified by:
      startFunction in interface org.jaxen.saxpath.XPathHandler
    • startMultiplicativeExpr

      public void startMultiplicativeExpr()
      Specified by:
      startMultiplicativeExpr in interface org.jaxen.saxpath.XPathHandler
    • startOrExpr

      public void startOrExpr()
      Specified by:
      startOrExpr in interface org.jaxen.saxpath.XPathHandler
    • startPathExpr

      public void startPathExpr()
      Specified by:
      startPathExpr in interface org.jaxen.saxpath.XPathHandler
    • startPredicate

      public void startPredicate()
      Specified by:
      startPredicate in interface org.jaxen.saxpath.XPathHandler
    • startProcessingInstructionNodeStep

      public void startProcessingInstructionNodeStep(int arg0, String arg1)
      Specified by:
      startProcessingInstructionNodeStep in interface org.jaxen.saxpath.XPathHandler
    • startRelationalExpr

      public void startRelationalExpr()
      Specified by:
      startRelationalExpr in interface org.jaxen.saxpath.XPathHandler
    • startTextNodeStep

      public void startTextNodeStep(int arg0)
      Specified by:
      startTextNodeStep in interface org.jaxen.saxpath.XPathHandler
    • startUnaryExpr

      public void startUnaryExpr()
      Specified by:
      startUnaryExpr in interface org.jaxen.saxpath.XPathHandler
    • startUnionExpr

      public void startUnionExpr()
      Specified by:
      startUnionExpr in interface org.jaxen.saxpath.XPathHandler
    • variableReference

      public void variableReference(String uri, String localName)
      Specified by:
      variableReference in interface org.jaxen.saxpath.XPathHandler