com.atlassian.confluence.search.lucene.filter
Class OrderedNGramMatchingFilter

java.lang.Object
  extended by org.apache.lucene.search.Filter
      extended by com.atlassian.confluence.search.lucene.filter.OrderedNGramMatchingFilter

public class OrderedNGramMatchingFilter
extends org.apache.lucene.search.Filter

Filter that leaves only documents that contain term(s) that match the supplied query in its entirety (no partial matching is permitted). This filter effectively implements a "*foo*" search (without incurring a potentially expensive leading and/or trailing wildcard search).

This implementation is tightly coupled to the indexing / token state produced by the ConfluenceNGramTokenFilter.


Constructor Summary
OrderedNGramMatchingFilter(java.lang.String fieldName, java.lang.String query, org.apache.lucene.analysis.Analyzer queryAnalyzer)
          Matches the query specified as one cohesive token.
 
Method Summary
 org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.AtomicReaderContext context, org.apache.lucene.util.Bits acceptDocs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderedNGramMatchingFilter

public OrderedNGramMatchingFilter(java.lang.String fieldName,
                                  java.lang.String query,
                                  org.apache.lucene.analysis.Analyzer queryAnalyzer)
Matches the query specified as one cohesive token. If multiple space delimited terms are specified, filtering will be performed on all terms and the result will be AND-ed. If a single term query is specified that is shorter than the length of the smallest n-gram produced by the analyzer, this filter will return an empty bitset.

Parameters:
fieldName - the name of the field that filtering will be performed on
query - the query to search on
queryAnalyzer - the analyer used to tokenize the fieldName into n-grams
Throws:
java.lang.IllegalArgumentException - if fieldName or queryAnalyzer is null.
Method Detail

getDocIdSet

public org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.AtomicReaderContext context,
                                                     org.apache.lucene.util.Bits acceptDocs)
                                              throws java.io.IOException
Specified by:
getDocIdSet in class org.apache.lucene.search.Filter
Throws:
java.io.IOException


Copyright © 2003-2014 Atlassian. All Rights Reserved.