dlang / dub

Package and build management system for D
MIT License
673 stars 230 forks source link

`dub search msgpack-d` returns all packages #1008

Open timotheecour opened 7 years ago

timotheecour commented 7 years ago

dub search msgpack returns

msgpack-d (1.0.0-beta.5)    MessagePack for D.
msgpack-rpc (0.1.2)         MessagePack RPC for D.

dub search msgpack-d returns all dub packages

s-ludwig commented 7 years ago

We really need to work on the search functionality. Using MongoDB's text search functionality improved parts, but regressed on others. Matching single-character words like in this case is one of them.

timotheecour commented 7 years ago

I don't understand. Why not use regex or even exact search? eg: dub search --regex '^msgp.*' => should match msgpack-d,msgpack-rpc dub search 'sgpack-d' => should match msgpack-d (eg using std.algorithm.canFind)

timotheecour commented 7 years ago

also, dub search msgpac returns nothing

timotheecour commented 6 years ago

after digging through code to understand what's going on I found this: dlang/dub-registry/source/dubregistry/dbcontroller.d:

        return m_packages
            .find(["$text": ["$search": query]], ["score": bson(["$meta": "textScore"])])

https://docs.mongodb.com/manual/text-search/#exact-phrase shows exact phrase can be used using double quotes, indeed:

dub search '"msgpack-d"'
msgpack-d (1.0.0-beta.6)    MessagePack for D.

However I don't understand other queries, eg:

dub search '"base"'
...
exceptions (0.2.3)                  Standard user exception classes.
...

why ???

Also: suffix search works:

dub search '"gpack-d"'
msgpack-d (1.0.0-beta.6)    MessagePack for D.

but not prefix:

dub search '"msgpac"' => empty

Also, with "", the whole word is needed for suffix search including -d: dub search '"gpack"' => empty

Geod24 commented 4 years ago

Sounds like a registry issue, but still an issue nonetheless.

Geod24 commented 9 months ago

I believe the situation has improved but we're still seeing way too many packages being returned. Would that be something you would be interested in tackling @WebFreak001 ?