/** * Initialize the byte[] from the UTF8 bytes for the provided String. * * @param text * This must be well-formed unicode text, with no unpaired surrogates. */ public BytesRef(CharSequence text) { this(); copyChars(text); }
public BytesRef next() throws IOException { if (done) { return null; } line = in.readLine(); if (line != null) { String[] fields = line.split("\t"); if (fields.length > 1) { // keep reading floats for bw compat try { curFreq = Long.parseLong(fields[1]); } catch (NumberFormatException e) { curFreq = (long)Double.parseDouble(fields[1]); } spare.copyChars(fields[0]); } else { spare.copyChars(line); curFreq = 1; } return spare; } else { done = true; IOUtils.close(in); return null; } }
public BytesRef next() throws IOException { if (done) { return null; } boolean success = false; BytesRef result; try { String line; if ((line = in.readLine()) != null) { spare.copyChars(line); result = spare; } else { done = true; IOUtils.close(in); result = null; } success = true; } finally { if (!success) { IOUtils.closeWhileHandlingException(in); } } return result; }
LOG.info(i + " URLs processed."); scratchBytes.copyChars((String) inputValues.get(i)); try { builder.add(Util.toIntsRef(scratchBytes, scratchInts), (long) i);
LOG.info(i + " URLs processed."); scratchBytes.copyChars((String) urls.get(i)); try { builder.add(Util.toIntsRef(scratchBytes, scratchInts), (long) i);
public BytesRef next() throws IOException { if (termsEnum != null) { Term actualTerm; do { actualTerm = termsEnum.term(); if (actualTerm == null || actualTerm.field() != field) { return null; } freq = termsEnum.docFreq(); spare.copyChars(actualTerm.text()); termsEnum.next(); return spare; } while(termsEnum.next()); } return null; }
public BytesRef next() throws IOException { if (termsEnum != null) { Term actualTerm; do { actualTerm = termsEnum.term(); if (actualTerm == null || actualTerm.field() != field) { return null; } if (isFrequent(termsEnum.docFreq())) { freq = termsEnum.docFreq(); spare.copyChars(actualTerm.text()); termsEnum.next(); return spare; } } while(termsEnum.next()); } return null; }