limit results at the sql level.
This commit is contained in:
@@ -140,7 +140,7 @@ void RequestInterface::searchClicked()
|
||||
}
|
||||
|
||||
//Do a like search on title, artist, and album on DB
|
||||
Wt::Dbo::collection<Wt::Dbo::ptr<AudioTrack>> trackOptions = sqlSession.find<AudioTrack>(std::string("where tracks.name like \"%")+searchBox->text().toUTF8()+std::string("%\" OR tracks.artist like \"%")+searchBox->text().toUTF8()+std::string("%\" OR tracks.album like \"%")+searchBox->text().toUTF8()+std::string("%\""));
|
||||
Wt::Dbo::collection<Wt::Dbo::ptr<AudioTrack>> trackOptions = sqlSession.find<AudioTrack>(std::string("where tracks.name like \"%")+searchBox->text().toUTF8()+std::string("%\" OR tracks.artist like \"%")+searchBox->text().toUTF8()+std::string("%\" OR tracks.album like \"%")+searchBox->text().toUTF8()+std::string("%\"")).limit(49);
|
||||
|
||||
//Make sure all items are gone
|
||||
for(RequestItem* item: foundItems)
|
||||
@@ -167,7 +167,7 @@ void RequestInterface::searchClicked()
|
||||
}
|
||||
else
|
||||
{
|
||||
searchBox->setText("Not enough/too many results");
|
||||
searchBox->setText("Not enough results");
|
||||
}
|
||||
searchTransaction.commit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user