aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/test/userdocumentsbuilder.h
blob: d8f73114ee6cb214c071aa555d451d61c7f07ea0 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "userdocuments.h"
#include <vespa/searchlib/test/doc_builder.h>
#include <vespa/vespalib/util/stringfmt.h>

namespace proton::test {

/**
 * Builder for creating documents for a set of users.
 */
class UserDocumentsBuilder
{
private:
    search::test::DocBuilder _builder;
    UserDocuments             _docs;
public:
    UserDocumentsBuilder();
    ~UserDocumentsBuilder();
    std::shared_ptr<const document::DocumentTypeRepo> getRepo() const {
        return _builder.get_repo_sp();
    }
    UserDocumentsBuilder &createDoc(uint32_t userId, search::DocumentIdT lid);
    UserDocumentsBuilder &createDocs(uint32_t userId, search::DocumentIdT begin,
                                     search::DocumentIdT end);
    UserDocumentsBuilder &clearDocs() {
        _docs.clear();
        return *this;
    }
    const UserDocuments &getDocs() const { return _docs; }
};


}