public BytesRef getStoredValue(int docid) throws IOException { Document doc = in.document(docid); if (doc != null) { return doc.getBinaryValue(AbstractZoieIndexable.DOCUMENT_STORE_FIELD); } return null; }
public BytesRef getStoredValue(int docid) throws IOException { Document doc = in.document(docid); if (doc != null) { return doc.getBinaryValue(AbstractZoieIndexable.DOCUMENT_STORE_FIELD); } return null; }
private synchronized int[] getAllowedLuceneIds(AtomicReaderContext context) throws IOException { AtomicReader reader = context.reader(); if (allowedLuceneIds.containsKey(reader)) { return allowedLuceneIds.get(reader); } LOG.debug("building WpId filter for " + wpIds.length + " ids with hash " + Arrays.hashCode(wpIds)); TIntSet wpIdSet = new TIntHashSet(wpIds); TIntSet luceneIdSet = new TIntHashSet(); Set<String> fields = new HashSet<String>(Arrays.asList(LuceneOptions.LOCAL_ID_FIELD_NAME)); for (int i = 0; i < reader.numDocs(); i++) { Document d = reader.document(i, fields); int wpId = Integer.valueOf(d.get(LuceneOptions.LOCAL_ID_FIELD_NAME)); if (wpIdSet.contains(wpId)) { luceneIdSet.add(i); } } int luceneIds[] = luceneIdSet.toArray(); LOG.debug("WpId filter matched " + luceneIds.length + " ids."); allowedLuceneIds.put(reader, luceneIds); return luceneIds; } }
reader = leaves.get(i).reader(); for (int d = 0; d < reader.maxDoc(); ++d) { field = reader.document(d).getField(docLengthFieldName); if (field != null) { number = field.numericValue().intValue();
@Override public void collect(int doc) throws IOException { idValues.setDocument(doc); if (idValues.count() > 0) { assert idValues.count() == 1; BytesRef id = idValues.valueAt(0); fieldsVisitor.reset(); reader.document(doc, fieldsVisitor); try { // id is only used for logging, if we fail we log the id in the catch statement final QueryAndSource queryAndSource = percolator.parsePercolatorDocument(null, fieldsVisitor.source()); queries.put(id.utf8ToString(), queryAndSource); } catch (Exception e) { logger.warn("failed to add query [{}]", e, id.utf8ToString()); } } else { logger.error("failed to load query since field [{}] not present", ID_FIELD); } }
docLengths.put(globalDocId, reader[i].document(localDocId).getField(docLengthFieldName) .numericValue().intValue());
Bits live = MultiFields.getLiveDocs(reader); for (int docNum = 0; docNum < reader.maxDoc(); docNum++) { Document doc = reader.document(docNum); if (live != null && live.get(docNum)) { continue; // not deleted