aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/index/postinglistcountfile.h
blob: 7e17fc5bb9e05b87192429b68ad4ca8459b54d73 (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
71
72
73
74
75
76
77
78
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "postinglistcounts.h"
#include <vespa/searchlib/common/tunefileinfo.h>
#include <vespa/vespalib/stllike/string.h>

namespace search::common { class FileHeaderContext; }

namespace search::index {

class PostingListCounts;
class PostingListHandle;
class PostingListParams;

/**
 * Interface for count files describing where in a posting list file
 * the various words are located.  It is merged at index time with a
 * text-only dictionary to produce a binary dictionary optimized for
 * random access used at search time.
 *
 * TODO: Might want to allow semi-random access for prefix searches,
 * allowing for less data in posting list files being duplicated from
 * the count file.
 */
class PostingListCountFileSeqRead {
public:
    PostingListCountFileSeqRead();

    virtual ~PostingListCountFileSeqRead();

    /**
     * Open posting list count file for sequential read.
     */
    virtual bool open(const vespalib::string &name, const TuneFileSeqRead &tuneFileRead) = 0;

    /**
     * Close posting list count file.
     */
    virtual bool close() = 0;

    /*
     * Get current parameters.
     */
    virtual void getParams(PostingListParams &params);
};


class PostingListCountFileSeqWrite {
public:
    PostingListCountFileSeqWrite();

    virtual ~PostingListCountFileSeqWrite();

    /**
     * Open posting list count file for sequential write.
     */
    virtual bool open(const vespalib::string &name,
                      const TuneFileSeqWrite &tuneFileWrite,
                      const common::FileHeaderContext &fileHeaderContext) = 0;

    /**
     * Close posting list count file.
     */
    virtual bool close() = 0;

    /*
     * Set parameters.
     */
    virtual void setParams(const PostingListParams &params);

    /*
     * Get current parameters.
     */
    virtual void getParams(PostingListParams &params);
};

}