/** * Prepend the attribute to the encoded value of the * {@link org.apache.lucene.queryparser.flexible.core.nodes.FieldQueryNode}. A reusable * {@link java.lang.StringBuilder} is required for the operation. */ static void prepend(final StringBuilder builder, final String attribute, final TextableQueryNode fieldNode) { // Prepend the attribute to the term String value = prepend(builder, attribute, fieldNode.getText()); // Update the encoded value of the TextableQueryNode fieldNode.setText(value); }
final String text = textableNode.getText().toString();
@Override protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException { Locale locale = getQueryConfigHandler().get(ConfigurationKeys.LOCALE); if (locale == null) { locale = Locale.getDefault(); } if (node instanceof WildcardQueryNode || node instanceof FuzzyQueryNode || (node instanceof FieldQueryNode && node.getParent() instanceof RangeQueryNode) || node instanceof RegexpQueryNode) { TextableQueryNode txtNode = (TextableQueryNode) node; CharSequence text = txtNode.getText(); txtNode.setText(text != null ? UnescapedCharSequence.toLowerCase(text, locale) : null); } return node; }
@Override protected QueryNode postProcessNode(QueryNode node) throws QueryNodeException { Locale locale = getQueryConfigHandler().get(ConfigurationKeys.LOCALE); if (locale == null) { locale = Locale.getDefault(); } if (node instanceof WildcardQueryNode || node instanceof FuzzyQueryNode || (node instanceof FieldQueryNode && node.getParent() instanceof RangeQueryNode) || node instanceof RegexpQueryNode) { TextableQueryNode txtNode = (TextableQueryNode) node; CharSequence text = txtNode.getText(); txtNode.setText(text != null ? UnescapedCharSequence.toLowerCase(text, locale) : null); } return node; }
@Override protected QueryNode preProcessNode(final QueryNode node) throws QueryNodeException { if (node instanceof ProtectedQueryNode || node instanceof DatatypeQueryNode || node instanceof RegexpQueryNode) { if (qnames == null) { qnames = this.getQueryConfigHandler().get(KeywordConfigurationKeys.QNAMES); } if (qnames == null) { // the KeywordConfigurationKeys.QNAMES_PATH is not set return node; } // Replace the qname final CharSequence text; if (node instanceof TextableQueryNode) { text = ((TextableQueryNode) node).getText(); } else { text = ((DatatypeQueryNode) node).getDatatype(); } if (replace(text)) { if (node instanceof TextableQueryNode) { final TextableQueryNode pqn = (TextableQueryNode) node; pqn.setText(sb.toString()); } else { ((DatatypeQueryNode) node).setDatatype(sb.toString()); } } } return node; }