- // Get the term from the facets and merge it with the
- // created term from the input-field.
- Nepomuk2::Query::Term facetsTerm = m_facetsWidget->facetsTerm();
-
- Nepomuk2::Query::FileQuery fileQuery;
- fileQuery.setFileMode(Nepomuk2::Query::FileQuery::QueryFilesAndFolders);
- if (facetsTerm.isValid()) {
- Nepomuk2::Query::AndTerm andTerm;
- andTerm.addSubTerm(searchLabelTerm);
- andTerm.addSubTerm(facetsTerm);
- fileQuery.setTerm(andTerm);
- } else {
- fileQuery.setTerm(searchLabelTerm);
+ // Configure the query so that it returns files and takes the rating into account
+ query.addType("File");
+ query.addType(m_facetsWidget->facetType());
+
+ Baloo::Term term(Baloo::Term::And);
+ Baloo::Term ratingTerm = m_facetsWidget->ratingTerm();
+
+ if (ratingTerm.isValid()) {
+ term.addSubTerm(query.term());
+ term.addSubTerm(ratingTerm);
+
+ query.setTerm(term);