diff options
Diffstat (limited to 'searchlib')
4 files changed, 0 insertions, 314 deletions
diff --git a/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.cpp b/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.cpp index 22cd42da06f..34f42b03a58 100644 --- a/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.cpp @@ -2,7 +2,6 @@ #include "dictionarywordreader.h" #include <vespa/searchlib/index/schemautil.h> -#include <vespa/searchlib/index/olddictionaryfile.h> #include <vespa/vespalib/util/error.h> #include <vespa/log/log.h> diff --git a/searchlib/src/vespa/searchlib/index/CMakeLists.txt b/searchlib/src/vespa/searchlib/index/CMakeLists.txt index 9143ee867c8..71dd2fa1ddf 100644 --- a/searchlib/src/vespa/searchlib/index/CMakeLists.txt +++ b/searchlib/src/vespa/searchlib/index/CMakeLists.txt @@ -7,7 +7,6 @@ vespa_add_library(searchlib_searchlib_index OBJECT doctypebuilder.cpp dummyfileheadercontext.cpp indexbuilder.cpp - olddictionaryfile.cpp postinglisthandle.cpp postinglistcounts.cpp postinglistcountfile.cpp diff --git a/searchlib/src/vespa/searchlib/index/olddictionaryfile.cpp b/searchlib/src/vespa/searchlib/index/olddictionaryfile.cpp deleted file mode 100644 index ea572e59b76..00000000000 --- a/searchlib/src/vespa/searchlib/index/olddictionaryfile.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "olddictionaryfile.h" - -namespace search::index { - -OldDictionaryIndexMapping::OldDictionaryIndexMapping() - : _fieldIdToLocalId(), - _indexNames(), - _indexIds(), - _washedIndexIds() -{ -} - - -OldDictionaryIndexMapping::~OldDictionaryIndexMapping() -{ -} - - -void -OldDictionaryIndexMapping:: -setup(const Schema &schema, - const std::vector<vespalib::string> &fieldNames) -{ - _indexIds.clear(); - _washedIndexIds.clear(); - _indexNames.clear(); - - for (std::vector<vespalib::string>::const_iterator - i = fieldNames.begin(), ie = fieldNames.end(); - i != ie; - ++i) { - uint32_t fieldId = schema.getIndexFieldId(*i); - _indexIds.push_back(fieldId); - if (fieldId != Schema::UNKNOWN_FIELD_ID) - _washedIndexIds.push_back(fieldId); - _indexNames.push_back(*i); - } - setupHelper(schema); -} - - -void -OldDictionaryIndexMapping::setup(const Schema &schema, - const std::vector<uint32_t> &fields) -{ - _indexIds.clear(); - _washedIndexIds.clear(); - _indexNames.clear(); - - uint32_t fieldId = 0; - vespalib::string fname; - for (std::vector<uint32_t>::const_iterator - i = fields.begin(), ie = fields.end(); - i != ie; - ++i, ++fieldId) - { - assert(*i != Schema::UNKNOWN_FIELD_ID); - assert(*i < schema.getNumIndexFields()); - fname = schema.getIndexField(*i).getName(); - _indexIds.push_back(*i); - _washedIndexIds.push_back(*i); - _indexNames.push_back(fname); - } - setupHelper(schema); -} - - -void -OldDictionaryIndexMapping::setupHelper(const Schema &schema) -{ - // Create mapping to local ids - - _fieldIdToLocalId.clear(); - uint32_t localId = 0; - vespalib::string fname; - for (std::vector<uint32_t>::const_iterator - i = _indexIds.begin(), ie = _indexIds.end(); - i != ie; - ++i, ++localId) - { - if (*i == Schema::UNKNOWN_FIELD_ID) - continue; // Field on file not in current schema - assert(*i < schema.getNumIndexFields()); - (void) schema; - while (_fieldIdToLocalId.size() <= *i) - _fieldIdToLocalId.push_back(noLocalId()); - assert(_fieldIdToLocalId[*i] == noLocalId()); - _fieldIdToLocalId[*i] = localId; - } -} - - -OldDictionaryFileSeqRead::~OldDictionaryFileSeqRead() -{ -} - - -OldDictionaryFileSeqWrite::~OldDictionaryFileSeqWrite() -{ -} - -} diff --git a/searchlib/src/vespa/searchlib/index/olddictionaryfile.h b/searchlib/src/vespa/searchlib/index/olddictionaryfile.h deleted file mode 100644 index 85c0f810e1e..00000000000 --- a/searchlib/src/vespa/searchlib/index/olddictionaryfile.h +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include "postinglistcounts.h" -#include "postinglisthandle.h" -#include <vespa/searchcommon/common/schema.h> -#include <vespa/searchlib/common/tunefileinfo.h> -#include <map> -#include <vector> -#include <string> -#include <limits> - -namespace search -{ - -namespace common -{ - -class FileHeaderContext; - -} - -namespace index -{ - -class OldDictionaryIndexMapping -{ -private: - std::vector<uint32_t> _fieldIdToLocalId; - std::vector<vespalib::string> _indexNames; - std::vector<uint32_t> _indexIds; - std::vector<uint32_t> _washedIndexIds; - - void - setupHelper(const Schema &schema); - -public: - OldDictionaryIndexMapping(); - - ~OldDictionaryIndexMapping(); - - static uint32_t - noLocalId() - { - return std::numeric_limits<uint32_t>::max(); - } - - uint32_t - getLocalId(uint32_t dfid) const - { - if (dfid < _fieldIdToLocalId.size()) - return _fieldIdToLocalId[dfid]; - else - return noLocalId(); - } - - uint32_t - getExternalId(uint32_t localId) const - { - return _indexIds[localId]; - } - - void - setup(const Schema &schema, - const std::vector<vespalib::string> &indexNames); - - void - setup(const Schema &schema, - const std::vector<uint32_t> &indexes); - - const std::vector<uint32_t> & - getIndexIds() const - { - return _indexIds; - } - - const std::vector<uint32_t> & - getWashedIndexIds() const - { - return _washedIndexIds; - } - - const std::vector<vespalib::string> & - getIndexNames() const - { - return _indexNames; - } - - uint32_t - getNumIndexes() const - { - return _indexIds.size(); - } -}; - - -/** - * Interface for dictionary file containing words and counts for words. - * - * This is "at" schema level. - */ -class OldDictionaryFileSeqRead -{ -public: - OldDictionaryFileSeqRead() - { - } - - virtual - ~OldDictionaryFileSeqRead(); - - /** - * Read word and counts. Only nonzero counts are returned. If at - * end of dictionary then noWordNumHigh() is returned as word number. - */ - virtual void - readWord(vespalib::string &word, - uint64_t &wordNum, - std::vector<uint32_t> &indexes, - std::vector<PostingListCounts> &counts) = 0; - - /** - * Open dictionary file for sequential read. The supplied schema - * decides what existing indexes are visible (i.e. indexes in dictionary - * but not in schema are hidden). A dictionary might have no visible - * indexes. - */ - virtual bool - open(const vespalib::string &name, const Schema &schema, - const TuneFileSeqRead &tuneFileRead) = 0; - - /** - * Close dictionary file. - */ - virtual bool - close() = 0; - - /* - * Get visible indexes available in dictionary. - */ - virtual void - getIndexes(std::vector<uint32_t> &indexes) = 0; - - static uint64_t - noWordNum() - { - return 0u; - } - - static uint64_t - noWordNumHigh() - { - return std::numeric_limits<uint64_t>::max(); - } -}; - -/** - * Interface for dictionary file containing words and count for words. - * - * This is "at" schema level. - * - * The file should contain the set of field names for which the dictionary - * is valid, to simplify handling of schema changes. - */ -class OldDictionaryFileSeqWrite -{ -protected: -public: - OldDictionaryFileSeqWrite() - { - } - - virtual - ~OldDictionaryFileSeqWrite(); - - /** - * Write word and counts. Only nonzero counts should be supplied. - */ - virtual void - writeWord(vespalib::stringref word, - const std::vector<uint32_t> &indexes, - const std::vector<PostingListCounts> &counts) = 0; - - /** - * Open dictionary file for sequential write. The field with most - * words should be first for optimal compression. - */ - virtual bool - open(const vespalib::string &name, - uint32_t numWords, - uint32_t chunkSize, - const std::vector<uint32_t> &indexes, - const Schema &schema, - const TuneFileSeqWrite &tuneFileWrite, - const common::FileHeaderContext &fileHeaderContext) = 0; - - /** - * Close dictionary file. - */ - virtual bool - close() = 0; -}; - - -} // namespace index - -} // namespace search - |