private void flatten(Item item,int position,List<FlattenedItem> toList) { if (item==null) return; if (item.isFilter()) return; if (item instanceof TermItem) { // make eligible for matching toList.add(new FlattenedItem((TermItem)item,position)); return; } if (item instanceof CompositeItem) { // make children eligible for matching CompositeItem composite=(CompositeItem)item; int childPosition=0; for (Iterator<?> i=composite.getItemIterator(); i.hasNext(); ) { flatten((Item)i.next(),childPosition++,toList); } } // other terms are unmatchable }
buffer.append("("); if (isFilter()) { buffer.append("|");
boolean filter = leaf.isFilter(); boolean isRanked = leaf.isRanked(); String label = leaf.getLabel();
/** * Returns an integer that contains all feature flags for this item. This must be kept in sync with the flags * defined in searchlib/parsequery/parse.h. * * @return The feature flags. */ private byte getFlagsFeature() { byte FLAGS_NORANK = 0x01; byte FLAGS_SPECIALTOKEN = 0x02; byte FLAGS_NOPOSITIONDATA = 0x04; byte FLAGS_ISFILTER = 0x08; byte ret = 0; if (!isRanked()) { ret |= FLAGS_NORANK; } if (isFromSpecialToken()) { ret |= FLAGS_SPECIALTOKEN; } if (!usePositionData()) { ret |= FLAGS_NOPOSITIONDATA; } if (isFilter()) { ret |= FLAGS_ISFILTER; } return ret; }
PhraseMatcher.Phrase currMatch = allMatchesIter.next(); PhraseMatcher.Phrase.MatchIterator matchIter = currMatch.itemIterator(); if(matchIter.hasNext() && matchIter.next().isFilter()) { RewriterUtils.log(logger, query, "Removing filter item" + currMatch); allMatchesIter.remove();