Package org.apache.lucene.index

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


      }
    } else if (query instanceof PrefixQuery) {
      PrefixQuery pq = (PrefixQuery) query;
      Term term = pq.getPrefix();
      if (term.field().equals(BlurConstants.SUPER)) {
        return new PrefixQuery(new Term(name, term.bytes()));
      }
    } else if (query instanceof TermRangeQuery) {
      TermRangeQuery trq = (TermRangeQuery) query;
      BytesRef lowerTerm = trq.getLowerTerm();
      BytesRef upperTerm = trq.getUpperTerm();
View Full Code Here


      return terms;
    }

    TermsEnum termEnum = termsAll.iterator(null);

    termEnum.seekCeil(term.bytes());

    BytesRef currentTermText = termEnum.term();
    do {
      terms.add(currentTermText.utf8ToString());
      if (terms.size() >= size) {
View Full Code Here

    }
    if (query instanceof TermQuery) {
      TermQuery tq = (TermQuery) query;
      Term term = tq.getTerm();
      if (term.field().equals(fieldLessFieldName)) {
        return new TermQuery(new Term(name, term.bytes()));
      }
    } else if (query instanceof WildcardQuery) {
      WildcardQuery wq = (WildcardQuery) query;
      Term term = wq.getTerm();
      if (term.field().equals(fieldLessFieldName)) {
View Full Code Here

      }
    } else if (query instanceof WildcardQuery) {
      WildcardQuery wq = (WildcardQuery) query;
      Term term = wq.getTerm();
      if (term.field().equals(fieldLessFieldName)) {
        return new WildcardQuery(new Term(name, term.bytes()));
      }
    } else if (query instanceof MultiPhraseQuery) {
      MultiPhraseQuery mpq = (MultiPhraseQuery) query;
      int[] positions = mpq.getPositions();
      List<Term[]> termArrays = mpq.getTermArrays();
View Full Code Here

      }
    } else if (query instanceof PrefixQuery) {
      PrefixQuery pq = (PrefixQuery) query;
      Term term = pq.getPrefix();
      if (term.field().equals(BlurConstants.SUPER)) {
        return new PrefixQuery(new Term(name, term.bytes()));
      }
    } else if (query instanceof TermRangeQuery) {
      TermRangeQuery trq = (TermRangeQuery) query;
      BytesRef lowerTerm = trq.getLowerTerm();
      BytesRef upperTerm = trq.getUpperTerm();
View Full Code Here

          assertTrue(matchStart >= lastMatchStart);
          lastMatchStart = matchStart;
          // single character terms
          assertEquals(matchStart+1, matchEnd);
          // and the offsets must be correct...
          BytesRef bytes = term.bytes();
          assertEquals(1, bytes.length);
          assertEquals((char)bytes.bytes[bytes.offset], Character.toLowerCase(content.charAt(matchStart)));
        }
        // record just the start/end offset for simplicity
        seen.add(new Pair(p.getStartOffset(), p.getEndOffset()));
View Full Code Here

        System.out.println("      got term=" + UnicodeUtil.toHexString(t2.text()));
      }

      // Now test if prefix is identical and we found
      // a non-BMP char at the same position:
      BytesRef b2 = t2.bytes();
      assert b2.offset == 0;

      boolean matches;
      if (b2.length >= term.length && isNonBMPChar(b2.bytes, pos)) {
        matches = true;
View Full Code Here

        // We could hit EOF or different field since this
        // was a seek "forward":
        if (t2 != null && t2.field() == internedFieldName) {

          if (DEBUG_SURROGATES) {
            System.out.println("      got term=" + UnicodeUtil.toHexString(t2.text()) + " " + t2.bytes());
          }

          final BytesRef b2 = t2.bytes();
          assert b2.offset == 0;
View Full Code Here

          if (DEBUG_SURROGATES) {
            System.out.println("      got term=" + UnicodeUtil.toHexString(t2.text()) + " " + t2.bytes());
          }

          final BytesRef b2 = t2.bytes();
          assert b2.offset == 0;


          // Set newSuffixStart -- we can't use
          // termEnum's since the above seek may have
View Full Code Here

           
          if (DEBUG_SURROGATES) {
            if (t2 == null) {
              System.out.println("      hit term=null");
            } else {
              System.out.println("      hit term=" + UnicodeUtil.toHexString(t2.text()) + " " + (t2==null? null:t2.bytes()));
            }
          }

          // Since this was a seek "forward", we could hit
          // EOF or a different field:
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.