void doTestDocument() { sis->read(dir); IndexReaderPtr reader = openReader(); BOOST_CHECK(reader); DocumentPtr newDoc1 = reader->document(0); BOOST_CHECK(newDoc1); BOOST_CHECK(DocHelper::numFields(newDoc1) == DocHelper::numFields(doc1) - DocHelper::unstored.size()); DocumentPtr newDoc2 = reader->document(1); BOOST_CHECK(newDoc2); BOOST_CHECK(DocHelper::numFields(newDoc2) == DocHelper::numFields(doc2) - DocHelper::unstored.size()); TermFreqVectorPtr vector = reader->getTermFreqVector(0, DocHelper::TEXT_FIELD_2_KEY); BOOST_CHECK(vector); checkNorms(reader); }
void testTermVectors() { int32_t numDocs = reader->numDocs(); int64_t start = 0; for (int32_t docId = 0; docId < numDocs; ++docId) { start = MiscUtils::currentTimeMillis(); Collection<TermFreqVectorPtr> vectors = reader->getTermFreqVectors(docId); timeElapsed += MiscUtils::currentTimeMillis() - start; // verify vectors result verifyVectors(vectors, docId); start = MiscUtils::currentTimeMillis(); TermFreqVectorPtr vector = reader->getTermFreqVector(docId, L"field"); timeElapsed += MiscUtils::currentTimeMillis() - start; vectors = newCollection<TermFreqVectorPtr>(vector); verifyVectors(vectors, docId); } }