aboutsummaryrefslogtreecommitdiff
path: root/icing/result
diff options
context:
space:
mode:
Diffstat (limited to 'icing/result')
-rw-r--r--icing/result/result-retriever_test.cc6
-rw-r--r--icing/result/snippet-retriever.cc39
-rw-r--r--icing/result/snippet-retriever_test.cc2
3 files changed, 23 insertions, 24 deletions
diff --git a/icing/result/result-retriever_test.cc b/icing/result/result-retriever_test.cc
index 2695433..0d812e4 100644
--- a/icing/result/result-retriever_test.cc
+++ b/icing/result/result-retriever_test.cc
@@ -22,7 +22,6 @@
#include "gtest/gtest.h"
#include "icing/document-builder.h"
#include "icing/file/mock-filesystem.h"
-#include "icing/helpers/icu/icu-data-file-helper.h"
#include "icing/portable/equals-proto.h"
#include "icing/portable/platform.h"
#include "icing/proto/document.pb.h"
@@ -36,6 +35,7 @@
#include "icing/store/document-id.h"
#include "icing/testing/common-matchers.h"
#include "icing/testing/fake-clock.h"
+#include "icing/testing/icu-data-file-helper.h"
#include "icing/testing/snippet-helpers.h"
#include "icing/testing/test-data.h"
#include "icing/testing/tmp-directory.h"
@@ -362,8 +362,8 @@ TEST_F(ResultRetrieverTest, NotIgnoreErrors) {
TEST_F(ResultRetrieverTest, IOErrorShouldReturnInternalError) {
MockFilesystem mock_filesystem;
- ON_CALL(mock_filesystem, OpenForRead(_)).WillByDefault(Return(false));
-
+ ON_CALL(mock_filesystem, PRead(A<int>(), A<void*>(), A<size_t>(), A<off_t>()))
+ .WillByDefault(Return(false));
ICING_ASSERT_OK_AND_ASSIGN(
DocumentStore::CreateResult create_result,
DocumentStore::Create(&mock_filesystem, test_dir_, &fake_clock_,
diff --git a/icing/result/snippet-retriever.cc b/icing/result/snippet-retriever.cc
index 6af7017..bd1524e 100644
--- a/icing/result/snippet-retriever.cc
+++ b/icing/result/snippet-retriever.cc
@@ -78,26 +78,25 @@ inline std::string AddIndexToPath(int values_size, int index,
// Returns a string of the normalized text of the input Token. Normalization
// is applied based on the Token's type.
-std::string NormalizeToken(const Normalizer& normalizer,
- const Token& token) {
+std::string NormalizeToken(const Normalizer& normalizer, const Token& token) {
switch (token.type) {
- case Token::REGULAR:
+ case Token::Type::REGULAR:
return normalizer.NormalizeTerm(token.text);
- case Token::VERBATIM:
+ case Token::Type::VERBATIM:
return std::string(token.text);
- case Token::QUERY_EXCLUSION:
+ case Token::Type::QUERY_EXCLUSION:
[[fallthrough]];
- case Token::QUERY_LEFT_PARENTHESES:
+ case Token::Type::QUERY_LEFT_PARENTHESES:
[[fallthrough]];
- case Token::QUERY_RIGHT_PARENTHESES:
+ case Token::Type::QUERY_RIGHT_PARENTHESES:
[[fallthrough]];
- case Token::QUERY_OR:
+ case Token::Type::QUERY_OR:
[[fallthrough]];
- case Token::QUERY_PROPERTY:
+ case Token::Type::QUERY_PROPERTY:
[[fallthrough]];
- case Token::INVALID:
+ case Token::Type::INVALID:
ICING_LOG(WARNING) << "Unable to normalize token of type: "
- << token.type;
+ << static_cast<int>(token.type);
return std::string(token.text);
}
}
@@ -107,7 +106,7 @@ std::string NormalizeToken(const Normalizer& normalizer,
CharacterIterator FindMatchEnd(const Normalizer& normalizer, const Token& token,
const std::string& match_query_term) {
switch (token.type) {
- case Token::VERBATIM: {
+ case Token::Type::VERBATIM: {
// VERBATIM tokens are not normalized. This means the non-normalized
// matched query term must be either equal to or a prefix of the token's
// text. Therefore, the match must end at the end of the matched query
@@ -117,22 +116,22 @@ CharacterIterator FindMatchEnd(const Normalizer& normalizer, const Token& token,
verbatim_match_end.AdvanceToUtf8(match_query_term.length());
return verbatim_match_end;
}
- case Token::QUERY_EXCLUSION:
+ case Token::Type::QUERY_EXCLUSION:
[[fallthrough]];
- case Token::QUERY_LEFT_PARENTHESES:
+ case Token::Type::QUERY_LEFT_PARENTHESES:
[[fallthrough]];
- case Token::QUERY_RIGHT_PARENTHESES:
+ case Token::Type::QUERY_RIGHT_PARENTHESES:
[[fallthrough]];
- case Token::QUERY_OR:
+ case Token::Type::QUERY_OR:
[[fallthrough]];
- case Token::QUERY_PROPERTY:
+ case Token::Type::QUERY_PROPERTY:
[[fallthrough]];
- case Token::INVALID:
+ case Token::Type::INVALID:
ICING_LOG(WARNING)
- << "Unexpected Token type " << token.type
+ << "Unexpected Token type " << static_cast<int>(token.type)
<< " found when finding match end of query term and token.";
[[fallthrough]];
- case Token::REGULAR:
+ case Token::Type::REGULAR:
return normalizer.FindNormalizedMatchEndPosition(token.text,
match_query_term);
}
diff --git a/icing/result/snippet-retriever_test.cc b/icing/result/snippet-retriever_test.cc
index 365eba2..0de2295 100644
--- a/icing/result/snippet-retriever_test.cc
+++ b/icing/result/snippet-retriever_test.cc
@@ -22,7 +22,6 @@
#include "gtest/gtest.h"
#include "icing/document-builder.h"
#include "icing/file/mock-filesystem.h"
-#include "icing/helpers/icu/icu-data-file-helper.h"
#include "icing/portable/equals-proto.h"
#include "icing/portable/platform.h"
#include "icing/proto/document.pb.h"
@@ -37,6 +36,7 @@
#include "icing/store/key-mapper.h"
#include "icing/testing/common-matchers.h"
#include "icing/testing/fake-clock.h"
+#include "icing/testing/icu-data-file-helper.h"
#include "icing/testing/jni-test-helpers.h"
#include "icing/testing/snippet-helpers.h"
#include "icing/testing/test-data.h"