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); }
static bool verifyIndex(DirectoryPtr directory, int32_t startAt) { bool fail = false; IndexReaderPtr reader = IndexReader::open(directory, true); int32_t max = reader->maxDoc(); for (int32_t i = 0; i < max; ++i) { DocumentPtr temp = reader->document(i); if (temp->getField(L"count")->stringValue() != StringUtils::toString(i + startAt)) fail = true; } reader->close(); return fail; }