Package org.apache.lucene.index

Examples of org.apache.lucene.index.Term.field()


    TermEnum enumerator = reader.terms(getLuceneTerm(fieldName));
    try {
      Term it= enumerator.term(); /* same or following index term */
      if ((it != null)
          && it.text().equals(getTermText())
          && it.field().equals(fieldName)) {
        mtv.visitMatchingTerm(it);
      } else {
        System.out.println("No term in " + fieldName + " field for: " + toString());
      }
    } finally {
View Full Code Here


    TermEnum terms = indexReader.terms();
    while (terms.next()) {
      Term term = terms.term();
      //message(term.field() + ":" + term.text() + " freq:" + terms.docFreq());
      //if we're either not looking by field or we're matching the specific field
      if ((field == null) || field.equals(term.field()))
        termMap.put(term.field() + ":" + term.text(), Integer.valueOf((terms.docFreq())));
    }

    Iterator<String> termIterator = termMap.keySet().iterator();
    for (int ii = 0; termIterator.hasNext() && ii < 100; ii++) {
View Full Code Here

    while (terms.next()) {
      Term term = terms.term();
      //message(term.field() + ":" + term.text() + " freq:" + terms.docFreq());
      //if we're either not looking by field or we're matching the specific field
      if ((field == null) || field.equals(term.field()))
        termMap.put(term.field() + ":" + term.text(), Integer.valueOf((terms.docFreq())));
    }

    Iterator<String> termIterator = termMap.keySet().iterator();
    for (int ii = 0; termIterator.hasNext() && ii < 100; ii++) {
      String termDetails = termIterator.next();
View Full Code Here

    HashSet<String> stopWords = new HashSet<String>();
    String internedFieldName = StringHelper.intern(fieldName);
    TermEnum te = reader.terms(new Term(fieldName));
    Term term = te.term();
    while (term != null) {
      if (term.field() != internedFieldName) {
        break;
      }
      if (te.docFreq() > maxDocFreq) {
        stopWords.add(term.text());
      }
View Full Code Here

          while ((possibleMatch = fe.next()) != null) {
            numVariants++;
            totalVariantDocFreqs += fe.docFreq();
            float score = boostAtt.getBoost();
            if (variantsQ.size() < MAX_VARIANTS_PER_TERM || score > minScore) {
              ScoreTerm st = new ScoreTerm(new Term(startTerm.field(), BytesRef.deepCopyOf(possibleMatch)), score, startTerm);
              variantsQ.insertWithOverflow(st);
              minScore = variantsQ.top().score; // maintain minScore
            }
            maxBoostAtt.setMaxNonCompetitiveBoost(variantsQ.size() >= MAX_VARIANTS_PER_TERM ? minScore : Float.NEGATIVE_INFINITY);
          }
View Full Code Here

                    TermDocs docs = reader.termDocs();
                    try {
                        do {
                            Term term = terms.term();
                            if (term != null
                                    && term.field() == testField
                                    && term.text().startsWith(namePrefix)) {
                                if (checkLower) {
                                    int compare = termCompare(term.text(), lowerTerm.text(), propNameLength);
                                    if (compare > 0 || compare == 0 && inclusive) {
                                        // do not check lower term anymore if no
View Full Code Here

     
      if (tleft == null||tRight==null) {
        LOG.info("###termbreak###"+String.valueOf(tleft)+">>>>"+String.valueOf(tRight)+","+fieldLeft+","+fieldRigth);
        break;
      }
      if((!tleft.field().equals(fieldLeft))||(!tRight.field().equals(fieldRigth)))
      {
        LOG.info("###termbreak fieldchange###"+String.valueOf(tleft)+">>>>"+String.valueOf(tRight)+","+fieldLeft+","+fieldRigth);
        break;
      }
     
View Full Code Here

        {
          td.seek(te);
          this.set_Doc2TermNum_NonSkip(td, docs, freqs, termNum,true,maxDoc);
        } else {

          MixTermInfo cl = new MixTermInfo(df, termNum, tdreader,  new Term(t.field(), t.text()));
          if (termDocslist.size() < limitsize) {
            termDocslist.add(cl);
          } else {
            MixTermInfo peek = termDocslist.peek();
            if (UnInvertedFieldUtils.TD_CMP.compare(peek, cl) > 0 && cl.getCount() / (peek.getCount() + 1) > 1.5) {
View Full Code Here

      int df = te.docFreq();
      if (df <= SKIP_MIN || this.uni.baseAdvanceDocs == null) {
        td.seek(te);
        this.set_Doc2TermNum_NonSkip(td, docs, freqs, termNum, false, maxDoc);
      } else {
        MixTermInfo cl = new MixTermInfo(df, termNum, tdreader,  new Term(t.field(), t.text()));
        if (termDocslist.size() < limitsize) {
          termDocslist.add(cl);
        } else {
          MixTermInfo peek = termDocslist.peek();
          if (UnInvertedFieldUtils.TD_CMP.compare(peek, cl) > 0 && cl.getCount() / (peek.getCount() + 1) > 1.5) {
View Full Code Here

      String prefixField = prefix.field();
      do {
        Term term = enumerator.term();
        if (term != null &&
            term.text().startsWith(prefixText) &&
            term.field() == prefixField)
        {
          termDocs.seek(term);
          while (termDocs.next()) {
            handleDoc(termDocs.doc());
          }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.