@@ -16,17 +16,17 @@ SegmentSearcher::~SegmentSearcher()
16
16
{
17
17
}
18
18
19
- void SegmentSearcher::search (uint32_t *fingerprint, size_t length , std::unordered_map<uint32_t , int > &hits)
19
+ void SegmentSearcher::search (const std::vector< uint32_t > &hashes , std::unordered_map<uint32_t , int > &hits)
20
20
{
21
21
size_t i = 0 , block = 0 , lastBlock = SIZE_MAX;
22
- while (i < length ) {
22
+ while (i < hashes. size () ) {
23
23
if (block > lastBlock || lastBlock == SIZE_MAX) {
24
24
size_t localFirstBlock, localLastBlock;
25
- if (fingerprint [i] > m_lastKey) {
25
+ if (hashes [i] > m_lastKey) {
26
26
// All following items are larger than the last segment's key.
27
27
return ;
28
28
}
29
- if (m_index->search (fingerprint [i], &localFirstBlock, &localLastBlock)) {
29
+ if (m_index->search (hashes [i], &localFirstBlock, &localLastBlock)) {
30
30
if (block > localLastBlock) {
31
31
// We already searched this block and the fingerprint item was not found.
32
32
i++;
@@ -47,18 +47,18 @@ void SegmentSearcher::search(uint32_t *fingerprint, size_t length, std::unordere
47
47
std::unique_ptr<BlockDataIterator> blockData (m_dataReader->readBlock (block, firstKey));
48
48
while (blockData->next ()) {
49
49
uint32_t key = blockData->key ();
50
- if (key >= fingerprint [i]) {
51
- while (key > fingerprint [i]) {
50
+ if (key >= hashes [i]) {
51
+ while (key > hashes [i]) {
52
52
i++;
53
- if (i >= length ) {
53
+ if (i >= hashes. size () ) {
54
54
return ;
55
55
}
56
- else if (lastKey < fingerprint [i]) {
56
+ else if (lastKey < hashes [i]) {
57
57
// There are no longer any items in this block that we could match.
58
58
goto nextBlock;
59
59
}
60
60
}
61
- if (key == fingerprint [i]) {
61
+ if (key == hashes [i]) {
62
62
auto docId = blockData->value ();
63
63
hits[docId]++;
64
64
}
0 commit comments