Java 类org.apache.lucene.search.TopTermsRewrite 实例源码

项目:lams    文件:SpanMultiTermQueryWrapper.java   
/** 
 * Create a TopTermsSpanBooleanQueryRewrite for 
 * at most <code>size</code> terms.
 */
public TopTermsSpanBooleanQueryRewrite(int size) {
  delegate = new TopTermsRewrite<SpanOrQuery>(size) {
    @Override
    protected int getMaxSize() {
      return Integer.MAX_VALUE;
    }

    @Override
    protected SpanOrQuery getTopLevelQuery() {
      return new SpanOrQuery();
    }

    @Override
    protected void addClause(SpanOrQuery topLevel, Term term, int docFreq, float boost, TermContext states) {
      final SpanTermQuery q = new SpanTermQuery(term);
      q.setBoost(boost);
      topLevel.addClause(q);
    }
  };
}
项目:search    文件:SpanMultiTermQueryWrapper.java   
/** 
 * Create a TopTermsSpanBooleanQueryRewrite for 
 * at most <code>size</code> terms.
 */
public TopTermsSpanBooleanQueryRewrite(int size) {
  delegate = new TopTermsRewrite<SpanOrQuery>(size) {
    @Override
    protected int getMaxSize() {
      return Integer.MAX_VALUE;
    }

    @Override
    protected SpanOrQuery getTopLevelQuery() {
      return new SpanOrQuery();
    }

    @Override
    protected void addClause(SpanOrQuery topLevel, Term term, int docFreq, float boost, TermContext states) {
      final SpanTermQuery q = new SpanTermQuery(term);
      q.setBoost(boost);
      topLevel.addClause(q);
    }
  };
}
项目:NYBC    文件:SpanMultiTermQueryWrapper.java   
/** 
 * Create a TopTermsSpanBooleanQueryRewrite for 
 * at most <code>size</code> terms.
 */
public TopTermsSpanBooleanQueryRewrite(int size) {
  delegate = new TopTermsRewrite<SpanOrQuery>(size) {
    @Override
    protected int getMaxSize() {
      return Integer.MAX_VALUE;
    }

    @Override
    protected SpanOrQuery getTopLevelQuery() {
      return new SpanOrQuery();
    }

    @Override
    protected void addClause(SpanOrQuery topLevel, Term term, int docFreq, float boost, TermContext states) {
      final SpanTermQuery q = new SpanTermQuery(term);
      q.setBoost(boost);
      topLevel.addClause(q);
    }
  };
}
项目:read-open-source-code    文件:SpanMultiTermQueryWrapper.java   
/** 
 * Create a TopTermsSpanBooleanQueryRewrite for 
 * at most <code>size</code> terms.
 */
public TopTermsSpanBooleanQueryRewrite(int size) {
  delegate = new TopTermsRewrite<SpanOrQuery>(size) {
    @Override
    protected int getMaxSize() {
      return Integer.MAX_VALUE;
    }

    @Override
    protected SpanOrQuery getTopLevelQuery() {
      return new SpanOrQuery();
    }

    @Override
    protected void addClause(SpanOrQuery topLevel, Term term, int docFreq, float boost, TermContext states) {
      final SpanTermQuery q = new SpanTermQuery(term);
      q.setBoost(boost);
      topLevel.addClause(q);
    }
  };
}
项目:read-open-source-code    文件:SpanMultiTermQueryWrapper.java   
/** 
 * Create a TopTermsSpanBooleanQueryRewrite for 
 * at most <code>size</code> terms.
 */
public TopTermsSpanBooleanQueryRewrite(int size) {
  delegate = new TopTermsRewrite<SpanOrQuery>(size) {
    @Override
    protected int getMaxSize() {
      return Integer.MAX_VALUE;
    }

    @Override
    protected SpanOrQuery getTopLevelQuery() {
      return new SpanOrQuery();
    }

    @Override
    protected void addClause(SpanOrQuery topLevel, Term term, int docFreq, float boost, TermContext states) {
      final SpanTermQuery q = new SpanTermQuery(term);
      q.setBoost(boost);
      topLevel.addClause(q);
    }
  };
}
项目:read-open-source-code    文件:SpanMultiTermQueryWrapper.java   
/** 
 * Create a TopTermsSpanBooleanQueryRewrite for 
 * at most <code>size</code> terms.
 */
public TopTermsSpanBooleanQueryRewrite(int size) {
  delegate = new TopTermsRewrite<SpanOrQuery>(size) {
    @Override
    protected int getMaxSize() {
      return Integer.MAX_VALUE;
    }

    @Override
    protected SpanOrQuery getTopLevelQuery() {
      return new SpanOrQuery();
    }

    @Override
    protected void addClause(SpanOrQuery topLevel, Term term, int docFreq, float boost, TermContext states) {
      final SpanTermQuery q = new SpanTermQuery(term);
      q.setBoost(boost);
      topLevel.addClause(q);
    }
  };
}
项目:Maskana-Gestor-de-Conocimiento    文件:SpanMultiTermQueryWrapper.java   
/** 
 * Create a TopTermsSpanBooleanQueryRewrite for 
 * at most <code>size</code> terms.
 */
public TopTermsSpanBooleanQueryRewrite(int size) {
  delegate = new TopTermsRewrite<SpanOrQuery>(size) {
    @Override
    protected int getMaxSize() {
      return Integer.MAX_VALUE;
    }

    @Override
    protected SpanOrQuery getTopLevelQuery() {
      return new SpanOrQuery();
    }

    @Override
    protected void addClause(SpanOrQuery topLevel, Term term, int docFreq, float boost, TermContext states) {
      final SpanTermQuery q = new SpanTermQuery(term);
      q.setBoost(boost);
      topLevel.addClause(q);
    }
  };
}
项目:lams    文件:SpanMultiTermQueryWrapper.java   
/**
 * Create a new SpanMultiTermQueryWrapper. 
 * 
 * @param query Query to wrap.
 * <p>
 * NOTE: This will call {@link MultiTermQuery#setRewriteMethod(MultiTermQuery.RewriteMethod)}
 * on the wrapped <code>query</code>, changing its rewrite method to a suitable one for spans.
 * Be sure to not change the rewrite method on the wrapped query afterwards! Doing so will
 * throw {@link UnsupportedOperationException} on rewriting this query!
 */
@SuppressWarnings({"rawtypes","unchecked"})
public SpanMultiTermQueryWrapper(Q query) {
  this.query = query;

  MultiTermQuery.RewriteMethod method = query.getRewriteMethod();
  if (method instanceof TopTermsRewrite) {
    final int pqsize = ((TopTermsRewrite) method).getSize();
    setRewriteMethod(new TopTermsSpanBooleanQueryRewrite(pqsize));
  } else {
    setRewriteMethod(SCORING_SPAN_QUERY_REWRITE); 
  }
}
项目:search    文件:SpanMultiTermQueryWrapper.java   
/**
 * Create a new SpanMultiTermQueryWrapper. 
 * 
 * @param query Query to wrap.
 * <p>
 * NOTE: This will call {@link MultiTermQuery#setRewriteMethod(MultiTermQuery.RewriteMethod)}
 * on the wrapped <code>query</code>, changing its rewrite method to a suitable one for spans.
 * Be sure to not change the rewrite method on the wrapped query afterwards! Doing so will
 * throw {@link UnsupportedOperationException} on rewriting this query!
 */
@SuppressWarnings({"rawtypes","unchecked"})
public SpanMultiTermQueryWrapper(Q query) {
  this.query = query;

  MultiTermQuery.RewriteMethod method = query.getRewriteMethod();
  if (method instanceof TopTermsRewrite) {
    final int pqsize = ((TopTermsRewrite) method).getSize();
    setRewriteMethod(new TopTermsSpanBooleanQueryRewrite(pqsize));
  } else {
    setRewriteMethod(SCORING_SPAN_QUERY_REWRITE); 
  }
}
项目:NYBC    文件:SpanMultiTermQueryWrapper.java   
/**
 * Create a new SpanMultiTermQueryWrapper. 
 * 
 * @param query Query to wrap.
 * <p>
 * NOTE: This will call {@link MultiTermQuery#setRewriteMethod(MultiTermQuery.RewriteMethod)}
 * on the wrapped <code>query</code>, changing its rewrite method to a suitable one for spans.
 * Be sure to not change the rewrite method on the wrapped query afterwards! Doing so will
 * throw {@link UnsupportedOperationException} on rewriting this query!
 */
@SuppressWarnings({"rawtypes","unchecked"})
public SpanMultiTermQueryWrapper(Q query) {
  this.query = query;

  MultiTermQuery.RewriteMethod method = query.getRewriteMethod();
  if (method instanceof TopTermsRewrite) {
    final int pqsize = ((TopTermsRewrite) method).getSize();
    setRewriteMethod(new TopTermsSpanBooleanQueryRewrite(pqsize));
  } else {
    setRewriteMethod(SCORING_SPAN_QUERY_REWRITE); 
  }
}
项目:read-open-source-code    文件:SpanMultiTermQueryWrapper.java   
/**
 * Create a new SpanMultiTermQueryWrapper. 
 * 
 * @param query Query to wrap.
 * <p>
 * NOTE: This will call {@link MultiTermQuery#setRewriteMethod(MultiTermQuery.RewriteMethod)}
 * on the wrapped <code>query</code>, changing its rewrite method to a suitable one for spans.
 * Be sure to not change the rewrite method on the wrapped query afterwards! Doing so will
 * throw {@link UnsupportedOperationException} on rewriting this query!
 */
@SuppressWarnings({"rawtypes","unchecked"})
public SpanMultiTermQueryWrapper(Q query) {
  this.query = query;

  MultiTermQuery.RewriteMethod method = query.getRewriteMethod();
  if (method instanceof TopTermsRewrite) {
    final int pqsize = ((TopTermsRewrite) method).getSize();
    setRewriteMethod(new TopTermsSpanBooleanQueryRewrite(pqsize));
  } else {
    setRewriteMethod(SCORING_SPAN_QUERY_REWRITE); 
  }
}
项目:read-open-source-code    文件:SpanMultiTermQueryWrapper.java   
/**
 * Create a new SpanMultiTermQueryWrapper. 
 * 
 * @param query Query to wrap.
 * <p>
 * NOTE: This will call {@link MultiTermQuery#setRewriteMethod(MultiTermQuery.RewriteMethod)}
 * on the wrapped <code>query</code>, changing its rewrite method to a suitable one for spans.
 * Be sure to not change the rewrite method on the wrapped query afterwards! Doing so will
 * throw {@link UnsupportedOperationException} on rewriting this query!
 */
@SuppressWarnings({"rawtypes","unchecked"})
public SpanMultiTermQueryWrapper(Q query) {
  this.query = query;

  MultiTermQuery.RewriteMethod method = query.getRewriteMethod();
  if (method instanceof TopTermsRewrite) {
    final int pqsize = ((TopTermsRewrite) method).getSize();
    setRewriteMethod(new TopTermsSpanBooleanQueryRewrite(pqsize));
  } else {
    setRewriteMethod(SCORING_SPAN_QUERY_REWRITE); 
  }
}
项目:read-open-source-code    文件:SpanMultiTermQueryWrapper.java   
/**
 * Create a new SpanMultiTermQueryWrapper. 
 * 
 * @param query Query to wrap.
 * <p>
 * NOTE: This will call {@link MultiTermQuery#setRewriteMethod(MultiTermQuery.RewriteMethod)}
 * on the wrapped <code>query</code>, changing its rewrite method to a suitable one for spans.
 * Be sure to not change the rewrite method on the wrapped query afterwards! Doing so will
 * throw {@link UnsupportedOperationException} on rewriting this query!
 */
@SuppressWarnings({"rawtypes","unchecked"})
public SpanMultiTermQueryWrapper(Q query) {
  this.query = query;

  MultiTermQuery.RewriteMethod method = query.getRewriteMethod();
  if (method instanceof TopTermsRewrite) {
    final int pqsize = ((TopTermsRewrite) method).getSize();
    setRewriteMethod(new TopTermsSpanBooleanQueryRewrite(pqsize));
  } else {
    setRewriteMethod(SCORING_SPAN_QUERY_REWRITE); 
  }
}
项目:Maskana-Gestor-de-Conocimiento    文件:SpanMultiTermQueryWrapper.java   
/**
 * Create a new SpanMultiTermQueryWrapper. 
 * 
 * @param query Query to wrap.
 * <p>
 * NOTE: This will call {@link MultiTermQuery#setRewriteMethod(MultiTermQuery.RewriteMethod)}
 * on the wrapped <code>query</code>, changing its rewrite method to a suitable one for spans.
 * Be sure to not change the rewrite method on the wrapped query afterwards! Doing so will
 * throw {@link UnsupportedOperationException} on rewriting this query!
 */
@SuppressWarnings({"rawtypes","unchecked"})
public SpanMultiTermQueryWrapper(Q query) {
  this.query = query;

  MultiTermQuery.RewriteMethod method = query.getRewriteMethod();
  if (method instanceof TopTermsRewrite) {
    final int pqsize = ((TopTermsRewrite) method).getSize();
    setRewriteMethod(new TopTermsSpanBooleanQueryRewrite(pqsize));
  } else {
    setRewriteMethod(SCORING_SPAN_QUERY_REWRITE); 
  }
}