summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2019-11-20 20:49:57 +0000
committerArne Juul <arnej@verizonmedia.com>2019-11-21 08:36:34 +0000
commit0a0e5a3874414481f695daeb83d8ad94769c0b8d (patch)
tree8f2762586a7ee9bd819ce066162e3fa41a1fbf3b /searchlib
parente83e90e93a4b012df3d30fd2cf6eab0f433ac645 (diff)
remove "termindex" which is always -1
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/query/querybuilder_test.cpp24
-rw-r--r--searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/fef/itermdata.h7
-rw-r--r--searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/fef/simpletermdata.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/fef/simpletermdata.h7
-rw-r--r--searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h7
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h5
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/queryreplicator.h3
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h1
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/term.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/term.h3
13 files changed, 8 insertions, 70 deletions
diff --git a/searchlib/src/tests/query/querybuilder_test.cpp b/searchlib/src/tests/query/querybuilder_test.cpp
index d47fb071d81..7f496b3493c 100644
--- a/searchlib/src/tests/query/querybuilder_test.cpp
+++ b/searchlib/src/tests/query/querybuilder_test.cpp
@@ -463,30 +463,6 @@ TEST("require that Invalid Trees Cannot Be Built") {
builder.error());
}
-TEST("require that Term Index Can Be Added") {
- const int term_index0 = 14;
- const int term_index1 = 65;
-
- QueryBuilder<SimpleQueryNodeTypes> builder;
- builder.addAnd(2);
- builder.addStringTerm(str[0], view[0], id[0], weight[0])
- .setTermIndex(term_index0);
- builder.addSubstringTerm(str[1], view[1], id[1], weight[1])
- .setTermIndex(term_index1);
-
- Node::UP node = builder.build();
- ASSERT_TRUE(!builder.hasError());
- Intermediate *intermediate = dynamic_cast<Intermediate *>(node.get());
- ASSERT_TRUE(intermediate);
- ASSERT_TRUE(intermediate->getChildren().size() == 2);
- Term *term = dynamic_cast<Term *>(intermediate->getChildren()[0]);
- ASSERT_TRUE(term);
- EXPECT_EQUAL(term_index0, term->getTermIndex());
- term = dynamic_cast<Term *>(intermediate->getChildren()[1]);
- ASSERT_TRUE(term);
- EXPECT_EQUAL(term_index1, term->getTermIndex());
-}
-
TEST("require that Rank Can Be Turned Off") {
QueryBuilder<SimpleQueryNodeTypes> builder;
builder.addAnd(3);
diff --git a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp
index 45d9ddb3763..a9f31265f49 100644
--- a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp
@@ -86,10 +86,9 @@ struct VectorizedQueryTerms {
struct Term {
fef::TermFieldHandle handle;
int weight;
- int index;
- Term(fef::TermFieldHandle handle_in, int weight_in, int index_in)
- : handle(handle_in), weight(weight_in), index(index_in)
+ Term(fef::TermFieldHandle handle_in, int weight_in)
+ : handle(handle_in), weight(weight_in)
{}
};
@@ -117,12 +116,11 @@ struct VectorizedQueryTerms {
if (tfd.getFieldId() == field_id) {
int term_weight = termData->getWeight().percent();
total_weight += term_weight;
- terms.push_back(Term(tfd.getHandle(), term_weight, termData->getTermIndex()));
+ terms.push_back(Term(tfd.getHandle(), term_weight));
}
}
}
}
- std::sort(terms.begin(), terms.end(), [](const Term &a, const Term &b) { return (a.index < b.index); });
handles.reserve(terms.size());
weights.reserve(terms.size());
for (size_t i = 0; i < terms.size(); ++i) {
diff --git a/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp
index c445241fe59..3cdb20a16e5 100644
--- a/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp
@@ -13,9 +13,8 @@ namespace {
struct Term {
fef::TermFieldHandle handle;
int weight;
- int index;
- Term(fef::TermFieldHandle handle_in, int weight_in, int index_in)
- : handle(handle_in), weight(weight_in), index(index_in) {}
+ Term(fef::TermFieldHandle handle_in, int weight_in)
+ : handle(handle_in), weight(weight_in) {}
};
struct State {
@@ -92,13 +91,11 @@ TextSimilarityExecutor::TextSimilarityExecutor(const fef::IQueryEnvironment &env
if (tfd.getFieldId() == field_id) {
int term_weight = termData->getWeight().percent();
_total_term_weight += term_weight;
- terms.push_back(Term(tfd.getHandle(), term_weight,
- termData->getTermIndex()));
+ terms.push_back(Term(tfd.getHandle(), term_weight));
}
}
}
}
- std::sort(terms.begin(), terms.end(), [](const Term &a, const Term &b){ return (a.index < b.index); });
_handles.reserve(terms.size());
_weights.reserve(terms.size());
for (size_t i = 0; i < terms.size(); ++i) {
diff --git a/searchlib/src/vespa/searchlib/fef/itermdata.h b/searchlib/src/vespa/searchlib/fef/itermdata.h
index 95095dfaff0..8b366915602 100644
--- a/searchlib/src/vespa/searchlib/fef/itermdata.h
+++ b/searchlib/src/vespa/searchlib/fef/itermdata.h
@@ -28,13 +28,6 @@ public:
virtual uint32_t getPhraseLength() const = 0;
/**
- * Obtain the location of this term in the original user query.
- *
- * @return term index
- **/
- virtual uint32_t getTermIndex() const = 0;
-
- /**
* Obtain the unique id of this term. 0 means not set.
*
* @return unique id or 0
diff --git a/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp b/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp
index c08934f206a..77a271ba76c 100644
--- a/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp
+++ b/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp
@@ -18,7 +18,6 @@ PhraseSplitter::considerTerm(uint32_t termIdx, const ITermData &term, std::vecto
SimpleTermData prototype;
prototype.setWeight(term.getWeight());
prototype.setPhraseLength(1);
- prototype.setTermIndex(term.getTermIndex());
prototype.setUniqueId(term.getUniqueId());
prototype.addField(fieldId);
phraseTerms.push_back(PhraseTerm(term, _terms.size(), h));
diff --git a/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp b/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp
index ab8f0c62c45..09dce307a5f 100644
--- a/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp
+++ b/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp
@@ -17,7 +17,6 @@ SimpleTermData::SimpleTermData()
SimpleTermData::SimpleTermData(const ITermData &rhs)
: _weight(rhs.getWeight()),
_numTerms(rhs.getPhraseLength()),
- _termIndex(rhs.getTermIndex()),
_uniqueId(rhs.getUniqueId()),
_fields()
{
diff --git a/searchlib/src/vespa/searchlib/fef/simpletermdata.h b/searchlib/src/vespa/searchlib/fef/simpletermdata.h
index ef2d91d6e68..3d04b964748 100644
--- a/searchlib/src/vespa/searchlib/fef/simpletermdata.h
+++ b/searchlib/src/vespa/searchlib/fef/simpletermdata.h
@@ -49,13 +49,6 @@ public:
uint32_t getPhraseLength() const override { return _numTerms; }
/**
- * Obtain the location of this term in the original user query.
- *
- * @return term index
- **/
- uint32_t getTermIndex() const override { return _termIndex; }
-
- /**
* Obtain the unique id of this term. 0 means not set.
*
* @return unique id or 0
diff --git a/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h b/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h
index 88644f673a5..6eb3fb7777d 100644
--- a/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h
+++ b/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h
@@ -110,13 +110,6 @@ public:
uint32_t getUniqueId() const { return _currUniqueId; }
/**
- * Get the term index of the current item.
- *
- * @return term index of current item
- **/
- uint32_t getTermIndex() const { return -1; }
-
- /**
* Get the flags of the current item.
*
* @return flags of current item
diff --git a/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h b/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h
index 3bca4f041b3..0ff0b212dfd 100644
--- a/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h
+++ b/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h
@@ -47,18 +47,15 @@ class Equiv : public QueryNodeMixin<Equiv, Intermediate> {
private:
int32_t _id;
Weight _weight;
- int32_t _term_index;
public:
virtual ~Equiv() = 0;
Equiv(int32_t id, Weight weight)
- : _id(id), _weight(weight), _term_index(-1)
+ : _id(id), _weight(weight)
{}
- void setTermIndex(int32_t term_index) { _term_index = term_index; }
Weight getWeight() const { return _weight; }
int32_t getId() const { return _id; }
- int32_t getTermIndex() const { return _term_index; }
};
//-----------------------------------------------------------------------------
diff --git a/searchlib/src/vespa/searchlib/query/tree/queryreplicator.h b/searchlib/src/vespa/searchlib/query/tree/queryreplicator.h
index d2249a53f18..0bf923960b9 100644
--- a/searchlib/src/vespa/searchlib/query/tree/queryreplicator.h
+++ b/searchlib/src/vespa/searchlib/query/tree/queryreplicator.h
@@ -48,8 +48,7 @@ private:
}
void visit(Equiv &node) override {
- _builder.addEquiv(node.getChildren().size(), node.getId(), node.getWeight())
- .setTermIndex(node.getTermIndex());
+ _builder.addEquiv(node.getChildren().size(), node.getId(), node.getWeight());
visitNodes(node.getChildren());
}
diff --git a/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h b/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h
index a5f25d81400..791da010720 100644
--- a/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h
+++ b/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h
@@ -28,7 +28,6 @@ public:
while (!builder.hasError() && queryStack.next()) {
Term *t = createQueryTerm(queryStack, builder, pureTermView);
if (!builder.hasError() && t) {
- t->setTermIndex(queryStack.getTermIndex());
if (queryStack.getFlags() & ParseItem::IFLAG_NORANK) {
t->setRanked(false);
}
diff --git a/searchlib/src/vespa/searchlib/query/tree/term.cpp b/searchlib/src/vespa/searchlib/query/tree/term.cpp
index 40044cc5dbe..1a0ea9392d0 100644
--- a/searchlib/src/vespa/searchlib/query/tree/term.cpp
+++ b/searchlib/src/vespa/searchlib/query/tree/term.cpp
@@ -11,13 +11,11 @@ Term::Term(vespalib::stringref view, int32_t id, Weight weight) :
_view(view),
_id(id),
_weight(weight),
- _term_index(-1),
_ranked(true),
_position_data(true)
{ }
void Term::setStateFrom(const Term& other) {
- setTermIndex(other.getTermIndex());
setRanked(other.isRanked());
setPositionData(other.usePositionData());
// too late to copy this state:
diff --git a/searchlib/src/vespa/searchlib/query/tree/term.h b/searchlib/src/vespa/searchlib/query/tree/term.h
index 4fb0f44dd59..5b3559683cd 100644
--- a/searchlib/src/vespa/searchlib/query/tree/term.h
+++ b/searchlib/src/vespa/searchlib/query/tree/term.h
@@ -16,14 +16,12 @@ class Term
vespalib::string _view;
int32_t _id;
Weight _weight;
- int32_t _term_index;
bool _ranked;
bool _position_data;
public:
virtual ~Term() = 0;
- void setTermIndex(int32_t term_index) { _term_index = term_index; }
void setView(const vespalib::string & view) { _view = view; }
void setRanked(bool ranked) { _ranked = ranked; }
void setPositionData(bool position_data) { _position_data = position_data; }
@@ -33,7 +31,6 @@ public:
const vespalib::string & getView() const { return _view; }
Weight getWeight() const { return _weight; }
int32_t getId() const { return _id; }
- int32_t getTermIndex() const { return _term_index; }
bool isRanked() const { return _ranked; }
bool usePositionData() const { return _position_data; }