Package org.apache.lucene.index

Examples of org.apache.lucene.index.IndexReader.document()


            int docNumber;
            Document doc;
            try {
                if (tDocs.next()) {
                    docNumber = tDocs.doc();
                    doc = reader.document(docNumber);
                } else {
                    // node not found in index
                    return null;
                }
            } finally {
View Full Code Here


         */
        public Comparable sortValue(ScoreDoc i) {
            try {
                int idx = readerIndex(i.doc);
                IndexReader reader = readers.get(idx);
                Document doc = reader.document(i.doc - starts[idx], FieldSelectors.UUID);
                String uuid = doc.get(FieldNames.UUID);
                Path path = hmgr.getPath(new NodeId(UUID.fromString(uuid)));
                PathBuilder builder = new PathBuilder(path);
                builder.addAll(relPath.getElements());
                PropertyId id = hmgr.resolvePropertyPath(builder.getPath());
View Full Code Here

                });
            } finally {
                searcher.close();
            }
            for (Integer doc : docs) {
                Document d = reader.document(doc, FieldSelectors.UUID);
                UUID uuid = UUID.fromString(d.get(FieldNames.UUID));
                ids.add(new NodeId(uuid));
            }
        } finally {
            Util.closeOrRelease(reader);
View Full Code Here

                });
            } finally {
                searcher.close();
            }
            for (Integer doc : docs) {
                Document d = reader.document(doc, FieldSelectors.UUID);
                ids.add(new NodeId(d.get(FieldNames.UUID)));
            }
        } finally {
            Util.closeOrRelease(reader);
        }
View Full Code Here

            int docNumber;
            Document doc;
            try {
                if (tDocs.next()) {
                    docNumber = tDocs.doc();
                    doc = reader.document(docNumber);
                } else {
                    // node not found in index
                    return null;
                }
            } finally {
View Full Code Here

                        // TODO how to best avoid loading all entries in memory?
                        // (memory problem and performance problem)
                        TopDocs docs = searcher
                                .search(query, Integer.MAX_VALUE);
                        for (ScoreDoc doc : docs.scoreDocs) {
                            String path = reader.document(doc.doc,
                                    PATH_SELECTOR).get(PATH);
                            if (path != null) {
                                if ("".equals(path)) {
                                    path = "/";
                                }
View Full Code Here

    }

    protected String getUUIDForIndex(int doc) throws IOException {
        int idx = readerIndex(doc);
        IndexReader reader = readers.get(idx);
        Document document = reader.document(doc - starts[idx]);
        return document.get(FieldNames.UUID);
    }
}
View Full Code Here

                        // TODO how to best avoid loading all entries in memory?
                        // (memory problem and performance problem)
                        TopDocs docs = searcher
                                .search(query, Integer.MAX_VALUE);
                        for (ScoreDoc doc : docs.scoreDocs) {
                            String path = reader.document(doc.doc,
                                    PATH_SELECTOR).get(PATH);
                            if (path != null) {
                                if ("".equals(path)) {
                                    path = "/";
                                }
View Full Code Here

                });
            } finally {
                searcher.close();
            }
            for (Integer doc : docs) {
                Document d = reader.document(doc, FieldSelectors.UUID);
                ids.add(new NodeId(d.get(FieldNames.UUID)));
            }
        } finally {
            Util.closeOrRelease(reader);
        }
View Full Code Here

    if (withWarm()) {
      Document doc = null;
      Bits liveDocs = MultiFields.getLiveDocs(reader);
      for (int m = 0; m < reader.maxDoc(); m++) {
        if (null == liveDocs || liveDocs.get(m)) {
          doc = reader.document(m);
          res += (doc == null ? 0 : 1);
        }
      }
    }
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.