blob: 6dd8ec9d350aba59c09c38a4ff9a5435c96b6b14 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "compression.h"
#include <vespa/searchlib/index/postinglistcounts.h>
#include <limits>
#define K_VALUE_COUNTFILE_POSOCCBITS 6
namespace search::bitcompression {
class PostingListCountFileDecodeContext : public FeatureDecodeContext<true>
{
public:
using ParentClass = FeatureDecodeContext<true>;
using PostingListCounts = index::PostingListCounts;
uint32_t _avgBitsPerDoc; // Average number of bits per document
uint32_t _minChunkDocs; // Minimum number of documents for chunking
uint32_t _docIdLimit; // Limit for document ids (docId < docIdLimit)
uint64_t _numWordIds; // Number of words in dictionary
PostingListCountFileDecodeContext()
: ParentClass(),
_avgBitsPerDoc(10),
_minChunkDocs(262144),
_docIdLimit(10000000),
_numWordIds(0)
{
}
void readCounts(PostingListCounts &counts);
static uint64_t noWordNum() {
return std::numeric_limits<uint64_t>::max();
}
void copyParams(const PostingListCountFileDecodeContext &rhs);
};
class PostingListCountFileEncodeContext : public FeatureEncodeContext<true>
{
public:
using ParentClass = FeatureEncodeContext<true>;
using PostingListCounts = index::PostingListCounts;
uint32_t _avgBitsPerDoc; // Average number of bits per document
uint32_t _minChunkDocs; // Minimum number of documents for chunking
uint32_t _docIdLimit; // Limit for document ids (docId < docIdLimit)
uint64_t _numWordIds; // Number of words in dictionary
PostingListCountFileEncodeContext()
: ParentClass(),
_avgBitsPerDoc(10),
_minChunkDocs(262144),
_docIdLimit(10000000),
_numWordIds(0)
{
}
void writeCounts(const PostingListCounts &counts);
static uint64_t noWordNum() {
return std::numeric_limits<uint64_t>::max();
}
void copyParams(const PostingListCountFileEncodeContext &rhs);
};
}
|