summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-05-02 13:20:16 +0000
committerGeir Storli <geirst@verizonmedia.com>2019-05-02 13:20:16 +0000
commitc1bfad36330765d713188280c402de0c284ded9b (patch)
treeff65c2750f7db6ad0cf548f298a69bea040fef71 /searchcommon
parentc1ea7086047619f75528b972c1c57eb463446ecd (diff)
Propagate flag to trigger use of experimental posting list format for an index field.
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/tests/schema/load-save-cfg/indexschema.cfg4
-rw-r--r--searchcommon/src/tests/schema/schema_test.cpp3
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schema.cpp16
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schema.h7
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp3
5 files changed, 23 insertions, 10 deletions
diff --git a/searchcommon/src/tests/schema/load-save-cfg/indexschema.cfg b/searchcommon/src/tests/schema/load-save-cfg/indexschema.cfg
index c0998bcf597..b6c547c52c9 100644
--- a/searchcommon/src/tests/schema/load-save-cfg/indexschema.cfg
+++ b/searchcommon/src/tests/schema/load-save-cfg/indexschema.cfg
@@ -5,9 +5,7 @@ indexfield[1].name b
indexfield[1].datatype INT64
indexfield[2].name c
indexfield[2].datatype STRING
-indexfield[2].prefix true
-indexfield[2].phrases false
-indexfield[2].positions false
+indexfield[2].experimentalpostinglistformat true
fieldset[1]
fieldset[0].name default
fieldset[0].field[2]
diff --git a/searchcommon/src/tests/schema/schema_test.cpp b/searchcommon/src/tests/schema/schema_test.cpp
index 4ebbd574fc3..780ea7a6640 100644
--- a/searchcommon/src/tests/schema/schema_test.cpp
+++ b/searchcommon/src/tests/schema/schema_test.cpp
@@ -31,6 +31,7 @@ assertIndexField(const Schema::IndexField& exp,
{
assertField(exp, act);
EXPECT_EQ(exp.getAvgElemLen(), act.getAvgElemLen());
+ EXPECT_EQ(exp.use_experimental_posting_list_format(), act.use_experimental_posting_list_format());
}
void
@@ -182,7 +183,7 @@ TEST(SchemaTest, test_load_and_save)
EXPECT_EQ(3u, s.getNumIndexFields());
assertIndexField(SIF("a", SDT::STRING), s.getIndexField(0));
assertIndexField(SIF("b", SDT::INT64), s.getIndexField(1));
- assertIndexField(SIF("c", SDT::STRING), s.getIndexField(2));
+ assertIndexField(SIF("c", SDT::STRING).set_experimental_posting_list_format(true), s.getIndexField(2));
EXPECT_EQ(9u, s.getNumAttributeFields());
assertField(SAF("a", SDT::STRING, SCT::SINGLE),
diff --git a/searchcommon/src/vespa/searchcommon/common/schema.cpp b/searchcommon/src/vespa/searchcommon/common/schema.cpp
index 4cd95423155..5e89555acb6 100644
--- a/searchcommon/src/vespa/searchcommon/common/schema.cpp
+++ b/searchcommon/src/vespa/searchcommon/common/schema.cpp
@@ -131,20 +131,23 @@ Schema::Field::operator!=(const Field &rhs) const
Schema::IndexField::IndexField(vespalib::stringref name, DataType dt)
: Field(name, dt),
- _avgElemLen(512)
+ _avgElemLen(512),
+ _experimental_posting_list_format(false)
{
}
Schema::IndexField::IndexField(vespalib::stringref name, DataType dt,
CollectionType ct)
: Field(name, dt, ct),
- _avgElemLen(512)
+ _avgElemLen(512),
+ _experimental_posting_list_format(false)
{
}
Schema::IndexField::IndexField(const std::vector<vespalib::string> &lines)
: Field(lines),
- _avgElemLen(ConfigParser::parse<int32_t>("averageelementlen", lines))
+ _avgElemLen(ConfigParser::parse<int32_t>("averageelementlen", lines)),
+ _experimental_posting_list_format(ConfigParser::parse<bool>("experimentalpostinglistformat", lines))
{
}
@@ -153,20 +156,23 @@ Schema::IndexField::write(vespalib::asciistream & os, vespalib::stringref prefix
{
Field::write(os, prefix);
os << prefix << "averageelementlen " << static_cast<int32_t>(_avgElemLen) << "\n";
+ os << prefix << "experimentalpostinglistformat " << (_experimental_posting_list_format ? "true" : "false") << "\n";
}
bool
Schema::IndexField::operator==(const IndexField &rhs) const
{
return Field::operator==(rhs) &&
- _avgElemLen == rhs._avgElemLen;
+ _avgElemLen == rhs._avgElemLen &&
+ _experimental_posting_list_format == rhs._experimental_posting_list_format;
}
bool
Schema::IndexField::operator!=(const IndexField &rhs) const
{
return Field::operator!=(rhs) ||
- _avgElemLen != rhs._avgElemLen;
+ _avgElemLen != rhs._avgElemLen ||
+ _experimental_posting_list_format != rhs._experimental_posting_list_format;
}
Schema::FieldSet::FieldSet(const std::vector<vespalib::string> & lines) :
diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h
index 10ab8f47856..bb2163e5577 100644
--- a/searchcommon/src/vespa/searchcommon/common/schema.h
+++ b/searchcommon/src/vespa/searchcommon/common/schema.h
@@ -77,6 +77,8 @@ public:
class IndexField : public Field {
private:
uint32_t _avgElemLen;
+ // TODO: Remove when experimental posting list format is made default
+ bool _experimental_posting_list_format;
public:
IndexField(vespalib::stringref name, DataType dt);
@@ -87,11 +89,16 @@ public:
IndexField(const std::vector<vespalib::string> &lines);
IndexField &setAvgElemLen(uint32_t avgElemLen) { _avgElemLen = avgElemLen; return *this; }
+ IndexField &set_experimental_posting_list_format(bool value) {
+ _experimental_posting_list_format = value;
+ return *this;
+ }
void write(vespalib::asciistream &os,
vespalib::stringref prefix) const override;
uint32_t getAvgElemLen() const { return _avgElemLen; }
+ bool use_experimental_posting_list_format() const { return _experimental_posting_list_format; }
bool operator==(const IndexField &rhs) const;
bool operator!=(const IndexField &rhs) const;
diff --git a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp
index a357cc3538f..59ed15eefb0 100644
--- a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp
+++ b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp
@@ -144,7 +144,8 @@ SchemaBuilder::build(const IndexschemaConfig &cfg, Schema &schema)
const IndexschemaConfig::Indexfield & f = cfg.indexfield[i];
schema.addIndexField(Schema::IndexField(f.name, convertIndexDataType(f.datatype),
convertIndexCollectionType(f.collectiontype)).
- setAvgElemLen(f.averageelementlen));
+ setAvgElemLen(f.averageelementlen).
+ set_experimental_posting_list_format(f.experimentalpostinglistformat));
}
for (size_t i = 0; i < cfg.fieldset.size(); ++i) {
const IndexschemaConfig::Fieldset &fs = cfg.fieldset[i];