Examples of utf8ToString()


Examples of org.apache.lucene.util.BytesRef.utf8ToString()

          SeekStatus status;
          BytesRef rawTerm = null;
          if (te != null) {
            rawTerm = te.term();
          }
          String rawString = rawTerm != null ? rawTerm.utf8ToString() : null;
          if (te == null || !teField.equals(fld) || !text.equals(rawString)) {
            Terms terms = MultiFields.getTerms(ir, fld);
            te = terms.iterator(null);
            putProperty(fCombo, "te", te);
            putProperty(fCombo, "teField", fld);
View Full Code Here

Examples of org.apache.lucene.util.BytesRef.utf8ToString()

            Automaton a = WildcardQuery.toAutomaton(newFulltextTerm(token));
            CompiledAutomaton ca = new CompiledAutomaton(a);
            TermsEnum te = ca.getTermsEnum(t);
            BytesRef text;
            while ((text = te.next()) != null) {
                terms.add(newFulltextTerm(text.utf8ToString()));
            }
            return terms.toArray(new Term[terms.size()]);
        } catch (IOException e) {
            LOG.error("Building fulltext query failed", e.getMessage());
            return null;
View Full Code Here

Examples of org.apache.lucene.util.BytesRef.utf8ToString()

    out.write(bytes.bytes, bytes.offset, bytes.length);
  }

  public static String readString(DataInput in) throws IOException {
    BytesRef bytes = readBytesRef(in);
    return bytes.utf8ToString();
  }

  public static BytesRef readBytesRef(DataInput in) throws IOException {
    int length = in.readInt();
    BytesRef bytes = new BytesRef(length);
View Full Code Here

Examples of org.apache.lucene.util.BytesRef.utf8ToString()

            Automaton a = WildcardQuery.toAutomaton(newFulltextTerm(token));
            CompiledAutomaton ca = new CompiledAutomaton(a);
            TermsEnum te = ca.getTermsEnum(t);
            BytesRef text;
            while ((text = te.next()) != null) {
                terms.add(newFulltextTerm(text.utf8ToString()));
            }
            return terms.toArray(new Term[terms.size()]);
        } catch (IOException e) {
            LOG.error("Building fulltext query failed", e.getMessage());
            return null;
View Full Code Here

Examples of org.apache.lucene.util.BytesRef.utf8ToString()

    IndexReader ir = DirectoryReader.open(dir);
    Dictionary dictionary = new DocumentDictionary(ir, FIELD_NAME, WEIGHT_FIELD_NAME, PAYLOAD_FIELD_NAME);
    InputIterator tfp = (InputIterator) dictionary.getWordsIterator();
    BytesRef f;
    while((f = tfp.next())!=null) {
      Document doc = docs.remove(f.utf8ToString());
      assertTrue(f.equals(new BytesRef(doc.get(FIELD_NAME))));
      assertEquals(tfp.weight(), doc.getField(WEIGHT_FIELD_NAME).numericValue().longValue());
      assertTrue(tfp.payload().equals(doc.getField(PAYLOAD_FIELD_NAME).binaryValue()));
    }
    assertTrue(docs.isEmpty());
View Full Code Here

Examples of org.apache.lucene.util.BytesRef.utf8ToString()

    IndexReader ir = DirectoryReader.open(dir);
    Dictionary dictionary = new DocumentDictionary(ir, FIELD_NAME, WEIGHT_FIELD_NAME);
    InputIterator tfp = (InputIterator) dictionary.getWordsIterator();
    BytesRef f;
    while((f = tfp.next())!=null) {
      Document doc = docs.remove(f.utf8ToString());
      assertTrue(f.equals(new BytesRef(doc.get(FIELD_NAME))));
      assertEquals(tfp.weight(), doc.getField(WEIGHT_FIELD_NAME).numericValue().longValue());
      assertEquals(tfp.payload(), null);
    }
    assertTrue(docs.isEmpty());
View Full Code Here

Examples of org.apache.lucene.util.BytesRef.utf8ToString()

    assertEquals(ir.numDocs(), docs.size());
    Dictionary dictionary = new DocumentDictionary(ir, FIELD_NAME, WEIGHT_FIELD_NAME);
    InputIterator tfp = (InputIterator) dictionary.getWordsIterator();
    BytesRef f;
    while((f = tfp.next())!=null) {
      Document doc = docs.remove(f.utf8ToString());
      assertTrue(f.equals(new BytesRef(doc.get(FIELD_NAME))));
      assertEquals(tfp.weight(), doc.getField(WEIGHT_FIELD_NAME).numericValue().longValue());
      assertEquals(tfp.payload(), null);
    }
    assertTrue(docs.isEmpty());
View Full Code Here

Examples of org.apache.lucene.util.BytesRef.utf8ToString()

      dpEnum = termsEnum.docsAndPositions(null, dpEnum);
      if (dpEnum == null) {
        throw new IllegalArgumentException(
            "Required TermVector Offset information was not found");
      }
      final String term = text.utf8ToString();

      dpEnum.nextDoc();
      final int freq = dpEnum.freq();
      for(int posUpto=0;posUpto<freq;posUpto++) {
        final int pos = dpEnum.nextPosition();
View Full Code Here

Examples of org.apache.lucene.util.BytesRef.utf8ToString()

      sdv.get(i, scratch);
      assertEquals(new BytesRef(Integer.toString(i)), scratch);
      ssdv.setDocument(i);
      long ord = ssdv.nextOrd();
      ssdv.lookupOrd(ord, scratch);
      assertEquals(i, Integer.parseInt(scratch.utf8ToString()));
      if (i != 0) {
        ord = ssdv.nextOrd();
        ssdv.lookupOrd(ord, scratch);
        assertEquals(i * 2, Integer.parseInt(scratch.utf8ToString()));
      }
View Full Code Here

Examples of org.apache.lucene.util.BytesRef.utf8ToString()

      ssdv.lookupOrd(ord, scratch);
      assertEquals(i, Integer.parseInt(scratch.utf8ToString()));
      if (i != 0) {
        ord = ssdv.nextOrd();
        ssdv.lookupOrd(ord, scratch);
        assertEquals(i * 2, Integer.parseInt(scratch.utf8ToString()));
      }
      assertEquals(SortedSetDocValues.NO_MORE_ORDS, ssdv.nextOrd());
    }
   
    reader.close();
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.