Class GraphQuery

  • public class GraphQuery
    GraphQuery - search for nodes and traverse edges in an index. Params: fromField = the field that contains the node id toField = the field that contains the edge ids traversalFilter = a query that can be applied for each hop in the graph. maxDepth = the max depth to traverse. (start nodes is depth=1) onlyLeafNodes = only return documents that have no edge id values. returnRoot = if false, the documents matching the initial query will not be returned.
    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Constructor Detail

      • GraphQuery

        public GraphQuery​( q,
                          String fromField,
                          String toField)
        Create a graph query q - the starting node query fromField - the field containing the node id toField - the field containing the edge ids
      • GraphQuery

        public GraphQuery​( q,
                          String fromField,
                          String toField,
        Create a graph query with a traversal filter applied while traversing the frontier. q - the starting node query fromField - the field containing the node id toField - the field containing the edge ids traversalFilter - the filter to be applied on each iteration of the frontier.
    • Method Detail

      • createWeight

        public createWeight​( searcher,
                                                            float boost)
                                                     throws IOException
        createWeight in class
      • toString

        public String toString​(String field)
        Specified by:
        toString in class
      • getTraversalFilter

        public getTraversalFilter()
        The query to be used as a filter for each hop in the graph.
      • setTraversalFilter

        public void setTraversalFilter​( traversalFilter)
      • getQ

        public getQ()
      • setQ

        public void setQ​( q)
      • getFromField

        public String getFromField()
        The field that contains the node id
      • setFromField

        public void setFromField​(String fromField)
      • getToField

        public String getToField()
        the field that contains the edge id(s)
      • setToField

        public void setToField​(String toField)
      • getMaxDepth

        public int getMaxDepth()
        Max depth for traversal, -1 for infinite!
      • setMaxDepth

        public void setMaxDepth​(int maxDepth)
      • isUseAutn

        public boolean isUseAutn()
        If true , an automaton query will be compiled for each new frontier traversal this helps to avoid max boolean clause errors.
      • setUseAutn

        public void setUseAutn​(boolean useAutn)
      • isOnlyLeafNodes

        public boolean isOnlyLeafNodes()
        if true only documents that do not have a value in the edge id field will be returned.
      • setOnlyLeafNodes

        public void setOnlyLeafNodes​(boolean onlyLeafNodes)
      • isReturnRoot

        public boolean isReturnRoot()
        if true the documents that matched the rootNodes query will be returned. o/w they will be removed from the result set.
      • setReturnRoot

        public void setReturnRoot​(boolean returnRoot)
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class
      • equals

        public boolean equals​(Object other)
        Specified by:
        equals in class
      • visit

        public void visit​( visitor)
        visit in class