Package org.apache.lucene.index

Examples of org.apache.lucene.index.Term


  public void testConvertMatchAllDocsQuery() throws ParseException {
    doConvert(new MatchAllDocsQuery());
  }

  public void testTermQuery() throws ParseException {
    doConvert(new TermQuery(new Term("tags", "hybrid")));
  }
View Full Code Here


  public void testTermQuery() throws ParseException {
    doConvert(new TermQuery(new Term("tags", "hybrid")));
  }

  public void testFuzzyQuery() throws ParseException {
    doConvert(new FuzzyQuery(new Term("tags", "hybrid")));
  }
View Full Code Here

  public void testFuzzyQuery() throws ParseException {
    doConvert(new FuzzyQuery(new Term("tags", "hybrid")));
  }
 
  public void testWildcardQuery() throws ParseException {
    doConvert(new WildcardQuery(new Term("*", "m**")));
  }
 
View Full Code Here

  public void testWildcardQuery() throws ParseException {
    doConvert(new WildcardQuery(new Term("*", "m**")));
  }

  public void testPrefixQuery() throws ParseException {
    doConvert(new PrefixQuery(new Term("tags", "h")));
  }
View Full Code Here

    doConvert(new PrefixQuery(new Term("tags", "h")));
  }

  public void testBooleanQuery() throws ParseException {
    BooleanQuery bq = new BooleanQuery();
    Query q1 = new TermQuery(new Term("tags", "h*"));
    BooleanClause bc = new BooleanClause(q1, BooleanClause.Occur.MUST);
    bq.add(bc);
    doConvert(bq);
  }
View Full Code Here

    doConvert(bq);
  }

  public void testPhraseQuery() throws ParseException {
    PhraseQuery pq = new PhraseQuery();
    pq.add(new Term("tags", "h*"));
    pq.add(new Term("tags", "x*"));
    doConvert(pq);
  }
 
View Full Code Here

//      qstr = "project manager";
      String[] terms = qstr.split(" ");
      BooleanQuery q = new BooleanQuery();
    for(String s : terms)
    {
      q.add( new TermQuery(new Term("b",s)), Occur.MUST);
    }
//      q.add(new MatchAllDocsQuery(), Occur.MUST);
      req.setQuery(q);//new TermQuery(new Term("b",qstr)));
      BrowseSelection sel = new BrowseSelection("ccid");
      sel.addValue("0000001384");
View Full Code Here

    // Read the terms
    if (!fieldsToReadSet.isEmpty()) {
      try {
        TermEnum termEnum = indexReader.terms();
        while (termEnum.next()) {
          Term term = termEnum.term();
          String field = term.field();
          if (fieldsToReadSet.contains(field)) {
            // This is a value of a wanted field
            ArrayList valueList = (ArrayList) resultMap.get(field);
            valueList.add(term.text());
          }
        }
      } catch (IOException exc) {
        throw new RegainException("Reading terms from index failed", exc);
      }
View Full Code Here

    }
   
    private class TermDocIdSet extends DocIdSet{
      final Term term;
      TermDocIdSet(String name,String val){
        term = new Term(name,val);
      }
View Full Code Here

      maxIDList.add(-1);
      freqList.add(0);
    t++;
    try {
      termDocs = reader.termDocs();
      termEnum = reader.terms(new Term(_indexFieldName, ""));
      do {
        if (termEnum == null)
          break;
        Term term = termEnum.term();
        if (term == null || !_indexFieldName.equals(term.field()))
          break;

        // store term text
        // we expect that there is at most one term per document
        if (t > MAX_VAL_COUNT) {
          throw new IOException("maximum number of value cannot exceed: "
              + MAX_VAL_COUNT);
        }
        String val = term.text();
        mterms.add(val);
        int bit = (0x00000001 << (t-1));
        termDocs.seek(termEnum);
        //freqList.add(termEnum.docFreq());  // removed because the df doesn't take into account the num of deletedDocs
        int df = 0;
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.Term

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.