bayleeadamoss / zazu-file-finder

A file finder for Zazu.
18 stars 11 forks source link

File Finder isn't finding anything #12

Open Aragur opened 7 years ago

Aragur commented 7 years ago

Hello, I have a problem with the file finder. It's enabled in the config (using default config) but it isn't finding anything I search for. I'm on Windows 10. Am I missing a configuration here? (Plugin Debugger isn't logging anything higher than info-level)

bayleedev commented 7 years ago

What terms are you searching for? For instance if you are searching for an application "Chrome" it won't return results until the index has been created. If you are looking for a file such as "find resume.docx" it'll be on the fly and should search common folders recursively.

Aragur commented 7 years ago

Both aren't working. How can I see if indexing is done?

bayleedev commented 7 years ago

The json file it creates will exist in: ~/.zazu/plugins/tinytacoteam/zazu-file-finder/data/applications.json

For find resume.docx can you give me an example of a file you are trying to find and where it's located?

cecoates commented 7 years ago

In my case on Linux one of the issues was permissions in my applications folder. The files weren't owned by my user account or group, so Zazu didn't index them.

Not sure that applies to Windows 10 as well. Something to check?

Sidenote: through trial and error I figured out that until I set the permission for "others" to none, Zazu wouldn't index the files. Even if you're the owner and group, if permission for others is enabled, even as read only, it doesn't work for some reason. Now it's working perfectly for me.

Before changing file and folder permissions:

http://cld.wthms.co/1hMqC

After changing file and folder permissions:

http://cld.wthms.co/ymnf

The ~/.zazu/plugins/tinytacoteam/zazu-file-finder/data/applications.json seems to be the index for applications, is there also one for the files? Just curious.

cecoates commented 7 years ago

For kicks I booted into Windows and gave Zazu a try.

Initially, I wasn't able to see any programs. However, once I took ownership of the Program Files and Program Files (x86) directories, I was able to start them just fine.

Windows isn't my primary OS, so I wasn't worried about borking it, but YMMV.

I wasn't able to edit the security settings by right-clicking on the folder and trying to edit the permissions. So I went by the advice here instead:

https://superuser.com/questions/418381/windows-7-change-folder-permissions-when-options-are-greyed-out

Explanation: https://technet.microsoft.com/en-us/library/cc753024(v=ws.11).aspx

Start a command prompt as administrator

Enter the following two commands:

takeown -f "c:\Program Files" /r /d y

and then:

takeown -f "c:\Program Files (x86)" /r /d y

That will take ownership recursively of both directories. Depending on how many files there are, it could take awhile.

I forgot to record a before video, but this is after taking ownership:

http://cld.wthms.co/m3td

ghost commented 7 years ago

I'm experiencing the same thing on W10. When i took ownership of the program folders, this solved the indexing problems with the applications but i still can't find any files. Any tips?

JeroenBoersma commented 7 years ago

I think for Linux users this will fix most #13

Applications .desktop files need some work... Still not sure if it should be in this repository or stand on it's own

cecoates commented 7 years ago

@JeroenBoersma does that mean I could theoretically just install everything, including my Steam folder, to ~/bin and Zazu will pick up the executables?

And/or add /usr/local/bin to my directories.js?

cecoates commented 7 years ago

I wanted to test out the permissions on the file/open search in Windows 10.

I created three folders named Test. One in my home directory, one in C:\Test, and one in D:\Test. I took ownership of all three.

Then I added C:\Test and D:\Test to my directories.js manually.

I put a file named Bills.xlsx in all three Test directories. Then I reloaded the plugins and relaunched Zazu.

Expected Behavior

Launch Zazu. Type open/find bills. List of results come up that include the bills.xlsx. Type open/find test. List of results come up that include the Test directories.

Actual Behavior

Launch Zazu. Type open/find bills. No results. Type open/find test. No results.

Steps to reproduce the behavior

Launch Zazu. Type open/find bills or open/find test. Make a cup of tea just in case. No results, but tea is delicious.

Versions

JeroenBoersma commented 7 years ago

@cecoates https://github.com/tinytacoteam/zazu-file-finder/issues/12#issuecomment-271741862

Everything in your ~/bin would be indexed if it has the correct permissions. I think /usr/games and /usr/local/games should be added too by default.

For those .desktop file on Linux.. I think it needs some extra work, ideas are already in my head(I think I can fix this, but it'll take a couple of days)

Aragur commented 7 years ago

Sorry for the delay on this topic. I looked at: ~/.zazu/plugins/tinytacoteam/zazu-file-finder/data/ and the direcotry is completly empty (only a .gitkeep file inside).

Zazu: 3.2 OS: Windows 10 Insider Preview 15002 64 bit GIT: 2.11

incredibleweirdo commented 7 years ago

I want to add that I am seeing similar issue on Windows 7. Zazu does appear to have indexed my applications, and there is an applications.json file in ~/.zazu/plugins/tinytacoteam/zazu-file-finder/data. However, searching for files/documents does not return results.

Zazu version: 3.2 Windows 7 Enterprise 64 bit Git 2.10.1.windows.1

xjrcode commented 7 years ago

Same error on Mac 10.11.6 (Capitan). Zazu doesn't find anything. The data folder is empty (only .gitkeep). I've changed the folder permissions to 777 but no file is created.

My config file looks like this:

{
      "name": "tinytacoteam/zazu-file-finder",
      "variables": {
        "append": false,
        "directories": {
          "appPath": [
            "/Applications"
          ]
        }
      }
    }
twang2218 commented 7 years ago

Missing data\application.js might because an error happened in the appCache.js execution.

So, if you found data folder is empty(except .gitkeep), could you try run the following command under ~/.zazu/plugins/tinytacoteam/zazu-file-finder/ directory:

node appCache.js '{}'

And paste the result here please.

xjrcode commented 7 years ago

Here is the error:

./appCache.js:8
  const { cwd } = pluginContext
        ^
SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3
bayleedev commented 7 years ago

@x4vl that is caused by running it with the wrong node version, try switching to v6.5.0. This is easier with nvm, if you don't already have it. Thanks for helping debug this!

evowizz commented 7 years ago

Hi, uhm, the plugin isn't finding anything for me too :/ I'm on Windows 10.

setegonz commented 7 years ago

Mac 10.12.3 Sierra. I can search apps but I'm not able to search documents/file/etc. Maybe It will be good to recommend a "basic" mac installation. Thanks for the awesome product.

scheduardo commented 7 years ago

The same thing here... Only apps!

Windows 10 Default plugin installation.

twang2218 commented 7 years ago

@EvoWizz Could you check the comments above and give more information? is there a data\application.json, and if not, what's the node appCache.js '{}' output?

@setegonz @scheduardo If you can search app, but not documents/files, maybe it's another issue, could you provide the Zazu log under .zazu\log\, thanks.

scheduardo commented 7 years ago

Sure @twang2218 .

See attached. zazu.log.2017-02-17.zip

twang2218 commented 7 years ago

@scheduardo Thank you, there isn't any errors in the log indicating why fileFinder is not working, which is a problem, I will try to fix error logging problem first.

In the meantime, could you try node fileFinder.js 'planejamento' '{}' under .zazu\plugins\tinytacoteam\zazu-file-finder\ directory and paste the output here? I think there might be some errors during the execution of this script.

scheduardo commented 7 years ago

@twang2218

undefined:1 '{}' ^

SyntaxError: Unexpected token ' in JSON at position 0 at Object.parse (native) at __dirname (C:\Users\eduar.zazu\plugins\tinytacoteam\zazu-file-finder\fileFinder.js:45:52) at Object. (C:\Users\eduar.zazu\plugins\tinytacoteam\zazu-file-finder\fileFinder.js:55:3) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7)

twang2218 commented 7 years ago

@scheduardo Oops, does Windows not support quote in command line? sorry about that, I'm not using Windows anymore ;)

Could you try the command without the quote?

node fileFinder.js planejamento {}

scheduardo commented 7 years ago

No problem 😆

(node:12824) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: EPERM: operation not permitted, scandir 'C:\Users\eduar\Ambiente de Impressão'

PS: "Ambiente de Impressão" is "Printing Environment" in portuguese!

twang2218 commented 7 years ago

The error means listing folder contents of C:\Users\eduar\Ambiente de Impressão is not permitted.

There are 2 possible reasons, one is that there is a Anti-Virus software blocking the way, another reason is that it is missing the listing permission.

For the AV software, maybe you can turn it off and try again.

For the missing permission problem, you can right click C:\Users\eduar\Ambiente de Impressão folder, (or C:\Users\eduar folder), then click Properties, then Security tab, then click the current user (or the group), and check the permissions below, if it is missing the List folder contents, then check it and apply. Then try again.

evowizz commented 7 years ago

@twang2218 Hi, I don't have the application.json file, and running the command node appCache.js '{}' doesn't work, the cmd tell that the command isn't recognized [...] Any idea to make the command working?

twang2218 commented 7 years ago

@EvoWizz Could you paste the output here? so I can see what exactly the error is. And could you check your node version by node --version? You might have an outdated node version, I think node version should be 6+ to support ... expansion.

evowizz commented 7 years ago

@twang2218 I've updated node and it's working now, thanks :) So here is the output of the command node appCache.js '{}':

undefined:1
'{}'
^

SyntaxError: Unexpected token ' in JSON at position 0
    at JSON.parse (<anonymous>)
    at __dirname (C:\Users\XXX\.zazu\plugins\tinytacoteam\zazu-file-finder\appCache.js:50:52)
    at Object.<anonymous> (C:\Users\XXX\.zazu\plugins\tinytacoteam\zazu-file-finder\appCache.js:59:3)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:418:7)
twang2218 commented 7 years ago

@EvoWizz Windows seems not support quoting, so please run the command without quoting, node appCache.js {}.

evowizz commented 7 years ago

@twang2218 I tried on both user cmd and admin cmd, and all I get is... nothing :/

img

twang2218 commented 7 years ago

It's not necessary using admin cmd, and better not, because it will generate data\application.json file, and using admin cmd might cause the file permission changed to admin only, which will cause problem for later running zazu. If you already run as admin, please delete data\application.json file in the admin cmd if it's generated, and run it again as current user to generate the file with correct permission.

If it's not returning, then it's running, that's good sign, it is scanning the disk to collect the apps information, that will take some times, usually several minutes. If it's returned without any problem, then you should have data\applications.json already.

evowizz commented 7 years ago

@twang2218 Nope, it's still unfinished, and I still don't have data\application.json :/

twang2218 commented 7 years ago

🤔 That's wired, just give it some time to see whether it's extremly slow or just stucked, and make sure the command run as current user. I will work on error logging issue, hopefully there will be more information in the output to give more clue of what's going on.

scheduardo commented 7 years ago

I changed some permissions and the CPU use by Zazu got crazy. I needed to close it.

And about that command: node fileFinder.js planejamento {}

I have another output:

<--- Last few GCs --->

193195 ms: Mark-sweep 1365.0 (1435.0) -> 1365.0 (1435.0) MB, 1335.4 / 1.0 ms [allocation failure] [GC in old space requested]. 194544 ms: Mark-sweep 1365.0 (1435.0) -> 1365.0 (1435.0) MB, 1349.5 / 1.0 ms [allocation failure] [GC in old space requested]. 195885 ms: Mark-sweep 1365.0 (1435.0) -> 1365.0 (1410.0) MB, 1340.2 / 0.9 ms [last resort gc]. 197292 ms: Mark-sweep 1365.0 (1410.0) -> 1365.0 (1410.0) MB, 1406.3 / 1.0 ms [last resort gc].

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 000001FF353CFB61 2: normalize [path.js:~310] [pc=000001C82BBD7562] (this=0000002AE64E7901 <an Object with map 000001E5E4112D21>,path=000002577530BE21 <String[195]: C:\Users\eduar\AppData\Local\Dados de Aplicativos\Dados de Aplicativos\Dados de Aplicativos\Dados de Aplicativos\Packages\Microsoft.SkypeApp_kzf8qxf38zg5c\AC\INetCache\BHTU4MS7\public34S923Y4.jpg>) 3: join [path.js:~460] [pc=000001C82BBCDD4...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

scheduardo commented 7 years ago

It's impossible to use it. screen recording 2017-02-17 at 04 59 38 pm

evowizz commented 7 years ago

@twang2218 So, after a long time:

<--- Last few GCs --->

[6008:000002A9D0CB4A80]  1497807 ms: Mark-sweep 1429.2 (1505.0) -> 1429.2 (1505.0) MB, 2791.7 / 2.2 ms  allocation failure GC in old space requested
[6008:000002A9D0CB4A80]  1500286 ms: Mark-sweep 1429.2 (1505.0) -> 1429.2 (1474.0) MB, 2431.4 / 2.2 ms  last resort gc
[6008:000002A9D0CB4A80]  1502976 ms: Mark-sweep 1429.2 (1474.0) -> 1429.2 (1474.0) MB, 2688.4 / 2.3 ms  last resort gc

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 000000AE8A6C0D59 <JS Object>
    1: exec [native regexp.js:~113] [pc=000003AE593C8EE1](this=00000169FB50CF71 <JS RegExp>,C=000003B6CBC32FE9 <String[139]: C:\Users\XXX\Desktop\LocationOfAPrivateFile>)
    2: 000000AE8A676529 <Symbol: Symbol.match>(aka [Symbol.match]) [native regexp.js:~416] [pc=000003AE593CFF90](this=00000169FB...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
scheduardo commented 7 years ago

Hey @twang2218 ... news?

I'm still using zazu without file finder... No conditions!

thande commented 7 years ago

So I was having similar issues, OS X 10.11.6, installed zazu via brew

$ node appCache.js '{}' module.js:440 throw err; ^

Error: Cannot find module 'uuid' at Function.Module._resolveFilename (module.js:438:15) at Function.Module._load (module.js:386:25) at Module.require (module.js:466:17) at require (internal/module.js:20:19) at Object. (/Users/sdelight/.zazu/plugins/tinytacoteam/zazu-file-finder/node_modules/iconutil/index.js:2:12) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:456:32) at tryModuleLoad (module.js:415:12) at Function.Module._load (module.js:407:3)

I installed a few modules via npm in the file-plugin directory and it looks like i's working now but I'd be interested in a better way of solving it to ensure the plugins install the necessary required NPM modules

danielbayerlein commented 7 years ago

Same here with macOS 10.12.3. node appCache.js '{}' returns nothing.

danielbayerlein commented 7 years ago

Any idea what I can try? 😕

bayleedev commented 7 years ago

@danielbayerlein The mdfind (for macOS) adapter was merged in last week, I bet updating your plugins would fix the issue.

danielbayerlein commented 7 years ago

@blainesch The plugins are up-to-date 😟 I also removed the .~/zazu folder.

chrishelgert commented 7 years ago

i have the same problem 😞

danielbayerlein commented 7 years ago

Log:

{"error":{"errno":-2,"code":"ENOENT","syscall":"open","path":"/Users/danbay/.zazu/plugins/tinytacoteam/zazu-file-finder/data/applications.json"},"plugin":"tinytacoteam/zazu-file-finder","block":"AppCache","level":"error","message":"Script failed","timestamp":"2017-03-07T10:25:07.746Z"}
danielbayerlein commented 7 years ago

@blainesch Any idea what I can try?

bayleedev commented 7 years ago

node appCache.js '{}' shouldn't return anything anymore. Are you saying you can't find apps or files on mac? It's using mdfind now, which should be very consistent on mac's... can you try running mdfind kind:app OR kind:pref ?

danielbayerlein commented 7 years ago

@blainesch The commands find and open works very well. But I can not find any application. mdfind kind:app OR kind:pref returns nothing.

bayleedev commented 7 years ago

@danielbayerlein I'm unsure how to debug mdfind, from what I can tell it's only configurable from the command line interface. Maybe I'm missing something?

chrishelgert commented 7 years ago

@blainesch if i understand https://stackoverflow.com/questions/30271328/how-do-i-get-mdfind-to-include-folder-matches-in-addition-to-files right, there are two distinct languages.

@danielbayerlein and me have a german osx maybe there is the problem

--> mdfind 'kind:folder' - no results 😢 mdfind 'kMDItemContentType:public.folder' - a lot of folders