summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-05-02 12:35:53 +0000
committerGeir Storli <geirst@verizonmedia.com>2019-05-02 12:35:53 +0000
commit040450c5f83b98d221f4463fa36b70ee9e55f649 (patch)
treefeb8675e71969b39178e767aeb6c150ac5522fe6 /searchcommon
parentcc987cc9321f64a058ed9a2519495bb701ff527a (diff)
Remove unused settings (prefix, phrases, positions) from index field in schema.
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/tests/schema/schema_test.cpp11
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schema.cpp21
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schema.h22
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp3
4 files changed, 7 insertions, 50 deletions
diff --git a/searchcommon/src/tests/schema/schema_test.cpp b/searchcommon/src/tests/schema/schema_test.cpp
index e9997c2e70d..790e5703109 100644
--- a/searchcommon/src/tests/schema/schema_test.cpp
+++ b/searchcommon/src/tests/schema/schema_test.cpp
@@ -26,9 +26,7 @@ void assertIndexField(const Schema::IndexField & exp,
const Schema::IndexField & act)
{
assertField(exp, act);
- EXPECT_EQUAL(exp.hasPrefix(), act.hasPrefix());
- EXPECT_EQUAL(exp.hasPhrases(), act.hasPhrases());
- EXPECT_EQUAL(exp.hasPositions(), act.hasPositions());
+ EXPECT_EQUAL(exp.getAvgElemLen(), act.getAvgElemLen());
}
void assertSet(const Schema::FieldSet &exp,
@@ -94,9 +92,6 @@ TEST("testBasic") {
EXPECT_EQUAL("foo", s.getIndexField(0).getName());
EXPECT_EQUAL(DataType::STRING, s.getIndexField(0).getDataType());
EXPECT_EQUAL(CollectionType::SINGLE, s.getIndexField(0).getCollectionType());
- EXPECT_TRUE(!s.getIndexField(0).hasPrefix());
- EXPECT_TRUE(!s.getIndexField(0).hasPhrases());
- EXPECT_TRUE(s.getIndexField(0).hasPositions());
EXPECT_EQUAL("bar", s.getIndexField(1).getName());
EXPECT_EQUAL(DataType::INT32, s.getIndexField(1).getDataType());
@@ -178,9 +173,7 @@ TEST("testLoadAndSave") {
EXPECT_EQUAL(3u, s.getNumIndexFields());
assertIndexField(SIF("a", SDT::STRING), s.getIndexField(0));
assertIndexField(SIF("b", SDT::INT64), s.getIndexField(1));
- assertIndexField(SIF("c", SDT::STRING).setPrefix(true)
- .setPhrases(false).setPositions(false),
- s.getIndexField(2));
+ assertIndexField(SIF("c", SDT::STRING), s.getIndexField(2));
EXPECT_EQUAL(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 cef74409024..4cd95423155 100644
--- a/searchcommon/src/vespa/searchcommon/common/schema.cpp
+++ b/searchcommon/src/vespa/searchcommon/common/schema.cpp
@@ -131,9 +131,6 @@ Schema::Field::operator!=(const Field &rhs) const
Schema::IndexField::IndexField(vespalib::stringref name, DataType dt)
: Field(name, dt),
- _prefix(false),
- _phrases(false),
- _positions(true),
_avgElemLen(512)
{
}
@@ -141,18 +138,12 @@ Schema::IndexField::IndexField(vespalib::stringref name, DataType dt)
Schema::IndexField::IndexField(vespalib::stringref name, DataType dt,
CollectionType ct)
: Field(name, dt, ct),
- _prefix(false),
- _phrases(false),
- _positions(true),
_avgElemLen(512)
{
}
Schema::IndexField::IndexField(const std::vector<vespalib::string> &lines)
: Field(lines),
- _prefix(ConfigParser::parse<bool>("prefix", lines)),
- _phrases(ConfigParser::parse<bool>("phrases", lines)),
- _positions(ConfigParser::parse<bool>("positions", lines)),
_avgElemLen(ConfigParser::parse<int32_t>("averageelementlen", lines))
{
}
@@ -161,9 +152,6 @@ void
Schema::IndexField::write(vespalib::asciistream & os, vespalib::stringref prefix) const
{
Field::write(os, prefix);
- os << prefix << "prefix " << (_prefix ? "true" : "false") << "\n";
- os << prefix << "phrases " << (_phrases ? "true" : "false") << "\n";
- os << prefix << "positions " << (_positions ? "true" : "false") << "\n";
os << prefix << "averageelementlen " << static_cast<int32_t>(_avgElemLen) << "\n";
}
@@ -171,9 +159,6 @@ bool
Schema::IndexField::operator==(const IndexField &rhs) const
{
return Field::operator==(rhs) &&
- _prefix == rhs._prefix &&
- _phrases == rhs._phrases &&
- _positions == rhs._positions &&
_avgElemLen == rhs._avgElemLen;
}
@@ -181,9 +166,6 @@ bool
Schema::IndexField::operator!=(const IndexField &rhs) const
{
return Field::operator!=(rhs) ||
- _prefix != rhs._prefix ||
- _phrases != rhs._phrases ||
- _positions != rhs._positions ||
_avgElemLen != rhs._avgElemLen;
}
@@ -337,9 +319,6 @@ cloneIndexField(const Schema::IndexField &field,
return Schema::IndexField(field.getName() + suffix,
field.getDataType(),
field.getCollectionType()).
- setPrefix(field.hasPrefix()).
- setPhrases(field.hasPhrases()).
- setPositions(field.hasPositions()).
setAvgElemLen(field.getAvgElemLen());
}
diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h
index 90cf099f2d8..10ab8f47856 100644
--- a/searchcommon/src/vespa/searchcommon/common/schema.h
+++ b/searchcommon/src/vespa/searchcommon/common/schema.h
@@ -74,11 +74,8 @@ public:
* A representation of an index field with extra information on
* how the index should be generated.
**/
- class IndexField : public Field
- {
- bool _prefix;
- bool _phrases;
- bool _positions;
+ class IndexField : public Field {
+ private:
uint32_t _avgElemLen;
public:
@@ -89,20 +86,11 @@ public:
**/
IndexField(const std::vector<vespalib::string> &lines);
- IndexField &setPrefix(bool value) { _prefix = value; return *this; }
- IndexField &setPhrases(bool value) { _phrases = value; return *this; }
- IndexField &setPositions(bool value)
- { _positions = value; return *this; }
- IndexField &setAvgElemLen(uint32_t avgElemLen)
- { _avgElemLen = avgElemLen; return *this; }
+ IndexField &setAvgElemLen(uint32_t avgElemLen) { _avgElemLen = avgElemLen; return *this; }
- void
- write(vespalib::asciistream &os,
- vespalib::stringref prefix) const override;
+ void write(vespalib::asciistream &os,
+ vespalib::stringref prefix) const override;
- bool hasPrefix() const { return _prefix; }
- bool hasPhrases() const { return _phrases; }
- bool hasPositions() const { return _positions; }
uint32_t getAvgElemLen() const { return _avgElemLen; }
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 d56f3c747c1..a357cc3538f 100644
--- a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp
+++ b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp
@@ -144,9 +144,6 @@ 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)).
- setPrefix(f.prefix).
- setPhrases(f.phrases).
- setPositions(f.positions).
setAvgElemLen(f.averageelementlen));
}
for (size_t i = 0; i < cfg.fieldset.size(); ++i) {