org.apache.jackrabbit.spi.commons.query
Class TextsearchQueryNode

java.lang.Object
  extended by org.apache.jackrabbit.spi.commons.query.QueryNode
      extended by org.apache.jackrabbit.spi.commons.query.TextsearchQueryNode

public class TextsearchQueryNode
extends QueryNode

Implements a query node that defines a textsearch clause.


Field Summary
 
Fields inherited from class org.apache.jackrabbit.spi.commons.query.QueryNode
TYPE_AND, TYPE_DEREF, TYPE_EXACT, TYPE_LOCATION, TYPE_NODETYPE, TYPE_NOT, TYPE_OR, TYPE_ORDER, TYPE_PATH, TYPE_PROP_FUNCTION, TYPE_RELATION, TYPE_ROOT, TYPE_TEXTSEARCH
 
Constructor Summary
protected TextsearchQueryNode(QueryNode parent, String query)
          Creates a new TextsearchQueryNode with a parent and a textsearch query statement.
 
Method Summary
 Object accept(QueryNodeVisitor visitor, Object data)
          Accepts a QueryNodeVisitor and calls the apropriate visit method on the visitor depending on the concrete implementation of this QueryNode.
 void addPathElement(Path.Element element)
          Adds a path element to the existing relative path.
 boolean equals(Object obj)
          Returns true if obj is the same type of QueryNode as this node and is equal to this node.
 Name getPropertyName()
          Deprecated. Use getRelativePath() instead.
 String getQuery()
          Returns the textsearch statement.
 boolean getReferencesProperty()
           
 Path getRelativePath()
           
 int getType()
          Returns the type of this node.
 boolean needsSystemTree()
          Returns true if this query node needs items under /jcr:system to be queried.
 void setPropertyName(Name property)
          Deprecated. Use setRelativePath(Path) instead.
 void setReferencesProperty(boolean b)
          Is set to true, indicates that getRelativePath() references a property, if set to false indicates that it references a node.
 void setRelativePath(Path relPath)
          Sets the relative path to the item where the textsearch is performed.
 
Methods inherited from class org.apache.jackrabbit.spi.commons.query.QueryNode
dump, getParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextsearchQueryNode

protected TextsearchQueryNode(QueryNode parent,
                              String query)
Creates a new TextsearchQueryNode with a parent and a textsearch query statement. The scope of the query is the fulltext index of the node, that contains all properties.

Parameters:
parent - the parent node of this query node.
query - the textsearch statement.
Method Detail

accept

public Object accept(QueryNodeVisitor visitor,
                     Object data)
              throws RepositoryException
Accepts a QueryNodeVisitor and calls the apropriate visit method on the visitor depending on the concrete implementation of this QueryNode.

Specified by:
accept in class QueryNode
Parameters:
visitor - the visitor to call back.
data - arbitrary data for the visitor.
Returns:
the return value of the visitor.visit() call.
Throws:
RepositoryException

getType

public int getType()
Returns the type of this node.

Specified by:
getType in class QueryNode
Returns:
the type of this node.

getQuery

public String getQuery()
Returns the textsearch statement.

Returns:
the textsearch statement.

getPropertyName

public Name getPropertyName()
Deprecated. Use getRelativePath() instead.

Returns a property name if the scope is limited to just a single property or null if the scope is spawned across all properties of a node. Please note that this method does not return the full relative path that reference the item to match, but only the name of the final name element of the path returned by getRelativePath().

Returns:
property name or null.

setPropertyName

public void setPropertyName(Name property)
Deprecated. Use setRelativePath(Path) instead.

Sets a new name as the search scope for this fulltext query.

Parameters:
property - the name of the property.

getRelativePath

public Path getRelativePath()
Returns:
the relative path that references the item where the textsearch is performed. Returns null if the textsearch is performed on the context node.

setRelativePath

public void setRelativePath(Path relPath)
Sets the relative path to the item where the textsearch is performed. If relPath is null the textsearch is performed on the context node.

Parameters:
relPath - the relative path to an item.
Throws:
IllegalArgumentException - if relPath is absolute.

addPathElement

public void addPathElement(Path.Element element)
Adds a path element to the existing relative path. To add a path element which matches all node names use RelationQueryNode.STAR_NAME_TEST.

Parameters:
element - the path element to append.

getReferencesProperty

public boolean getReferencesProperty()
Returns:
true if getRelativePath() references a property, returns false if it references a node.

setReferencesProperty

public void setReferencesProperty(boolean b)
Is set to true, indicates that getRelativePath() references a property, if set to false indicates that it references a node.

Parameters:
b - flag whether a property is referenced.

equals

public boolean equals(Object obj)
Description copied from class: QueryNode
Returns true if obj is the same type of QueryNode as this node and is equal to this node.

Specified by:
equals in class QueryNode
Parameters:
obj - the reference object with which to compare.
Returns:
true if obj is equal to this; false otherwise.

needsSystemTree

public boolean needsSystemTree()
Returns true if this query node needs items under /jcr:system to be queried.

Specified by:
needsSystemTree in class QueryNode
Returns:
true if this query node needs content under /jcr:system to be queried; false otherwise.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.