private static PropertyValue mvpToString(PropertyValue pv) { String v = Joiner.on(' ') .appendTo(new StringBuilder(), pv.getValue(Type.STRINGS)) .toString(); return PropertyValues.newString(v); }
private static PropertyValue mvpToString(PropertyValue pv) { String v = Joiner.on(' ') .appendTo(new StringBuilder(), pv.getValue(Type.STRINGS)) .toString(); return PropertyValues.newString(v); }
private static Query createNodeNameQuery(PropertyRestriction pr) { String first = pr.first != null ? pr.first.getValue(STRING) : null; if (pr.first != null && pr.first.equals(pr.last) && pr.firstIncluding && pr.lastIncluding) { // [property]=[value] return new TermQuery(new Term(FieldNames.NODE_NAME, first)); } if (pr.isLike) { return createLikeQuery(FieldNames.NODE_NAME, first); } throw new IllegalStateException("For nodeName queries only EQUALS and LIKE are supported " + pr); }
private Iterable<Long> readDateValues(PropertyValue value) { List<Long> result = newArrayList(); for (String string : value.getValue(Type.DATES)) { result.add(ISO8601.parse(string).getTimeInMillis()); } return result; }
private static boolean wrongIndex(Filter filter) { // skip index if "option(index ...)" doesn't match PropertyRestriction indexName = filter.getPropertyRestriction(IndexConstants.INDEX_NAME_OPTION); if (indexName != null && indexName.first != null) { // index name specified: just verify this, and ignore tags return !"nodetype".equals(indexName.first.getValue(Type.STRING)); } PropertyRestriction indexTag = filter.getPropertyRestriction(IndexConstants.INDEX_TAG_OPTION); // index tag specified (the nodetype index doesn't support tags) return indexTag != null && indexTag.first != null; }
private static boolean wrongIndex(Filter filter) { // skip index if "option(index ...)" doesn't match PropertyRestriction indexName = filter.getPropertyRestriction(IndexConstants.INDEX_NAME_OPTION); if (indexName != null && indexName.first != null) { // index name specified: just verify this, and ignore tags return !"nodetype".equals(indexName.first.getValue(Type.STRING)); } PropertyRestriction indexTag = filter.getPropertyRestriction(IndexConstants.INDEX_TAG_OPTION); // index tag specified (the nodetype index doesn't support tags) return indexTag != null && indexTag.first != null; }
@Override public PropertyValue currentProperty() { PropertyValue p = operand.currentProperty(); if (p == null) { return null; } // TODO what is the expected result of UPPER(x) for an array property? // currently throws an exception String value = p.getValue(STRING); return PropertyValues.newString(value.toUpperCase()); }
private static boolean wrongIndex(Filter filter) { // skip index if "option(index ...)" doesn't match PropertyRestriction indexName = filter.getPropertyRestriction(IndexConstants.INDEX_NAME_OPTION); if (indexName != null && indexName.first != null) { // index name specified: just verify this, and ignore tags return !"nodetype".equals(indexName.first.getValue(Type.STRING)); } PropertyRestriction indexTag = filter.getPropertyRestriction(IndexConstants.INDEX_TAG_OPTION); // index tag specified (the nodetype index doesn't support tags) return indexTag != null && indexTag.first != null; }
@Override public PropertyValue currentProperty() { PropertyValue p = operand.currentProperty(); if (p == null) { return null; } // TODO what is the expected result of UPPER(x) for an array property? // currently throws an exception String value = p.getValue(STRING); return PropertyValues.newString(value.toUpperCase()); }
@Override public String toString() { if (value.getType() == Type.STRING) { return escape(); } else if (value.getType() == Type.LONG) { return Long.toString(value.getValue(Type.LONG)); } else { String type = PropertyType.nameFromValue(value.getType().tag()); return "cast(" + escape() + " as " + type.toLowerCase(Locale.ENGLISH) + ')'; } }
@Override public void restrict(FilterImpl f) { if (f.getSelector().equals(selector)) { PropertyValue p = expression.currentValue(); String term = p.getValue(Type.STRING); String query = SUGGEST_PREFIX + term; PropertyValue v = PropertyValues.newString(query); f.restrictProperty(NativeFunctionImpl.NATIVE_PREFIX + NATIVE_LUCENE_LANGUAGE, Operator.EQUAL, v); } }
@Override public void restrict(FilterImpl f) { if (f.getSelector().equals(selector)) { PropertyValue p = expression.currentValue(); String term = p.getValue(Type.STRING); String query = SUGGEST_PREFIX + term; PropertyValue v = PropertyValues.newString(query); f.restrictProperty(NativeFunctionImpl.NATIVE_PREFIX + NATIVE_LUCENE_LANGUAGE, Operator.EQUAL, v); } }
@Override public void restrict(FilterImpl f) { if (f.getSelector().equals(selector)) { PropertyValue p = expression.currentValue(); String term = p.getValue(Type.STRING); String query = SPELLCHECK_PREFIX + term; PropertyValue v = PropertyValues.newString(query); f.restrictProperty(NativeFunctionImpl.NATIVE_PREFIX + NATIVE_LUCENE_LANGUAGE, Operator.EQUAL, v); } }
@Override public void restrict(FilterImpl f) { if (f.getSelector().equals(selector)) { PropertyValue p = expression.currentValue(); String term = p.getValue(Type.STRING); String query = SUGGEST_PREFIX + term; PropertyValue v = PropertyValues.newString(query); f.restrictProperty(NativeFunctionImpl.NATIVE_PREFIX + NATIVE_LUCENE_LANGUAGE, Operator.EQUAL, v); } }
@Override public void restrict(FilterImpl f) { if (f.getSelector().equals(selector)) { PropertyValue p = expression.currentValue(); String term = p.getValue(Type.STRING); String query = SPELLCHECK_PREFIX + term; PropertyValue v = PropertyValues.newString(query); f.restrictProperty(NativeFunctionImpl.NATIVE_PREFIX + NATIVE_LUCENE_LANGUAGE, Operator.EQUAL, v); } }
@Override public void restrict(FilterImpl f) { if (f.getSelector().equals(selector)) { PropertyValue p = pathExpression.currentValue(); String path = p.getValue(Type.STRING); String query = MORE_LIKE_THIS_PREFIX + path; PropertyValue v = PropertyValues.newString(query); f.restrictProperty(NativeFunctionImpl.NATIVE_PREFIX + NATIVE_LUCENE_LANGUAGE, Operator.EQUAL, v); } }
protected String explainXpath(String query) throws ParseException { String explain = "explain " + query; Result result = executeQuery(explain, "xpath", NO_BINDINGS); ResultRow row = Iterables.getOnlyElement(result.getRows()); String plan = row.getValue("plan").getValue(Type.STRING); return plan; }
private String explainXpath(String query) throws ParseException { String explain = "explain " + query; Result result = executeQuery(explain, "xpath", NO_BINDINGS); ResultRow row = Iterables.getOnlyElement(result.getRows()); return row.getValue("plan").getValue(Type.STRING); }