public Object visit(TextsearchQueryNode node, Object data) { StringBuffer buffer = (StringBuffer) data; buffer.append(PADDING, 0, indent); buffer.append("+ TextsearchQueryNode: "); buffer.append(" Path="); Path relPath = node.getRelativePath(); if (relPath == null) { buffer.append("."); } else { Path.Element[] elements = relPath.getElements(); String slash = ""; for (int i = 0; i < elements.length; i++) { buffer.append(slash); slash = "/"; if (node.getReferencesProperty() && i == elements.length - 1) { buffer.append("@"); } buffer.append(elements[i]); } } buffer.append(" Query=").append(node.getQuery()); buffer.append("\n"); return buffer; }
/** * {@inheritDoc} */ public TextsearchQueryNode createTextsearchQueryNode(QueryNode parent, String query) { return new TextsearchQueryNode(parent, query); } }
public Object visit(ASTContainsExpression node, Object data) { NAryQueryNode parent = (NAryQueryNode) data; try { Path relPath = null; if (node.getPropertyName() != null) { PathBuilder builder = new PathBuilder(); builder.addLast(node.getPropertyName()); relPath = builder.getPath(); } TextsearchQueryNode tsNode = factory.createTextsearchQueryNode(parent, node.getQuery()); tsNode.setRelativePath(relPath); tsNode.setReferencesProperty(true); parent.addOperand(tsNode); } catch (MalformedPathException e) { // path is always valid } return parent; }
} else if (queryNode.getType() == QueryNode.TYPE_TEXTSEARCH) { TextsearchQueryNode ts = (TextsearchQueryNode) queryNode; ts.addPathElement(PATH_FACTORY.createElement(name)); if (isAttributeNameTest(node)) { ts.setReferencesProperty(true); PATH_FACTORY.createElement(RelationQueryNode.STAR_NAME_TEST)); } else if (queryNode.getType() == QueryNode.TYPE_TEXTSEARCH) { ((TextsearchQueryNode) queryNode).addPathElement( PATH_FACTORY.createElement(RelationQueryNode.STAR_NAME_TEST));
public Object visit(ASTContainsExpression node, Object data) { NAryQueryNode parent = (NAryQueryNode) data; try { Path relPath = null; if (node.getPropertyName() != null) { PathBuilder builder = new PathBuilder(); builder.addLast(node.getPropertyName()); relPath = builder.getPath(); } TextsearchQueryNode tsNode = factory.createTextsearchQueryNode(parent, node.getQuery()); tsNode.setRelativePath(relPath); tsNode.setReferencesProperty(true); parent.addOperand(tsNode); } catch (MalformedPathException e) { // path is always valid } return parent; }
} else if (queryNode.getType() == QueryNode.TYPE_TEXTSEARCH) { TextsearchQueryNode ts = (TextsearchQueryNode) queryNode; ts.addPathElement(PATH_FACTORY.createElement(name)); if (isAttributeNameTest(node)) { ts.setReferencesProperty(true); PATH_FACTORY.createElement(RelationQueryNode.STAR_NAME_TEST)); } else if (queryNode.getType() == QueryNode.TYPE_TEXTSEARCH) { ((TextsearchQueryNode) queryNode).addPathElement( PATH_FACTORY.createElement(RelationQueryNode.STAR_NAME_TEST));
public Object visit(TextsearchQueryNode node, Object data) { StringBuffer sb = (StringBuffer) data; // escape quote String query = node.getQuery().replaceAll("'", "''"); sb.append("CONTAINS("); if (node.getRelativePath() == null) { sb.append("*"); } else { if (node.getRelativePath().getLength() > 1 || !node.getReferencesProperty()) { exceptions.add(new InvalidQueryException("Child axis not supported in SQL")); } else { try { appendName(node.getRelativePath().getName(), resolver, sb); } catch (NamespaceException e) { exceptions.add(e); } } } sb.append(", '"); sb.append(query).append("')"); return sb; }
/** * {@inheritDoc} */ public TextsearchQueryNode createTextsearchQueryNode(QueryNode parent, String query) { return new TextsearchQueryNode(parent, query); } }
public Object visit(TextsearchQueryNode node, Object data) { StringBuffer sb = (StringBuffer) data; // escape quote String query = node.getQuery().replaceAll("'", "''"); sb.append("CONTAINS("); if (node.getRelativePath() == null) { sb.append("*"); } else { if (node.getRelativePath().getLength() > 1 || !node.getReferencesProperty()) { exceptions.add(new InvalidQueryException("Child axis not supported in SQL")); } else { try { appendName(node.getRelativePath().getName(), resolver, sb); } catch (NamespaceException e) { exceptions.add(e); } } } sb.append(", '"); sb.append(query).append("')"); return sb; }
public Object visit(TextsearchQueryNode node, Object data) { StringBuffer buffer = (StringBuffer) data; buffer.append(PADDING, 0, indent); buffer.append("+ TextsearchQueryNode: "); buffer.append(" Path="); Path relPath = node.getRelativePath(); if (relPath == null) { buffer.append("."); } else { Path.Element[] elements = relPath.getElements(); String slash = ""; for (int i = 0; i < elements.length; i++) { buffer.append(slash); slash = "/"; if (node.getReferencesProperty() && i == elements.length - 1) { buffer.append("@"); } buffer.append(elements[i]); } } buffer.append(" Query=").append(node.getQuery()); buffer.append("\n"); return buffer; }
sb.append(resolver.getJCRName(XPathQueryBuilder.JCR_CONTAINS)); sb.append("("); Path relPath = node.getRelativePath(); if (relPath == null) { sb.append("."); sb.append(slash); slash = "/"; if (node.getReferencesProperty() && i == elements.length - 1) { sb.append("@"); sb.append(node.getQuery().replaceAll("'", "''")); sb.append("')"); } catch (NamespaceException e) {
sb.append(resolver.getJCRName(XPathQueryBuilder.JCR_CONTAINS)); sb.append("("); Path relPath = node.getRelativePath(); if (relPath == null) { sb.append("."); sb.append(slash); slash = "/"; if (node.getReferencesProperty() && i == elements.length - 1) { sb.append("@"); sb.append(node.getQuery().replaceAll("'", "''")); sb.append("')"); } catch (NamespaceException e) {
public Object visit(TextsearchQueryNode node, Object data) { try { Path relPath = node.getRelativePath(); String fieldname; if (relPath == null || !node.getReferencesProperty()) { Query context = parser.parse(node.getQuery()); if (relPath != null && (!node.getReferencesProperty() || relPath.getLength() > 1)) { && ((node.getReferencesProperty() && i == elements.length - 2) || (!node.getReferencesProperty() && i == elements.length - 1))) { Query q = new NameQuery(name, indexFormatVersion, nsMappings); BooleanQuery and = new BooleanQuery(); and.add(context, Occur.MUST); context = and; } else if ((node.getReferencesProperty() && i < elements.length - 2) || (!node.getReferencesProperty() && i < elements.length - 1)) {
public Object visit(TextsearchQueryNode node, Object data) { try { Path relPath = node.getRelativePath(); String fieldname; if (relPath == null || !node.getReferencesProperty()) { Query context = parser.parse(node.getQuery()); if (relPath != null && (!node.getReferencesProperty() || relPath.getLength() > 1)) { && ((node.getReferencesProperty() && i == elements.length - 2) || (!node.getReferencesProperty() && i == elements.length - 1))) { Query q = new NameQuery(name, indexFormatVersion, nsMappings); BooleanQuery and = new BooleanQuery(); and.add(context, Occur.MUST); context = and; } else if ((node.getReferencesProperty() && i < elements.length - 2) || (!node.getReferencesProperty() && i < elements.length - 1)) {