List of usage examples for org.apache.lucene.queryparser.flexible.core.nodes TextableQueryNode setText
void setText(CharSequence text);
From source file:com.sindicetech.siren.qparser.keyword.builders.concise.ConciseNodeBuilderUtil.java
License:Open Source License
/** * 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. */// ww w . ja v a2s. c o m 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); }
From source file:com.sindicetech.siren.qparser.keyword.processors.QNamesProcessor.java
License:Open Source License
@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); }//from w ww .j av a 2s . c om 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; }