Java 类org.apache.lucene.index.SingleTermsEnum 实例源码

项目:lams    文件:CompiledAutomaton.java   
/** Return a {@link TermsEnum} intersecting the provided {@link Terms}
 *  with the terms accepted by this automaton. */
public TermsEnum getTermsEnum(Terms terms) throws IOException {
  switch(type) {
  case NONE:
    return TermsEnum.EMPTY;
  case ALL:
    return terms.iterator(null);
  case SINGLE:
    return new SingleTermsEnum(terms.iterator(null), term);
  case PREFIX:
    // TODO: this is very likely faster than .intersect,
    // but we should test and maybe cutover
    return new PrefixTermsEnum(terms.iterator(null), term);
  case NORMAL:
    return terms.intersect(this, null);
  default:
    // unreachable
    throw new RuntimeException("unhandled case");
  }
}
项目:search    文件:CompiledAutomaton.java   
/** Return a {@link TermsEnum} intersecting the provided {@link Terms}
 *  with the terms accepted by this automaton. */
public TermsEnum getTermsEnum(Terms terms) throws IOException {
  switch(type) {
  case NONE:
    return TermsEnum.EMPTY;
  case ALL:
    return terms.iterator(null);
  case SINGLE:
    return new SingleTermsEnum(terms.iterator(null), term);
  case PREFIX:
    // TODO: this is very likely faster than .intersect,
    // but we should test and maybe cutover
    return new PrefixTermsEnum(terms.iterator(null), term);
  case NORMAL:
    return terms.intersect(this, null);
  default:
    // unreachable
    throw new RuntimeException("unhandled case");
  }
}
项目:NYBC    文件:CompiledAutomaton.java   
public TermsEnum getTermsEnum(Terms terms) throws IOException {
  switch(type) {
  case NONE:
    return TermsEnum.EMPTY;
  case ALL:
    return terms.iterator(null);
  case SINGLE:
    return new SingleTermsEnum(terms.iterator(null), term);
  case PREFIX:
    // TODO: this is very likely faster than .intersect,
    // but we should test and maybe cutover
    return new PrefixTermsEnum(terms.iterator(null), term);
  case NORMAL:
    return terms.intersect(this, null);
  default:
    // unreachable
    throw new RuntimeException("unhandled case");
  }
}
项目:read-open-source-code    文件:CompiledAutomaton.java   
public TermsEnum getTermsEnum(Terms terms) throws IOException {
  switch(type) {
  case NONE:
    return TermsEnum.EMPTY;
  case ALL:
    return terms.iterator(null);
  case SINGLE:
    return new SingleTermsEnum(terms.iterator(null), term);
  case PREFIX:
    // TODO: this is very likely faster than .intersect,
    // but we should test and maybe cutover
    return new PrefixTermsEnum(terms.iterator(null), term);
  case NORMAL:
    return terms.intersect(this, null);
  default:
    // unreachable
    throw new RuntimeException("unhandled case");
  }
}
项目:read-open-source-code    文件:CompiledAutomaton.java   
public TermsEnum getTermsEnum(Terms terms) throws IOException {
  switch(type) {
  case NONE:
    return TermsEnum.EMPTY;
  case ALL:
    return terms.iterator(null);
  case SINGLE:
    return new SingleTermsEnum(terms.iterator(null), term);
  case PREFIX:
    // TODO: this is very likely faster than .intersect,
    // but we should test and maybe cutover
    return new PrefixTermsEnum(terms.iterator(null), term);
  case NORMAL:
    return terms.intersect(this, null);
  default:
    // unreachable
    throw new RuntimeException("unhandled case");
  }
}
项目:read-open-source-code    文件:CompiledAutomaton.java   
/** Return a {@link TermsEnum} intersecting the provided {@link Terms}
 *  with the terms accepted by this automaton. */
public TermsEnum getTermsEnum(Terms terms) throws IOException {
  switch(type) {
  case NONE:
    return TermsEnum.EMPTY;
  case ALL:
    return terms.iterator(null);
  case SINGLE:
    return new SingleTermsEnum(terms.iterator(null), term);
  case PREFIX:
    // TODO: this is very likely faster than .intersect,
    // but we should test and maybe cutover
    return new PrefixTermsEnum(terms.iterator(null), term);
  case NORMAL:
    return terms.intersect(this, null);
  default:
    // unreachable
    throw new RuntimeException("unhandled case");
  }
}
项目:Maskana-Gestor-de-Conocimiento    文件:CompiledAutomaton.java   
public TermsEnum getTermsEnum(Terms terms) throws IOException {
  switch(type) {
  case NONE:
    return TermsEnum.EMPTY;
  case ALL:
    return terms.iterator(null);
  case SINGLE:
    return new SingleTermsEnum(terms.iterator(null), term);
  case PREFIX:
    // TODO: this is very likely faster than .intersect,
    // but we should test and maybe cutover
    return new PrefixTermsEnum(terms.iterator(null), term);
  case NORMAL:
    return terms.intersect(this, null);
  default:
    // unreachable
    throw new RuntimeException("unhandled case");
  }
}
项目:lams    文件:FuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (maxEdits == 0 || prefixLength >= term.text().length()) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits, prefixLength, transpositions);
}
项目:DoSeR-Disambiguation    文件:LearnToRankFuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(final Terms terms,
        final AttributeSource atts) throws IOException {
    if ((maxEdits == 0) || (prefixLength >= term.text().length())) { // can
                                                                        // only
        // match
        // if
        // it's
        // exact
        return new SingleTermsEnum(terms.iterator(null), term.bytes());
    }
    return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits,
            prefixLength, transpositions);
}
项目:search    文件:SlowFuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (!termLongEnough) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new SlowFuzzyTermsEnum(terms, atts, getTerm(), minimumSimilarity, prefixLength);
}
项目:search    文件:FuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (maxEdits == 0 || prefixLength >= term.text().length()) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits, prefixLength, transpositions);
}
项目:search    文件:TestAutomatonQuery.java   
/**
 * Test that rewriting to a single term works as expected, preserves
 * MultiTermQuery semantics.
 */
public void testRewriteSingleTerm() throws IOException {
  AutomatonQuery aq = new AutomatonQuery(newTerm("bogus"), Automata.makeString("piece"));
  Terms terms = MultiFields.getTerms(searcher.getIndexReader(), FN);
  assertTrue(aq.getTermsEnum(terms) instanceof SingleTermsEnum);
  assertEquals(1, automatonQueryNrHits(aq));
}
项目:DoSeR    文件:LearnToRankFuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts)
        throws IOException {
    if (maxEdits == 0 || prefixLength >= term.text().length()) { // can only
                                                                    // match
                                                                    // if
                                                                    // it's
                                                                    // exact
        return new SingleTermsEnum(terms.iterator(null), term.bytes());
    }
    return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits,
            prefixLength, transpositions);
}
项目:DoSeR    文件:LearnToRankFuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(final Terms terms,
        final AttributeSource atts) throws IOException {
    if ((maxEdits == 0) || (prefixLength >= term.text().length())) { // can
                                                                        // only
        // match
        // if
        // it's
        // exact
        return new SingleTermsEnum(terms.iterator(null), term.bytes());
    }
    return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits,
            prefixLength, transpositions);
}
项目:NYBC    文件:SlowFuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (!termLongEnough) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new SlowFuzzyTermsEnum(terms, atts, getTerm(), minimumSimilarity, prefixLength);
}
项目:NYBC    文件:FuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (maxEdits == 0 || prefixLength >= term.text().length()) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits, prefixLength, transpositions);
}
项目:NYBC    文件:TestAutomatonQuery.java   
/**
 * Test that rewriting to a single term works as expected, preserves
 * MultiTermQuery semantics.
 */
public void testRewriteSingleTerm() throws IOException {
  AutomatonQuery aq = new AutomatonQuery(newTerm("bogus"), BasicAutomata
      .makeString("piece"));
  Terms terms = MultiFields.getTerms(searcher.getIndexReader(), FN);
  assertTrue(aq.getTermsEnum(terms) instanceof SingleTermsEnum);
  assertEquals(1, automatonQueryNrHits(aq));
}
项目:read-open-source-code    文件:FuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (maxEdits == 0 || prefixLength >= term.text().length()) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits, prefixLength, transpositions);
}
项目:read-open-source-code    文件:SlowFuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (!termLongEnough) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new SlowFuzzyTermsEnum(terms, atts, getTerm(), minimumSimilarity, prefixLength);
}
项目:read-open-source-code    文件:FuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (maxEdits == 0 || prefixLength >= term.text().length()) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits, prefixLength, transpositions);
}
项目:read-open-source-code    文件:SlowFuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (!termLongEnough) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new SlowFuzzyTermsEnum(terms, atts, getTerm(), minimumSimilarity, prefixLength);
}
项目:read-open-source-code    文件:FuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (maxEdits == 0 || prefixLength >= term.text().length()) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits, prefixLength, transpositions);
}
项目:read-open-source-code    文件:SlowFuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (!termLongEnough) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new SlowFuzzyTermsEnum(terms, atts, getTerm(), minimumSimilarity, prefixLength);
}
项目:Maskana-Gestor-de-Conocimiento    文件:SlowFuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (!termLongEnough) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new SlowFuzzyTermsEnum(terms, atts, getTerm(), minimumSimilarity, prefixLength);
}
项目:Maskana-Gestor-de-Conocimiento    文件:FuzzyQuery.java   
@Override
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException {
  if (maxEdits == 0 || prefixLength >= term.text().length()) {  // can only match if it's exact
    return new SingleTermsEnum(terms.iterator(null), term.bytes());
  }
  return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits, prefixLength, transpositions);
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestAutomatonQuery.java   
/**
 * Test that rewriting to a single term works as expected, preserves
 * MultiTermQuery semantics.
 */
public void testRewriteSingleTerm() throws IOException {
  AutomatonQuery aq = new AutomatonQuery(newTerm("bogus"), BasicAutomata
      .makeString("piece"));
  Terms terms = MultiFields.getTerms(searcher.getIndexReader(), FN);
  assertTrue(aq.getTermsEnum(terms) instanceof SingleTermsEnum);
  assertEquals(1, automatonQueryNrHits(aq));
}