[DB] Added search filter helpers
This commit is contained in:
@@ -47,6 +47,7 @@ class SearchFilter
|
|||||||
|
|
||||||
SearchFilter() {}
|
SearchFilter() {}
|
||||||
|
|
||||||
|
// Helpers
|
||||||
static SearchFilter IdMatch( const IdMatchType& _idMatch )
|
static SearchFilter IdMatch( const IdMatchType& _idMatch )
|
||||||
{
|
{
|
||||||
return SearchFilter(_idMatch);
|
return SearchFilter(_idMatch);
|
||||||
@@ -57,6 +58,12 @@ class SearchFilter
|
|||||||
return SearchFilter(_nameLikeMatch);
|
return SearchFilter(_nameLikeMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Single ID match
|
||||||
|
static SearchFilter ById(Field field, Wt::Dbo::dbo_default_traits::IdType id)
|
||||||
|
{
|
||||||
|
return SearchFilter({{field, {id} }});
|
||||||
|
}
|
||||||
|
|
||||||
// The filter is a AND of the following conditions:
|
// The filter is a AND of the following conditions:
|
||||||
|
|
||||||
// ((Field1.name LIKE STR1-1 OR Field1.name LIKE STR1-2 ...) OR (Field2.name LIKE STR2-1 OR Field2.name LIKE STR2-2 ...) ...
|
// ((Field1.name LIKE STR1-1 OR Field1.name LIKE STR1-2 ...) OR (Field2.name LIKE STR2-1 OR Field2.name LIKE STR2-2 ...) ...
|
||||||
|
|||||||
@@ -127,8 +127,7 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
|||||||
trackSearch->hide();
|
trackSearch->hide();
|
||||||
releaseSearch->show();
|
releaseSearch->show();
|
||||||
|
|
||||||
releaseSearch->search(SearchFilter::IdMatch({{SearchFilter::Field::Artist, {artistId}}}),
|
releaseSearch->search(SearchFilter::ById(SearchFilter::Field::Artist, artistId), 20);
|
||||||
20);
|
|
||||||
}, std::placeholders::_1));
|
}, std::placeholders::_1));
|
||||||
|
|
||||||
releaseSearch->moreReleasesSelected().connect(std::bind([=]
|
releaseSearch->moreReleasesSelected().connect(std::bind([=]
|
||||||
@@ -144,8 +143,7 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
|||||||
releaseSearch->hide();
|
releaseSearch->hide();
|
||||||
trackSearch->show();
|
trackSearch->show();
|
||||||
|
|
||||||
trackSearch->search(SearchFilter::IdMatch({{SearchFilter::Field::Release, {releaseId}}}),
|
trackSearch->search(SearchFilter::ById(SearchFilter::Field::Release, releaseId), 20);
|
||||||
20);
|
|
||||||
}, std::placeholders::_1));
|
}, std::placeholders::_1));
|
||||||
|
|
||||||
trackSearch->moreTracksSelected().connect(std::bind([=]
|
trackSearch->moreTracksSelected().connect(std::bind([=]
|
||||||
|
|||||||
Reference in New Issue
Block a user