smikes / npm-kludge-search

Kludgy fast search
12 stars 3 forks source link

not working #9

Closed exebook closed 9 years ago

exebook commented 9 years ago
$ sudo npm i -g npm-kludge-search
/usr/local/bin/npm-kludge-search -> /usr/local/lib/node_modules/npm-kludge-search/bin/search-db.js

> npm-kludge-search@2.9.2 postinstall /usr/local/lib/node_modules/npm-kludge-search
> ./build-zip.sh

Checking for registry snapshot.

Not found; downloading registry snapshot (about 70MB, 3min)...

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 82.7M  100 82.7M    0     0   177k      0  0:07:57  0:07:57 --:--:--  194k
Cleaning up old full text search index (npmdb.pft).

Populating full text search (about 30s)...

> npm-kludge-search@2.9.2 populate /usr/local/lib/node_modules/npm-kludge-search
> node ./bin/populate.js "-d" "npmdb.dir"

.............................................................................
Writing full-text index...

Added 157051 packages to /usr/local/lib/node_modules/npm-kludge-search/npmdb.dir
Compressing to zip file...
Cleaning up...
Done!
npm-kludge-search@2.9.2 /usr/local/lib/node_modules/npm-kludge-search
├── hoek@2.13.0
├── JSONStream@0.10.0 (through@2.3.7, jsonparse@0.0.5)
├── nopt@3.0.1 (abbrev@1.0.5)
├── event-stream@3.3.1 (duplexer@0.1.1, from@0.1.3, stream-combiner@0.0.4, pause-stream@0.0.11, map-stream@0.1.0, through@2.3.7, split@0.3.3)
├── columnify@1.5.1 (strip-ansi@2.0.1, wcwidth@1.0.0)
└── pure-fts@3.2.1 (binary-search@1.2.0, through@2.3.7, async@0.9.0, adm-zip@0.4.7, mkdirp@0.5.0, rimraf@2.3.3)

$ time sudo npm-kludge-search -n npm-kludge-search

/usr/local/lib/node_modules/npm-kludge-search/node_modules/pure-fts/node_modules/binary-search/index.js:14
    high = haystack.length - 1;
                   ^
TypeError: Cannot read property 'length' of undefined
    at module.exports (/usr/local/lib/node_modules/npm-kludge-search/node_modules/pure-fts/node_modules/binary-search/index.js:14:20)
    at findIndex (/usr/local/lib/node_modules/npm-kludge-search/node_modules/pure-fts/lib/findIndex.js:10:15)
    at Object._onImmediate (/usr/local/lib/node_modules/npm-kludge-search/node_modules/pure-fts/lib/get.js:23:9)
    at processImmediate [as _immediateCallback] (timers.js:336:15)

real    0m0.877s
user    0m0.752s
sys 0m0.132s
smikes commented 9 years ago

thanks! I will look into this today.

smikes commented 9 years ago

Thanks for reporting this bug!

npm-kludge-search was not handling the possibility that the curl command could fail, and the registry has intermittently been returning 503 errors for the all endpoint. This will take a bit of coding to fix.

smikes commented 9 years ago

The all endpoint is working better now, so you may be able to work around this for the moment by running

$ rm -f npm-all-cache.json
$ ./build-zip.sh
smikes commented 9 years ago

Is this still a problem for you?

I am trying to clean up older issues, so I will now close this issue. (Don't worry -- you can always come back again and open a new issue!)

Thanks!

exebook commented 9 years ago

I did not try it since then, because I wrote my own blazing fast search (qnp). Now my computer is broken and I cannot try. I will try later, when it is fixed (if I won't forget).

The problem was to preserve data between command line calls, otherwise not possible to search reaaaally fast, I solved it by starting background microservice to store the preloaded and filtered npm dump. This only works on *nix though.