Bug 314980

Summary: kcmsheel4 kcm_nepomuk: changing indexed folders uses wrong group for "folders"-key
Product: [Unmaintained] nepomuk Reporter: Franz Trischberger <franz.trischberger>
Component: kcmAssignee: Nepomuk Bugs Coordination <nepomuk-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: fmetton, frank78ac, me, woskimi
Priority: NOR    
Version: 4.10.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.1
Sentry Crash Report:

Description Franz Trischberger 2013-02-12 08:57:58 UTC
I am running most recent kde stable release (4.10).
I also have a patched nepomuk for the non-recursive-indexing bug.
I could watch nepomuk indexing (top + "Details..." in the KCM).

Now the problem:
clicking "Find" in dolphin opens the panel. When entering a search term I see kio_filenamesearch  at 30% CPU + some MB/s in iotop. I have selected "content", I expected a fast search with nepomuk.
So I navigated into a directory (marked for indexing - checked that) with only few files entering a search term that only exists as content and not as filename -> does not find anything.

Also the widget that comes up when pressing "more options" is completely grayed out with both filename and content search.

Those observations made me believe that the current dolphin does not search using nepomuk at all.
I know there are similar bugs, but they are either outdated (old versions - for them content search always worked for me, they also use nepomuk1) or content search with nepomuk turned OFF does not really work (which was to expect).
Comment 1 Tuukka Verho 2013-02-16 23:18:11 UTC
It seems Nepomuk is enabled in Dolphin at compile time. In other words, your distribution packages may have been compiled without Nepomuk support.
Comment 2 Franz Trischberger 2013-02-17 08:11:52 UTC
-- Configuring done

-----------------------------------------------------------------------------
-- The following external packages were located on your system.
-- This installation will have the extra features provided by these packages.
-----------------------------------------------------------------------------
   * KActivities - Interface library for the activity manager
   * Nepomuk Core - Nepomuk Core functionality
   * Nepomuk Widgets - Nepomuk Widgets

I can rate files.
I see the semantic ToolTip (well, there is that funny bug that prevents the tooltip from coming up when dolphin was compiled WITHOUT semantic desktop...)
Nepomuk is running - of course.
Comment 3 Frank Reininghaus 2013-02-17 11:37:05 UTC
Thanks for the bug report! Unfortunately, I have no idea what might be going wrong on your system. Could you disable Nepomuk in the System Settings, then re-enable it and check if that fixes the problem?
Comment 4 Franz Trischberger 2013-02-17 12:29:25 UTC
Well well well...
Not an issue in dolphin. After debugging + looking at the sources I found out that there seems to be something wrong with my indexed folders. I freshly set up nepomuk after switching to 4.10. After checking my setup in kcm_nepomuk, I saw that every folder I selected was unchecked again.
Looking at the nepomukstrigirc revealed that (for me) the folders[$e]-key is placed under "Device-optical://[name_of_currently_inserted_disc]" and not under "General" (for no obvious reason it only writes there, but will not read from there...). Argh :(
Comment 5 Frank Reininghaus 2013-02-17 12:32:58 UTC
Thanks for the update. I'm not entirely sure if I fully understood what the problem is, but I'll re-assign to Nepomuk then.
Comment 6 Franz Trischberger 2013-02-17 13:03:20 UTC
(In reply to comment #5)
> Thanks for the update. I'm not entirely sure if I fully understood what the
> problem is, but I'll re-assign to Nepomuk then.

DolphinSearchInformation::isPathIndexed() opens the nepomukstrigirc, reads "General/folders" and looks if the passed url is child of one of the indexed folders.
Looking into the nepomukstrigirc showed me, that "General/folders" was empty. Therefore I had several Groups in the form "Device-optical://<some_name>", each containing a folders-key.
Example:
======
[Device-optical://home_improvemen]
exclude folders[$e]=
folders[$e]=$HOME/Documents/Rezensionen,$HOME/Documents/sprachen,$HOME/Documents/Texte
mount path=

[General]
exclude filters=autom4te,*.rcore,CTestTestfile.cmake,*.o,*.omf,*.m4,*.orig,moc_*.cpp,conftest,.xsession-errors*,CMakeTmpQmake,*.tmp,po,.svn,.histfile.*,lzo,.git,litmain.sh,cmake_install.cmake,CMakeFiles,*.pc,*.nvram,*.la,CMakeCache.txt,confdefs.h,*.gmo,*.csproj,*.rej,config.status,lost+found,confstat,_darcs,CVS,*.part,libtool,*.aux,*.po,CMakeTmp,Makefile.am,*.lo,*.loT,*~,*.moc,*.vm*,core-dumps
exclude filters version=2
exclude folders[$e]=
exclude mimetypes=text/css,text/x-c++src,text/x-c++hdr,text/x-csrc,text/x-chdr,text/x-python,text/x-assembly,text/x-java,text/x-objsrc,text/x-ruby,text/x-scheme,text/x-pascal,text/x-yacc,text/x-sed,text/x-haskell,text/asp,application/x-awk,application/x-cgi,application/x-csh,application/x-java,application/x-javascript,application/x-perl,application/x-php,application/x-python,application/x-sh,application/x-tex
first run=false
folders[$e]=
index hidden folders=false
strigiVersion=unknown
======
Comment 7 Franz Trischberger 2013-02-17 13:29:40 UTC
--- nepomuk/kcm/nepomukserverkcm.cpp.org        2013-02-17 14:19:56.675652771 +0100
+++ nepomuk/kcm/nepomukserverkcm.cpp    2013-02-17 14:20:52.751651810 +0100
@@ -340,7 +340,7 @@
         QMutableListIterator<QString> it( includeFolders );
         while( it.hasNext() ) {
             QString fullPath = it.next();
-            if( fullPath.startsWith( mountPath ) ) {
+            if( !mountPath.isEmpty() && fullPath.startsWith( mountPath ) ) {
                 QString path = fullPath.mid( mountPath.length() );
                 if( !path.isEmpty() )
                     includes << path;

mountPath is empty (I disabled indexing of removable media) for every Device-*, so every fullPath startWith mountPath - and removed the entry from the "includeFolders", so only an empty list fell through to "2.2 Update normals paths" ;)
I don't know if this patch is too generic - asking for "index removable media"? - but an empty path as mountPath IMHO should never be correct.
Comment 8 Vishesh Handa 2013-02-17 13:31:49 UTC
This patch seems about right. If you have commit access please commit it to the KDE/4.10 branch. Otherwise I can do it for you?
Comment 9 Franz Trischberger 2013-02-17 13:33:34 UTC
I do not have commit access, so please commit. Thx :)
Comment 10 Vishesh Handa 2013-02-17 13:56:23 UTC
(In reply to comment #9)
> I do not have commit access, so please commit. Thx :)

Gimme about a day. I want to test this out thoroughly. There has been another bug report on something similar.

Thanks for the patch!
Comment 11 Franz Trischberger 2013-02-17 14:31:36 UTC
> Gimme about a day. I want to test this out thoroughly. There has been
> another bug report on something similar.
Which one?

After further looking at this I think the better solution would be to completely ignore Groups with empty mountPath:

--- nepomuk/kcm/nepomukserverkcm.cpp.org        2013-02-17 14:19:56.675652771 +0100
+++ nepomuk/kcm/nepomukserverkcm.cpp    2013-02-17 15:28:39.985582108 +0100
@@ -334,6 +334,9 @@
         KConfigGroup group = fileIndexerConfig.group( groupName );
 
         QString mountPath = entry->mountPath();
+        if( mountPath.isEmpty() )
+            continue;
+
         group.writeEntry( "mount path", mountPath );
 
         QStringList includes;

As "exclude folders" would expose a similar issue.
Comment 12 Vishesh Handa 2013-02-19 14:38:17 UTC
*** Bug 314072 has been marked as a duplicate of this bug. ***
Comment 13 Vishesh Handa 2013-02-19 14:59:53 UTC
Git commit 2f89bc097fa9a90858c2b2e7c03ef0fafc1e8047 by Vishesh Handa.
Committed on 19/02/2013 at 15:34.
Pushed by vhanda into branch 'KDE/4.10'.

Nepomuk Config: Ignore cases when there is no mount point

In some cases the mount point is empty. We do not want to store records
for those cases under their own group as that would intefere with the
genreal list of include/exclude folders.

The people affected by this bug should clear their nepomukstrigirc file.

Patch by Franz Fellner <alpine.art.kde@googlemail.com>
FIXED-IN: 4.10.1

M  +3    -0    nepomuk/kcm/nepomukserverkcm.cpp

http://commits.kde.org/kde-runtime/2f89bc097fa9a90858c2b2e7c03ef0fafc1e8047
Comment 14 Vishesh Handa 2013-02-19 15:00:50 UTC
*** Bug 314782 has been marked as a duplicate of this bug. ***