aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcorespi/index/isearchableindexcollection.h
blob: efd7062af71db85f83c3d2f425a2df819b305853 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "iindexcollection.h"
#include "indexsearchable.h"

namespace searchcorespi {

/**
 * Interface to both an IndexCollection and to an IndexSearchable
 */
class ISearchableIndexCollection : public IIndexCollection,
                                   public IndexSearchable {
public:
    ISearchableIndexCollection() : _currentIndex(-1) { }
    using UP = std::unique_ptr<ISearchableIndexCollection>;
    using SP = std::shared_ptr<ISearchableIndexCollection>;

    virtual void append(uint32_t id, const IndexSearchable::SP &source) = 0;
    virtual void replace(uint32_t id, const IndexSearchable::SP &source) = 0;
    virtual IndexSearchable::SP getSearchableSP(uint32_t i) const = 0;
    virtual void setSource(uint32_t docId) = 0;

    void setCurrentIndex(uint32_t id);
    uint32_t getCurrentIndex() const;
    bool valid() const;

private:
    int32_t _currentIndex;
};

}  // namespace searchcorespi