summaryrefslogtreecommitdiffstats
path: root/searchcorespi/src/vespa/searchcorespi/index/isearchableindexcollection.h
blob: 665f08e0e04a197ccb09e878612d891e61c09392 (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
// Copyright 2016 Yahoo Inc. 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) { }
    typedef std::unique_ptr<ISearchableIndexCollection> UP;
    typedef std::shared_ptr<ISearchableIndexCollection> SP;
    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