Skip to content

Commit

Permalink
Corrected a mistake and changed a manual for loop to an for (auto : )…
Browse files Browse the repository at this point in the history
… loop
  • Loading branch information
Flixtastic committed Jan 19, 2025
1 parent ad17e8c commit 9208666
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
31 changes: 15 additions & 16 deletions src/index/IndexImpl.Text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,15 +574,14 @@ IdTable IndexImpl::readWordCl(
const TextBlockMetaData& tbmd,
const ad_utility::AllocatorWithLimit<Id>& allocator) const {
IdTable idTable{3, allocator};
vector<TextRecordIndex> cids =
textIndexReadWrite::readGapComprList<TextRecordIndex, uint64_t>(
tbmd._cl._nofElements, tbmd._cl._startContextlist,
static_cast<size_t>(tbmd._cl._startWordlist -
tbmd._cl._startContextlist),
textIndexFile_, &TextRecordIndex::make);
vector<Id> cids = textIndexReadWrite::readGapComprList<Id, uint64_t>(
tbmd._cl._nofElements, tbmd._cl._startContextlist,
static_cast<size_t>(tbmd._cl._startWordlist - tbmd._cl._startContextlist),
textIndexFile_, [](uint64_t id) {
return Id::makeFromTextRecordIndex(TextRecordIndex::make(id));
});
idTable.resize(cids.size());
ql::ranges::transform(cids, idTable.getColumn(0).begin(),
&Id::makeFromTextRecordIndex);
ql::ranges::copy(cids, idTable.getColumn(0).begin());
ql::ranges::copy(
textIndexReadWrite::readFreqComprList<Id, WordIndex>(
tbmd._cl._nofElements, tbmd._cl._startWordlist,
Expand All @@ -607,15 +606,15 @@ IdTable IndexImpl::readWordEntityCl(
const TextBlockMetaData& tbmd,
const ad_utility::AllocatorWithLimit<Id>& allocator) const {
IdTable idTable{3, allocator};
vector<TextRecordIndex> cids =
textIndexReadWrite::readGapComprList<TextRecordIndex, uint64_t>(
tbmd._entityCl._nofElements, tbmd._entityCl._startContextlist,
static_cast<size_t>(tbmd._entityCl._startWordlist -
tbmd._entityCl._startContextlist),
textIndexFile_, &TextRecordIndex::make);
vector<Id> cids = textIndexReadWrite::readGapComprList<Id, uint64_t>(
tbmd._entityCl._nofElements, tbmd._entityCl._startContextlist,
static_cast<size_t>(tbmd._entityCl._startWordlist -
tbmd._entityCl._startContextlist),
textIndexFile_, [](uint64_t id) {
return Id::makeFromTextRecordIndex(TextRecordIndex::make(id));
});
idTable.resize(cids.size());
ql::ranges::transform(cids, idTable.getColumn(0).begin(),
&Id::makeFromTextRecordIndex);
ql::ranges::copy(cids, idTable.getColumn(0).begin());
ql::ranges::copy(
textIndexReadWrite::readFreqComprList<Id, WordIndex>(
tbmd._entityCl._nofElements, tbmd._entityCl._startWordlist,
Expand Down
4 changes: 2 additions & 2 deletions src/index/TextIndexReadWrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ vector<To> readGapComprList(size_t nofElements, off_t from, size_t nofBytes,
vector<To> result;
result.reserve(nofElements);
From previous = 0;
for (size_t i = 0; i < gapEncodedVector.size(); ++i) {
previous += gapEncodedVector[i];
for (auto gap : gapEncodedVector) {
previous += gap;
result.push_back(transformer(previous));
}
LOG(DEBUG) << "Done reading gap-encoded list. Size: " << result.size()
Expand Down

0 comments on commit 9208666

Please sign in to comment.