- if (!m_customSearchQuery.isEmpty()) {
- // performance optimization: if a custom search query is defined,
- // there is no need to call the (quite expensive) method nepomukUrl()
- return true;
+ Nepomuk::Query::AndTerm andTerm;
+
+ // add search criterion terms
+ foreach (const SearchCriterionSelector* criterion, m_criteria) {
+ const Nepomuk::Query::Term term = criterion->queryTerm();
+ andTerm.addSubTerm(term);
+ }
+
+ // add custom query term from the searchbar
+ const Nepomuk::Query::Query customQuery = Nepomuk::Query::QueryParser::parseQuery(m_customSearchQuery);
+ if (customQuery.isValid()) {
+ andTerm.addSubTerm(customQuery.term());
+ }
+
+ // filter result by the "What" filter
+ switch (m_whatBox->currentIndex()) {
+ case 1: {
+ // Image
+ const Nepomuk::Query::ResourceTypeTerm image(Nepomuk::Vocabulary::NFO::Image());
+ andTerm.addSubTerm(image);
+ break;