throw new RuntimeException("seek state is broken"); BytesRef output = Util.get(fr.index, prefix); if (output == null) { out.println(" broken seek state: prefix is not final in index");
public int getID(String url) { Long id = null; try { id = Util.get(fst, new BytesRef(url)); } catch (IOException e) { // Log error, but assume that URL doesn't exist. LOG.error("Error fetching " + url); e.printStackTrace(); return -1; } return id == null ? -1 : id.intValue(); }
public int[] getIdRange(String first, String last){ if (first == null || last == null) { return null; } Long startId = null, endId = null; try { startId = Util.get(fst, new BytesRef(first)); endId = Util.get(fst, new BytesRef(last)); if (startId == null || endId == null) { return null; } } catch (IOException e) { LOG.error("Error: " + e); e.printStackTrace(); return null; } return new int[] { (int) startId.longValue(), (int) endId.longValue() }; }
final IntsRef ints = irBuilder.get(); synchronized (this.fst) { if (Util.get(this.fst, ints) != null) { matches = true;
@Override public ClassificationResult<Boolean> assignClass(String text) throws IOException { Long output = 0L; try (TokenStream tokenStream = analyzer.tokenStream(textFieldName, text)) { CharTermAttribute charTermAttribute = tokenStream .addAttribute(CharTermAttribute.class); tokenStream.reset(); while (tokenStream.incrementToken()) { String s = charTermAttribute.toString(); Long d = Util.get(fst, new BytesRef(s)); if (d != null) { output += d; } } tokenStream.end(); } double score = 1 - Math.exp(-1 * Math.abs(bias - output.doubleValue()) / bias); return new ClassificationResult<>(output >= bias, score); }
throw new RuntimeException("seek state is broken"); BytesRef output = Util.get(fr.index, prefix); if (output == null) { out.println(" broken seek state: prefix is not final in index");
throw new RuntimeException("seek state is broken"); BytesRef output = Util.get(fr.index, prefix); if (output == null) { out.println(" broken seek state: prefix is not final in index");
throw new RuntimeException("seek state is broken"); BytesRef output = Util.get(fr.index, prefix); if (output == null) { out.println(" broken seek state: prefix is not final in index");
throw new RuntimeException("seek state is broken"); BytesRef output = Util.get(fr.index, prefix); if (output == null) { out.println(" broken seek state: prefix is not final in index");
throw new RuntimeException("seek state is broken"); Output output = Util.get(fr.index, prefix); if (output == null) { out.println(" broken seek state: prefix is not final in index");
throw new RuntimeException("seek state is broken"); Pair<BytesRef,Long> output = Util.get(fr.index, prefix); if (output == null) { out.println(" broken seek state: prefix is not final in index");
throw new RuntimeException("seek state is broken"); Pair<BytesRef,Long> output = Util.get(fr.index, prefix); if (output == null) { out.println(" broken seek state: prefix is not final in index");
private void updateWeights(IndexReader indexReader, int docId, Boolean assignedClass, SortedMap<String, Double> weights, double modifier, boolean updateFST) throws IOException { TermsEnum cte = textTerms.iterator(); // get the doc term vectors Terms terms = indexReader.getTermVector(docId, textFieldName); if (terms == null) { throw new IOException("term vectors must be stored for field " + textFieldName); } TermsEnum termsEnum = terms.iterator(); BytesRef term; while ((term = termsEnum.next()) != null) { cte.seekExact(term); if (assignedClass != null) { long termFreqLocal = termsEnum.totalTermFreq(); // update weights Long previousValue = Util.get(fst, term); String termString = term.utf8ToString(); weights.put(termString, previousValue == null ? 0 : Math.max(0, previousValue + modifier * termFreqLocal)); } } if (updateFST) { updateFST(weights); } }
if (token.byteAt(i) == separator) { BytesRef context = new BytesRef(token.bytes(), 0, i); Long output = Util.get(fst, Util.toIntsRef(context, new IntsRefBuilder())); assert output != null; contextCount = decodeWeight(output);