@Override ConstraintImpl not() { return new FullTextSearchImpl(this.selectorName, this.propertyName, this.fullTextSearchExpression); }
@Override public boolean visit(FullTextSearchImpl node) { node.setQuery(query); node.bindSelector(source); return super.visit(node); }
return enforcePropertyExistence(propertyName, selector); return false; appendString(buff, p); } else { String path = selector.currentPath(); if (!PathUtils.denotesRoot(path)) { appendString(buff, PropertyValues.newString(PathUtils.getName(path))); String rp = normalizePath(relativePath); path = PathUtils.concat(path, rp); String pn = normalizePropertyName(propertyName); PropertyState p = tree.getProperty(pn); if (p == null) { return false; appendString(buff, PropertyValues.create(p)); } else { for (PropertyState p : tree.getProperties()) { appendString(buff, PropertyValues.create(p)); return getFullTextConstraint(selector).evaluate(buff.toString());
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("contains("); builder.append(quote(selectorName)); builder.append('.'); String pn = propertyName; if (pn == null) { pn = "*"; } if (relativePath != null) { pn = relativePath + "/" + pn; } builder.append(quote(pn)); builder.append(", "); builder.append(getFullTextSearchExpression()); builder.append(')'); return builder.toString(); }
@Override public FullTextExpression getFullTextConstraint(SelectorImpl s) { if (!s.equals(selector)) { return null; } PropertyValue v = fullTextSearchExpression.currentValue(); try { String p = propertyName; if (relativePath != null) { if (p == null) { p = "*"; } p = PathUtils.concat(relativePath, p); } String p2 = normalizePropertyName(p); String rawText = getRawText(v); FullTextExpression e = FullTextParser.parse(p2, rawText); return new FullTextContains(p2, rawText, e); } catch (ParseException e) { throw new IllegalArgumentException("Invalid expression: " + fullTextSearchExpression, e); } }
/** * Calls accept on the static operand in the fulltext search constraint. */ @Override public boolean visit(FullTextSearchImpl node) { node.getFullTextSearchExpression().accept(this); return true; }
@Override String getRawText(PropertyValue v) { Iterable<String> terms = SPACE_SPLITTER.split(super.getRawText(v)); StringBuffer raw = new StringBuffer(); for (String term : terms) { if (isKeyword(term)) { raw.append(String.format("%s ", term)); } else { raw.append(String.format("-%s ", term)); } } return raw.toString().trim(); }
return enforcePropertyExistence(propertyName, selector); return false; appendString(buff, p); } else { String path = selector.currentPath(); if (!PathUtils.denotesRoot(path)) { appendString(buff, PropertyValues.newString(PathUtils.getName(path))); String rp = normalizePath(relativePath); path = PathUtils.concat(path, rp); String pn = normalizePropertyName(propertyName); PropertyState p = tree.getProperty(pn); if (p == null) { return false; appendString(buff, PropertyValues.create(p)); } else { for (PropertyState p : tree.getProperties()) { appendString(buff, PropertyValues.create(p)); return getFullTextConstraint(selector).evaluate(buff.toString());
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("contains("); builder.append(quote(selectorName)); builder.append('.'); String pn = propertyName; if (pn == null) { pn = "*"; } if (relativePath != null) { pn = relativePath + "/" + pn; } builder.append(quote(pn)); builder.append(", "); builder.append(getFullTextSearchExpression()); builder.append(')'); return builder.toString(); }
@Override public FullTextExpression getFullTextConstraint(SelectorImpl s) { if (!s.equals(selector)) { return null; } PropertyValue v = fullTextSearchExpression.currentValue(); try { String p = propertyName; if (relativePath != null) { if (p == null) { p = "*"; } p = PathUtils.concat(relativePath, p); } String p2 = normalizePropertyName(p); String rawText = getRawText(v); FullTextExpression e = FullTextParser.parse(p2, rawText); return new FullTextContains(p2, rawText, e); } catch (ParseException e) { throw new IllegalArgumentException("Invalid expression: " + fullTextSearchExpression, e); } }
/** * Calls accept on the static operand in the fulltext search constraint. */ @Override public boolean visit(FullTextSearchImpl node) { node.getFullTextSearchExpression().accept(this); return true; }
@Override String getRawText(PropertyValue v) { Iterable<String> terms = SPACE_SPLITTER.split(super.getRawText(v)); StringBuffer raw = new StringBuffer(); for (String term : terms) { if (isKeyword(term)) { raw.append(String.format("%s ", term)); } else { raw.append(String.format("-%s ", term)); } } return raw.toString().trim(); }
return enforcePropertyExistence(propertyName, selector); return false; appendString(buff, p); } else { String path = selector.currentPath(); if (!PathUtils.denotesRoot(path)) { appendString(buff, PropertyValues.newString(PathUtils.getName(path))); String rp = normalizePath(relativePath); path = PathUtils.concat(path, rp); String pn = normalizePropertyName(propertyName); PropertyState p = tree.getProperty(pn); if (p == null) { return false; appendString(buff, PropertyValues.create(p)); } else { for (PropertyState p : tree.getProperties()) { appendString(buff, PropertyValues.create(p)); return getFullTextConstraint(selector).evaluate(buff.toString());
public FullTextSearchImpl fullTextSearch(String selectorName, String propertyName, StaticOperandImpl fullTextSearchExpression) { return new FullTextSearchImpl(selectorName, propertyName, fullTextSearchExpression); }
@Override public boolean visit(FullTextSearchImpl node) { node.setQuery(query); node.bindSelector(source); return super.visit(node); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("contains("); builder.append(quote(selectorName)); builder.append('.'); String pn = propertyName; if (pn == null) { pn = "*"; } if (relativePath != null) { pn = relativePath + "/" + pn; } builder.append(quote(pn)); builder.append(", "); builder.append(getFullTextSearchExpression()); builder.append(')'); return builder.toString(); }
@Override public FullTextExpression getFullTextConstraint(SelectorImpl s) { if (!s.equals(selector)) { return null; } PropertyValue v = fullTextSearchExpression.currentValue(); try { String p = propertyName; if (relativePath != null) { if (p == null) { p = "*"; } p = PathUtils.concat(relativePath, p); } String p2 = normalizePropertyName(p); String rawText = getRawText(v); FullTextExpression e = FullTextParser.parse(p2, rawText); return new FullTextContains(p2, rawText, e); } catch (ParseException e) { throw new IllegalArgumentException("Invalid expression: " + fullTextSearchExpression, e); } }
/** * Calls accept on the static operand in the fulltext search constraint. */ @Override public boolean visit(FullTextSearchImpl node) { node.getFullTextSearchExpression().accept(this); return true; }
@Override String getRawText(PropertyValue v) { Iterable<String> terms = SPACE_SPLITTER.split(super.getRawText(v)); StringBuffer raw = new StringBuffer(); for (String term : terms) { if (isKeyword(term)) { raw.append(String.format("%s ", term)); } else { raw.append(String.format("-%s ", term)); } } return raw.toString().trim(); }
public FullTextSearchImpl fullTextSearch(String selectorName, String propertyName, StaticOperandImpl fullTextSearchExpression) { return new FullTextSearchImpl(selectorName, propertyName, fullTextSearchExpression); }