diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-10-09 18:10:51 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-10-09 18:10:51 +0000 |
commit | 943a63a1022d90cb16fd34cd1d39d8f6d5586503 (patch) | |
tree | def5c31ed2d8763f7ce8bec2c0717436db0b5d83 /searchlib | |
parent | d318abe5c4880c235847dc8f72e5fadb245dbc8f (diff) |
Remove unused (de)serialization to/from nbostream.
Diffstat (limited to 'searchlib')
9 files changed, 0 insertions, 277 deletions
diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectorkeyscope.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectorkeyscope.cpp index 2e02b092ddd..ee18383debd 100644 --- a/searchlib/src/vespa/searchlib/diskindex/bitvectorkeyscope.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/bitvectorkeyscope.cpp @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "bitvectorkeyscope.h" -#include <vespa/vespalib/objects/nbostream.h> #include <cassert> using search::diskindex::BitVectorKeyScope; @@ -19,46 +18,3 @@ const char *getBitVectorKeyScopeSuffix(BitVectorKeyScope scope) } } - - -namespace { - -uint8_t -getVal(BitVectorKeyScope scope) -{ - switch (scope) { - case BitVectorKeyScope::SHARED_WORDS: - return 0u; - default: - return 1u; - } -} - - -const BitVectorKeyScope scopes[] = { BitVectorKeyScope::SHARED_WORDS, - BitVectorKeyScope::PERFIELD_WORDS }; - -} - - -namespace vespalib { - -nbostream & -operator<<(nbostream &stream, const BitVectorKeyScope &scope) -{ - uint8_t val = getVal(scope); - stream << val; - return stream; -} - -nbostream & -operator>>(nbostream &stream, BitVectorKeyScope &scope) -{ - uint8_t val; - stream >> val; - assert(val < sizeof(scopes) / sizeof(scopes[0])); - scope = scopes[val]; - return stream; -} - -} diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectorkeyscope.h b/searchlib/src/vespa/searchlib/diskindex/bitvectorkeyscope.h index 1c931225cc0..7b2af6adb9d 100644 --- a/searchlib/src/vespa/searchlib/diskindex/bitvectorkeyscope.h +++ b/searchlib/src/vespa/searchlib/diskindex/bitvectorkeyscope.h @@ -3,14 +3,6 @@ #pragma once -namespace vespalib -{ - -class nbostream; - -} - - namespace search { @@ -28,16 +20,3 @@ const char *getBitVectorKeyScopeSuffix(BitVectorKeyScope scope); } } - -namespace vespalib -{ - -nbostream & -operator<<(nbostream &stream, - const search::diskindex::BitVectorKeyScope &scope); - -nbostream & -operator>>(nbostream &stream, - search::diskindex::BitVectorKeyScope &scope); - -} diff --git a/searchlib/src/vespa/searchlib/diskindex/docidmapper.cpp b/searchlib/src/vespa/searchlib/diskindex/docidmapper.cpp index 84066aa4e65..70f7bdfea10 100644 --- a/searchlib/src/vespa/searchlib/diskindex/docidmapper.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/docidmapper.cpp @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "docidmapper.h" -#include <vespa/vespalib/objects/nbostream.h> #include <vespa/searchlib/common/documentsummary.h> #include <vespa/searchlib/common/bitvector.h> #include <vespa/fastlib/io/bufferedfile.h> diff --git a/searchlib/src/vespa/searchlib/diskindex/extposocc.cpp b/searchlib/src/vespa/searchlib/diskindex/extposocc.cpp index 89c801f04b5..c6f9cc757fd 100644 --- a/searchlib/src/vespa/searchlib/diskindex/extposocc.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/extposocc.cpp @@ -7,7 +7,6 @@ #include <vespa/searchlib/index/docidandfeatures.h> #include <vespa/searchlib/index/postinglistcounts.h> #include <vespa/searchlib/index/postinglistcountfile.h> -#include <vespa/vespalib/objects/nbostream.h> #include <vespa/log/log.h> LOG_SETUP(".diskindex.extposocc"); diff --git a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp index 00b6d23fbcf..3bd879de291 100644 --- a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "wordnummapper.h" -#include <vespa/vespalib/objects/nbostream.h> #include <vespa/fastlib/io/bufferedfile.h> #include <cassert> diff --git a/searchlib/src/vespa/searchlib/index/docidandfeatures.cpp b/searchlib/src/vespa/searchlib/index/docidandfeatures.cpp index 6c14498be76..513c542637d 100644 --- a/searchlib/src/vespa/searchlib/index/docidandfeatures.cpp +++ b/searchlib/src/vespa/searchlib/index/docidandfeatures.cpp @@ -1,14 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "docidandfeatures.h" -#include <vespa/vespalib/objects/nbostream.h> #include <vespa/log/log.h> LOG_SETUP(".index.docidandfeatures"); namespace search::index { -using vespalib::nbostream; - DocIdAndFeatures::DocIdAndFeatures() : _docId(0), _wordDocFeatures(), @@ -24,100 +21,4 @@ DocIdAndFeatures::DocIdAndFeatures(const DocIdAndFeatures &) = default; DocIdAndFeatures & DocIdAndFeatures::operator = (const DocIdAndFeatures &) = default; DocIdAndFeatures::~DocIdAndFeatures() { } -#if 0 -void -DocIdAndFeatures::append(const DocIdAndFeatures &rhs, uint32_t localFieldId) -{ - assert(!rhs.getRaw()); - assert(rhs._fields.size() == 1); - const WordDocFieldFeatures &field = rhs._fields.front(); - assert(field.getFieldId() == 0); - uint32_t numElements = field.getNumElements(); - std::vector<WordDocFieldElementFeatures>::const_iterator element = - rhs._elements.begin(); - std::vector<WordDocFieldElementWordPosFeatures>::const_iterator position = - rhs._wordPositions.begin(); - assert(_fields.empty() || localFieldId > _fields.back().getFieldId()); - _fields.push_back(field); - _fields.back().setFieldId(localFieldId); - for (uint32_t elementDone = 0; elementDone < numElements; - ++elementDone, ++element) { - _elements.push_back(*element); - for (uint32_t posResidue = element->getNumOccs(); posResidue > 0; - --posResidue, ++position) { - _wordPositions.push_back(*position); - } - } -} -#endif - - -nbostream & -operator<<(nbostream &out, const WordDocElementFeatures &features) -{ - out << features._elementId << features._numOccs << - features._weight << features._elementLen; - return out; -} - - -nbostream & -operator>>(nbostream &in, WordDocElementFeatures &features) -{ - in >> features._elementId >> features._numOccs >> - features._weight >> features._elementLen; - return in; -} - - -nbostream & -operator<<(nbostream &out, const WordDocElementWordPosFeatures &features) -{ - out << features._wordPos; - return out; -} - - -nbostream & -operator>>(nbostream &in, WordDocElementWordPosFeatures &features) -{ - in >> features._wordPos; - return in; -} - - -nbostream & -operator<<(nbostream &out, const DocIdAndFeatures &features) -{ - out << features._docId; - out.saveVector(features._elements). - saveVector(features._wordPositions); - out.saveVector(features._blob); - out << features._bitOffset << features._bitLength << features._raw; - return out; -} - - -nbostream & -operator>>(nbostream &in, DocIdAndFeatures &features) -{ - in >> features._docId; - in.restoreVector(features._elements). - restoreVector(features._wordPositions); - in.restoreVector(features._blob); - in >> features._bitOffset >> features._bitLength >> features._raw; - return in; -} - -} - -#include <vespa/vespalib/objects/nbostream.hpp> - -namespace vespalib { - using search::index::WordDocElementFeatures; - using search::index::WordDocElementWordPosFeatures; - template nbostream& nbostream::saveVector<WordDocElementFeatures>(const std::vector<WordDocElementFeatures> &); - template nbostream& nbostream::restoreVector<WordDocElementFeatures>(std::vector<WordDocElementFeatures> &); - template nbostream& nbostream::saveVector<WordDocElementWordPosFeatures>(const std::vector<WordDocElementWordPosFeatures> &); - template nbostream& nbostream::restoreVector<WordDocElementWordPosFeatures>(std::vector<WordDocElementWordPosFeatures> &); } diff --git a/searchlib/src/vespa/searchlib/index/docidandfeatures.h b/searchlib/src/vespa/searchlib/index/docidandfeatures.h index 5b8ded5f1e0..91a500495cc 100644 --- a/searchlib/src/vespa/searchlib/index/docidandfeatures.h +++ b/searchlib/src/vespa/searchlib/index/docidandfeatures.h @@ -5,8 +5,6 @@ #include <vector> #include <cstdint> -namespace vespalib { class nbostream; } - namespace search::index { /* @@ -195,24 +193,4 @@ public: void append(const DocIdAndFeatures &rhs, uint32_t localFieldId); }; - -vespalib::nbostream & -operator<<(vespalib::nbostream &out, const WordDocElementFeatures &features); - -vespalib::nbostream & -operator>>(vespalib::nbostream &in, WordDocElementFeatures &features); - -vespalib::nbostream & -operator<<(vespalib::nbostream &out, const WordDocElementWordPosFeatures &features); - -vespalib::nbostream & -operator>>(vespalib::nbostream &in, WordDocElementWordPosFeatures &features); - -vespalib::nbostream & -operator<<(vespalib::nbostream &out, const DocIdAndFeatures &features); - -vespalib::nbostream & -operator>>(vespalib::nbostream &in, DocIdAndFeatures &features); - } - diff --git a/searchlib/src/vespa/searchlib/index/postinglistcounts.cpp b/searchlib/src/vespa/searchlib/index/postinglistcounts.cpp index d7bfcca03cc..23b0bf6b6a3 100644 --- a/searchlib/src/vespa/searchlib/index/postinglistcounts.cpp +++ b/searchlib/src/vespa/searchlib/index/postinglistcounts.cpp @@ -1,6 +1,5 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/objects/nbostream.h> #include "postinglistcounts.h" namespace search::index { @@ -10,71 +9,4 @@ void swap(PostingListCounts & a, PostingListCounts & b) a.swap(b); } -using vespalib::nbostream; - -nbostream & -operator<<(nbostream &out, const PostingListCounts::Segment &segment) -{ - out << segment._bitLength << segment._numDocs << segment._lastDoc; - return out; -} - - -nbostream & -operator>>(nbostream &in, PostingListCounts::Segment &segment) -{ - in >> segment._bitLength >> segment._numDocs >> segment._lastDoc; - return in; -} - - -nbostream & -operator<<(nbostream &out, const PostingListCounts &counts) -{ - out << counts._numDocs << counts._bitLength; - size_t numSegments = counts._segments.size(); - out << numSegments; - for (size_t seg = 0; seg < numSegments; ++seg) { - out << counts._segments[seg]; - } - return out; -} - - -nbostream & -operator>>(nbostream &in, PostingListCounts &counts) -{ - in >> counts._numDocs >> counts._bitLength; - size_t numSegments = 0; - in >> numSegments; - counts._segments.reserve(numSegments); - counts._segments.clear(); - for (size_t seg = 0; seg < numSegments; ++seg) { - PostingListCounts::Segment segment; - in >> segment; - counts._segments.push_back(segment); - } - return in; -} - - -nbostream & -operator<<(nbostream &out, const PostingListOffsetAndCounts &offsetAndCounts) -{ - out << offsetAndCounts._offset; - out << offsetAndCounts._accNumDocs; - out << offsetAndCounts._counts; - return out; -} - - -nbostream & -operator>>(nbostream &in, PostingListOffsetAndCounts &offsetAndCounts) -{ - in >> offsetAndCounts._offset; - in >> offsetAndCounts._accNumDocs; - in >> offsetAndCounts._counts; - return in; -} - } diff --git a/searchlib/src/vespa/searchlib/index/postinglistcounts.h b/searchlib/src/vespa/searchlib/index/postinglistcounts.h index f59b906e982..d11f7286fa1 100644 --- a/searchlib/src/vespa/searchlib/index/postinglistcounts.h +++ b/searchlib/src/vespa/searchlib/index/postinglistcounts.h @@ -4,8 +4,6 @@ #include <vector> #include <cstdint> -namespace vespalib { class nbostream; } - namespace search { namespace index { @@ -47,12 +45,6 @@ public: _numDocs == rhs._numDocs && _lastDoc == rhs._lastDoc); } - - friend vespalib::nbostream & - operator<<(vespalib::nbostream &out, const Segment &segment); - - friend vespalib::nbostream & - operator>>(vespalib::nbostream &in, Segment &segment); }; /** @@ -92,12 +84,6 @@ public: _bitLength == rhs._bitLength && _segments == rhs._segments); } - - friend vespalib::nbostream & - operator<<(vespalib::nbostream &out, const PostingListCounts &counts); - - friend vespalib::nbostream & - operator>>(vespalib::nbostream &in, PostingListCounts &counts); }; void swap(PostingListCounts & a, PostingListCounts & b); @@ -115,12 +101,6 @@ public: _accNumDocs(0u), _counts() { } - - friend vespalib::nbostream & - operator<<(vespalib::nbostream &out, const PostingListOffsetAndCounts &offsetAndCounts); - - friend vespalib::nbostream & - operator>>(vespalib::nbostream &in, PostingListOffsetAndCounts &offsetAndCounts); }; } // namespace index |