NSGod / ichm

iChm is a CHM reader for Mac OS X
http://www.robinlu.com/blog/ichm
108 stars 26 forks source link

Spotlight doesn't work in 10.8 #2

Open 1-61803 opened 8 years ago

1-61803 commented 8 years ago

Console logs some messages that doesn't seem informative.

Could you compile it specifically for older systems, or at least provide a debug version to gather logs?

NSGod commented 8 years ago

Hmm, I generally try to make things as backwards compatible as possible. I set the deployment target for this project to OS X 10.6, and tested it in a virtual machine running OS X 10.6 and it seemed to work OK. I will do some additional testing to see if I can reproduce the issue here (I do have a copy of every version of OS X going back to OS X 10.5, so it shouldn't be too difficult). Will let you know.

1-61803 commented 8 years ago

Hmm, I generally try to make things as backwards compatible as possible.

Oh, NSGod, thanks for that, I'll immolate a cow to you. Btw, which SDK did you use?

NSGod commented 8 years ago

I used the OS X 10.11 SDK from within Yosemite (OS X 10.10).

OK, can you do a couple of tests for me?

In Terminal.app, run the following command and paste the results in a response:

mdimport -L

Note that unfortunately, just by placing iChm.app version 1.5 with the Spotlight importer, your current .chm documents won't be searchable, at least in my experience. You can either run the following command in Terminal (which I may build in automatically to the next version):

mdimport -r /Applications/iChm.app/Contents/Library/Spotlight/CHM.mdimporter

(Note that this assumes you have iChm.app installed in your /Applications/ folder, if it's located elsewhere, adjust the path accordingly).

That will tell Spotlight to reindex existing .chm files.

Otherwise, you can use touch on existing individual .chm files, which will force Spotlight to wake up and process that file.

By doing either of those 2 things here in my 10.6 test machine, I am able to have the spotlight indexing work properly.

1-61803 commented 8 years ago

mdimport sees the plugin at

/Applications/iChm.app/Contents/Library/Spotlight/CHM.mdimporter

I run the command posted by you, but it doesn't index chm files. That means, for example, that if I search for the author of a chm book, Spotlight won't find it.

Console logs

Apr 16 16:25:35 quicklookd32[96691]: dpath=CHM Metadata Importer.mdimporter/    attr=drwxr-xr-x unco=0  comp=0  time=20070311.2022
    dpath=CHM Metadata Importer.mdimporter/Contents/    attr=drwxr-xr-x unco=0  comp=0  time=20070311.2024
    -path=CHM Metadata Importer.mdimporter/Contents/Info.plist  attr=-rw-r--r-- unco=1986   comp=0  time=20070311.2022
    dpath=CHM Metadata Importer.mdimporter/Contents/MacOS/  attr=drwxr-xr-x unco=0  comp=0  time=20070311.2022
    -path=CHM Metadata Importer.mdimporter/Contents/MacOS/CHM Metadata Importer attr=-rwxr-xr-x unco=36228  comp=0  time=20070311.2022
    dpath=CHM Metadata Importer.mdimporter/Contents/Resources/  attr=drwxr-xr-x unco=0  comp=0  time=20070311.2024
    dpath=CHM Metadata Importer.mdimporter/Contents/Resources/English.lproj/    attr=drwxr-xr-x unco=0  comp=0  time=20070311.2022
    -path=CHM Metadata Importer.mdimporter/Contents/Resources/English.lproj/InfoPlist.strings   attr=-rw-r--r-- unco=556    comp=0  time=20070311.2022
    -path=CHM Metadata Importer.mdimporter/Contents/Resources/English.lproj/schema.strings  attr=-rw-r--r-- unco=2  comp=0  time=20070311.2022
    -path=CHM Metadata Importer.mdimporter/Contents/Resources/schema.xml    attr=-rw-r--r-- unco=618    comp=0  time=20070311.2022
    dpath=CHM Metadata Importer.mdimporter/Contents/SharedSupport/  attr=drwxr-xr-x unco=0  comp=0  time=20070311.2027
    dpath=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/  attr=drwxr-xr-x unco=0  comp=0  time=20070311.2027
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/__init__.py   attr=-rw-r--r-- unco=1457   comp=0  time=20070311.2022
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/__init__.pyc  attr=-rw-r--r-- unco=884    comp=0  time=20070311.2027
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/_chmlib.so    attr=-rw-r--r-- unco=53748  comp=0  time=20070311.2022
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/chm.py    attr=-rw-r--r-- unco=21128  comp=0  time=20070311.2022
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/chm.pyc   attr=-rw-r--r-- unco=19062  comp=0  time=20070311.2027
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/chmlib.py attr=-rw-r--r-- unco=3832   comp=0  time=20070311.2022
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/chmlib.pyc    attr=-rw-r--r-- unco=6249   comp=0  time=20070311.2027
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/extra.so  attr=-rw-r--r-- unco=46624  comp=0  time=20070311.2022
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/importer.py   attr=-rwxr-xr-x unco=5787   comp=0  time=20070311.2027
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/importer.pyc  attr=-rw-r--r-- unco=9266   comp=0  time=20070311.2027

and

Apr 16 16:32:37 iChm[98888]: Performance: Please update this scripting addition to supply a value for ThreadSafe for each event handler: "/Library/ScriptingAdditions/SerialPort X.osax"
Apr 16 16:32:37 iChm[98888]: Performance: Please update this scripting addition to supply a value for ThreadSafe for each event handler: "/Library/ScriptingAdditions/SIMBL.osax"
Apr 16 16:32:37 iChm[98888]: [CHMDocument readFromURL:ofType:error:] url.path == /Users/me/Books/O'Reilly e-books/O'Reilly | Internet Core Protocols. The Definitive Guide.chm, type == com.microsoft.chm
Apr 16 16:32:37 iChm[98888]: [CHMDocument loadMetadata] SYSTEM unhandled value == 10
Apr 16 16:32:37 iChm[98888]: [CHMDocument loadMetadata] SYSTEM LCID == 4105
Apr 16 16:32:37 iChm[98888]: [CHMDocument loadMetadata] SYSTEM ecoding == CP1252
Apr 16 16:32:37 iChm[98888]: [CHMDocument loadMetadata] SYSTEM Home == icorprot/Default.htm
Apr 16 16:32:37 iChm[98888]: [CHMDocument loadMetadata] SYSTEM Title == O'Reilly - Internet Core Protocols: The Definitive Guide
Apr 16 16:32:37 iChm[98888]: [CHMDocument loadMetadata] SYSTEM Table of contents == (null)
Apr 16 16:32:37 iChm[98888]: [CHMDocument loadMetadata] SYSTEM Table of contents == Contents.hhc
Apr 16 16:32:37 iChm[98888]: [CHMDocument loadMetadata] SYSTEM unhandled value == 12
Apr 16 16:32:37 iChm[98888]: [CHMDocument loadMetadata] SYSTEM unhandled value == 13
Apr 16 16:32:37 iChm[98888]: [CHMDocument loadMetadata] SYSTEM unhandled value == 15
Apr 16 16:32:37 iChm[98888]: [CHMDocument prepareSearchIndex]
Apr 16 16:32:37 iChm[98888]: [CHMDocument buildSearchIndex]

I even dragged a folder full of chm books to System Preferences > Spotlight > Privacy and deleted it there to force re-indexing, to no avail.

I also checked Apple's documentation to troubleshoot importers.

I read about problems arising when targeting an older system with a newer SDK. Do you have 10.6 SDK to compile against?

1-61803 commented 8 years ago

Any progress?

NSGod commented 8 years ago

"I read about problems arising when targeting an older system with a newer SDK..."

If you know how to do things properly, it shouldn't cause any problems. (For example, if you blindly try to use some functionality that was introduced in OS X 10.10, when running the app on a user who only has OS X 10.6, it could crash. But nothing like that should be happening, as I've made sure I don't do anything like that). The problems that do occur are usually quite obvious, and usually result in a crash.

The first section of Console logs you've posted aren't coming from iChm.app:

Apr 16 16:25:35 quicklookd32[96691]: dpath=CHM Metadata Importer.mdimporter/    attr=drwxr-xr-x unco=0  comp=0  time=20070311.2022
    dpath=CHM Metadata Importer.mdimporter/Contents/    attr=drwxr-xr-x unco=0  comp=0  time=20070311.2024
    -path=CHM Metadata Importer.mdimporter/Contents/Info.plist  attr=-rw-r--r-- unco=1986   comp=0  time=20070311.2022
    dpath=CHM Metadata Importer.mdimporter/Contents/MacOS/  attr=drwxr-xr-x unco=0  comp=0  time=20070311.2022
....
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/chm.pyc   attr=-rw-r--r-- unco=19062  comp=0  time=20070311.2027
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/chmlib.py attr=-rw-r--r-- unco=3832   comp=0  time=20070311.2022
    -path=CHM Metadata Importer.mdimporter/Contents/SharedSupport/chm/chmlib.pyc    attr=-rw-r--r-- unco=6249   comp=0  time=20070311.2027

First off, you'll notice quicklookd32, that means you have a 32 bit CHM QuickLook plugin somewhere on your system, and for whatever reason, it's logging something having to do with a CHM Spotlight Importer that's different than the one included in iChm. The Spotlight plugin I've included in iChm is named CHM.mdimporter, while the paths logged in the console are CHM Metadata Importer.mdimporter. Also, the lines like "... /SharedSupport/chm/chmlib.py" are Python scripts and Python bytecode files which iChm doesn't use.

The logging in the second section is from iChm and is all normal.

It looks like there are probably multiple CHM Spotlight Importers and/or CHM QuickLook plugins that are conflicting with each other. I've tried to locate a copy of the CHM Metadata Importer.mdimporter Spotlight plugin for testing, but Google searches turned up nothing.

I have a large update that's almost finished that adds a QuickLook Generator, and in which the Spotlight importer will log the paths of each file that's being indexed to the Console.

To help troubleshoot, I really need the full output from the following commands in Terminal:

mdimport -L and

qlmanage -m

1-61803 commented 8 years ago

I have since restored things back and deleted unnecessary plugins, but I'd be willing to try the update. Please, do post in here when it's available and I'll be happy to test it.