diff options
author | Alex Saveliev <alexsav@google.com> | 2023-02-07 20:02:36 -0800 |
---|---|---|
committer | Alex Saveliev <alexsav@google.com> | 2023-02-07 20:25:19 -0800 |
commit | 5a41ca990be33387b0d5d15836a465bbe5ff5a28 (patch) | |
tree | 10e0e3d043aa1ba8effa3964ccf3287d83961cb0 /icing/query/query-processor_test.cc | |
parent | cccafab8dfcae94d7072eb49ea971e3c688bdfc4 (diff) | |
download | icing-5a41ca990be33387b0d5d15836a465bbe5ff5a28.tar.gz |
Update icing from upstream
======================================================================
Adds a proto change for the delete propagation option
======================================================================
[ez] Change version to magic for PersistentHashMap
======================================================================
[iOS][testing][nitro] Disabling ICU language segmenter_test.
======================================================================
1. Add support for segmentation in the QueryVisitor.
======================================================================
Support the new double list type in ScoreExpression
======================================================================
Pass JoinChildrenFetcher from IcingSearchEngine all the way down to ScoringVisitor
======================================================================
Refactor the logic of Icing Joins so that nested search and scoring will be performed before the parent
======================================================================
Add lite-index thread-safety tests.
======================================================================
Split IcingSearchEngineTest into separate tests to cover specific apis:
======================================================================
Fix index tests TearDown method.
======================================================================
Improve query concurrency by providing a finer-grained lock around the LiteIndex.
======================================================================
Fix Icing normalization bug
======================================================================
[ez] Fix integer overflow error for IntegerIndexStorage
======================================================================
[NumericSearch][Storage][11/x] Implement Reset and destructor for IntegerIndex
======================================================================
[NumericSearch][Storage][10/x] Add class IntegerIndex
======================================================================
Refactor NumericIndex based on PersistentStorage
======================================================================
Refactor IntegerIndexStorage based on PersistentStorage
======================================================================
Add "working_path" into PersistentStorage
======================================================================
Refactor PersistentHashMap based on PersistentStorage
======================================================================
Create virtual class PersistentStorage for refactoring
======================================================================
Avoids returning reference to local temporary object.
======================================================================
LSC: Clean up references to the legacy protobuf compat library
======================================================================
Fix time complexity regression for snippet retriever
Bug: 256022027
Bug: 193919210
Bug: 266132035
Bug: 208654892
Bug: 261474063
Bug: 266103594
Bug: 146008613
Bug: 253182853
Bug: 266204868
Bug: 249829533
Bug: 266665956
Bug: 265258364
Change-Id: Ib2398c5097b6a2a57900e2ad4e3737502aa13820
Diffstat (limited to 'icing/query/query-processor_test.cc')
-rw-r--r-- | icing/query/query-processor_test.cc | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/icing/query/query-processor_test.cc b/icing/query/query-processor_test.cc index b807b14..7842a9a 100644 --- a/icing/query/query-processor_test.cc +++ b/icing/query/query-processor_test.cc @@ -70,7 +70,8 @@ class QueryProcessorTest : test_dir_(GetTestTempDir() + "/icing"), store_dir_(test_dir_ + "/store"), schema_store_dir_(test_dir_ + "/schema_store"), - index_dir_(test_dir_ + "/index") {} + index_dir_(test_dir_ + "/index"), + numeric_index_dir_(test_dir_ + "/numeric_index") {} void SetUp() override { filesystem_.DeleteDirectoryRecursively(test_dir_.c_str()); @@ -104,7 +105,9 @@ class QueryProcessorTest ICING_ASSERT_OK_AND_ASSIGN( index_, Index::Create(options, &filesystem_, &icing_filesystem_)); // TODO(b/249829533): switch to use persistent numeric index. - numeric_index_ = std::make_unique<DummyNumericIndex<int64_t>>(); + ICING_ASSERT_OK_AND_ASSIGN( + numeric_index_, + DummyNumericIndex<int64_t>::Create(filesystem_, numeric_index_dir_)); language_segmenter_factory::SegmenterOptions segmenter_options( ULOC_US, jni_cache_.get()); @@ -154,6 +157,7 @@ class QueryProcessorTest private: IcingFilesystem icing_filesystem_; const std::string index_dir_; + const std::string numeric_index_dir_; protected: std::unique_ptr<Index> index_; @@ -223,17 +227,25 @@ TEST_P(QueryProcessorTest, EmptyGroupMatchAllDocuments) { SearchSpecProto search_spec; search_spec.set_query("()"); search_spec.set_search_type(GetParam()); + if (GetParam() != + SearchSpecProto::SearchType::EXPERIMENTAL_ICING_ADVANCED_QUERY) { + ICING_ASSERT_OK_AND_ASSIGN( + QueryResults results, + query_processor_->ParseSearch(search_spec, + ScoringSpecProto::RankingStrategy::NONE)); - ICING_ASSERT_OK_AND_ASSIGN( - QueryResults results, - query_processor_->ParseSearch(search_spec, - ScoringSpecProto::RankingStrategy::NONE)); - - // Descending order of valid DocumentIds - EXPECT_THAT(GetDocumentIds(results.root_iterator.get()), - ElementsAre(document_id2, document_id1)); - EXPECT_THAT(results.query_terms, IsEmpty()); - EXPECT_THAT(results.query_term_iterators, IsEmpty()); + // Descending order of valid DocumentIds + EXPECT_THAT(GetDocumentIds(results.root_iterator.get()), + ElementsAre(document_id2, document_id1)); + EXPECT_THAT(results.query_terms, IsEmpty()); + EXPECT_THAT(results.query_term_iterators, IsEmpty()); + } else { + // TODO(b/208654892): Resolve the difference between RAW_QUERY and ADVANCED + // regarding empty composite expressions. + EXPECT_THAT(query_processor_->ParseSearch( + search_spec, ScoringSpecProto::RankingStrategy::NONE), + StatusIs(libtextclassifier3::StatusCode::INVALID_ARGUMENT)); + } } TEST_P(QueryProcessorTest, EmptyQueryMatchAllDocuments) { |