@Override protected QueryNode postProcessNode(final QueryNode node) throws QueryNodeException { if (node instanceof ProtectedQueryNode) { return node; } return super.postProcessNode(node); }
if (isPrefixWildcard(text)) { PrefixWildcardQueryNode prefixWildcardQN = new PrefixWildcardQueryNode(fqn); return prefixWildcardQN; } else if (isWildcard(text)){ WildcardQueryNode wildcardQN = new WildcardQueryNode(fqn); return wildcardQN;
private boolean isPrefixWildcard(CharSequence text) { if (text == null || text.length() <= 0 || !isWildcard(text)) return false; // Validate last character is a '*' and was not escaped // If single '*' is is a wildcard not prefix to simulate old queryparser if (text.charAt(text.length()-1) != '*') return false; if (UnescapedCharSequence.wasEscaped(text, text.length()-1)) return false; if (text.length() == 1) return false; // Only make a prefix if there is only one single star at the end and no '?' or '*' characters // If single wildcard return false to mimic old queryparser for(int i=0; i<text.length(); i++){ if (text.charAt(i) == '?') return false; if (text.charAt(i) == '*' && !UnescapedCharSequence.wasEscaped(text, i)){ if (i == text.length()-1) return true; else return false; } } return false; }
public StandardQueryNodeProcessorPipeline(QueryConfigHandler queryConfig) { super(queryConfig); add(new WildcardQueryNodeProcessor()); add(new MultiFieldQueryNodeProcessor()); add(new FuzzyQueryNodeProcessor()); add(new MatchAllDocsQueryNodeProcessor()); add(new OpenRangeQueryNodeProcessor()); add(new NumericQueryNodeProcessor()); add(new NumericRangeQueryNodeProcessor()); add(new LowercaseExpandedTermsQueryNodeProcessor()); add(new TermRangeQueryNodeProcessor()); add(new AllowLeadingWildcardProcessor()); add(new AnalyzerQueryNodeProcessor()); add(new PhraseSlopQueryNodeProcessor()); //add(new GroupQueryNodeProcessor()); add(new BooleanQuery2ModifierNodeProcessor()); add(new NoChildOptimizationQueryNodeProcessor()); add(new RemoveDeletedQueryNodesProcessor()); add(new RemoveEmptyNonLeafQueryNodeProcessor()); add(new BooleanSingleChildOptimizationQueryNodeProcessor()); add(new DefaultPhraseSlopQueryNodeProcessor()); add(new BoostQueryNodeProcessor()); add(new MultiTermRewriteMethodProcessor()); }
if (isPrefixWildcard(text)) { PrefixWildcardQueryNode prefixWildcardQN = new PrefixWildcardQueryNode(fqn); return prefixWildcardQN; } else if (isWildcard(text)){ WildcardQueryNode wildcardQN = new WildcardQueryNode(fqn); return wildcardQN;
private boolean isPrefixWildcard(CharSequence text) { if (text == null || text.length() <= 0 || !isWildcard(text)) return false; // Validate last character is a '*' and was not escaped // If single '*' is is a wildcard not prefix to simulate old queryparser if (text.charAt(text.length()-1) != '*') return false; if (UnescapedCharSequence.wasEscaped(text, text.length()-1)) return false; if (text.length() == 1) return false; // Only make a prefix if there is only one single star at the end and no '?' or '*' characters // If single wildcard return false to mimic old queryparser for(int i=0; i<text.length(); i++){ if (text.charAt(i) == '?') return false; if (text.charAt(i) == '*' && !UnescapedCharSequence.wasEscaped(text, i)){ if (i == text.length()-1) return true; else return false; } } return false; }
public StandardQueryNodeProcessorPipeline(QueryConfigHandler queryConfig) { super(queryConfig); add(new WildcardQueryNodeProcessor()); add(new MultiFieldQueryNodeProcessor()); add(new FuzzyQueryNodeProcessor()); add(new MatchAllDocsQueryNodeProcessor()); add(new OpenRangeQueryNodeProcessor()); add(new NumericQueryNodeProcessor()); add(new NumericRangeQueryNodeProcessor()); add(new LowercaseExpandedTermsQueryNodeProcessor()); add(new TermRangeQueryNodeProcessor()); add(new AllowLeadingWildcardProcessor()); add(new AnalyzerQueryNodeProcessor()); add(new PhraseSlopQueryNodeProcessor()); //add(new GroupQueryNodeProcessor()); add(new BooleanQuery2ModifierNodeProcessor()); add(new NoChildOptimizationQueryNodeProcessor()); add(new RemoveDeletedQueryNodesProcessor()); add(new RemoveEmptyNonLeafQueryNodeProcessor()); add(new BooleanSingleChildOptimizationQueryNodeProcessor()); add(new DefaultPhraseSlopQueryNodeProcessor()); add(new BoostQueryNodeProcessor()); add(new MultiTermRewriteMethodProcessor()); }
@Override protected QueryNode postProcessNode(final QueryNode node) throws QueryNodeException { if (node instanceof ProtectedQueryNode) { return node; } return super.postProcessNode(node); }