1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-15 10:48:33 +01:00

Switch from OR to AND in split queries.

Fixes issue #116
This commit is contained in:
John Maguire 2010-03-25 15:59:58 +00:00
parent 645b819b68
commit 2e71390acd
2 changed files with 5 additions and 5 deletions

View File

@ -111,11 +111,11 @@ bool LibraryBackend::Like(const char* needle, const char* haystack) {
}
QString b = QString::fromUtf8(haystack);
foreach (const QString& query, query_cache_) {
if (b.contains(query, Qt::CaseInsensitive)) {
return true;
if (!b.contains(query, Qt::CaseInsensitive)) {
return false;
}
}
return false;
return true;
}
// Custom LIKE(X, Y) function for sqlite3 that supports case insensitive unicode matching.

View File

@ -224,8 +224,8 @@ TEST_F(LibraryBackendTest, LikeCacheInvalidated) {
TEST_F(LibraryBackendTest, LikeQuerySplit) {
EXPECT_TRUE(backend_->Like("%foo bar%", "foobar"));
EXPECT_TRUE(backend_->Like("%foo bar%", "barbaz"));
EXPECT_TRUE(backend_->Like("%foo bar%", "foobaz"));
EXPECT_FALSE(backend_->Like("%foo bar%", "barbaz"));
EXPECT_FALSE(backend_->Like("%foo bar%", "foobaz"));
EXPECT_FALSE(backend_->Like("%foo bar%", "baz"));
}