-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/125351/#review85773
-----------------------------------------------------------


Oh wow. This is bad. Thanks for diagnosing it.

I'm wondering if this is the best way of solving it. The assumption always is 
that if a DB does not have any values then it can just return 0. If we change 
this assumption in PostingDB, then we should change it in every other DB 
(specially PositionDB). Maybe it would just be easier to update the logic in 
the SearchStore::constructQuery.

I haven't tested this, but this is what I was imagining - 

diff --git a/src/lib/searchstore.cpp b/src/lib/searchstore.cpp
index 806ea5f..26b4430 100644
--- a/src/lib/searchstore.cpp
+++ b/src/lib/searchstore.cpp
@@ -157,6 +157,9 @@ PostingIterator* SearchStore::constructQuery(Transaction* 
tr, const Term& term)
             PostingIterator* piter = constructQuery(tr, t);
             if (piter) {
                 vec << piter;
+            } else {
+                qDeleteAll(vec);
+                return 0;
             }
         }

What do you think?

- Vishesh Handa


On Sept. 22, 2015, 5:06 p.m., Igor Poboiko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/125351/
> -----------------------------------------------------------
> 
> (Updated Sept. 22, 2015, 5:06 p.m.)
> 
> 
> Review request for Baloo.
> 
> 
> Repository: baloo
> 
> 
> Description
> -------
> 
> This is a simple one-line fix for a bug (not sure there is one in bugzilla):
>     # balooshow -x baloo-fix-empty.patch
>     7347941719148552 2056 1710826 /home/eol/baloo-fix-empty.patch
>     
>     Internal Info
>     Terms: Mpatch Mtext Mx T8 
>     File Name Terms: Fbaloo Fempty Ffix Fpatch baloo empty fix patch 
>     XAttr Terms: 
>     
>     lineCount: 13
>     
> You can clearly see that type is 'T8' (which is 'text'). But:
>     # baloosearch --type video patch
>     /home/eol/baloo-fix-empty.patch
>     
> I don't have any 'video' file in baloo index. Because of that corresponding 
> PostingDB::iter() returns zero, and in SearchStore::constructQuery() this 
> term just gets ignored.
> This leads to bug that same file is displayed in different categories (Audio, 
> Video, Documents, Image) in KRunner search.
> 
> Instead we should return an empty iterator; this leads to zero results in 
> baloosearch (as it should be)
> 
> 
> Diffs
> -----
> 
>   src/engine/postingdb.cpp 8ca118c 
> 
> Diff: https://git.reviewboard.kde.org/r/125351/diff/
> 
> 
> Testing
> -------
> 
> Works as expected:    
>     # baloosearch --type text patch        
>     /home/eol/baloo-fix-empty.patch
>     Elapsed: 2.12026 msecs
> and
>     # baloosearch --type video patch
>     Elapsed: 1.71155 msecs
> 
> 
> Thanks,
> 
> Igor Poboiko
> 
>

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to