dub icon indicating copy to clipboard operation
dub copied to clipboard

`dub search msgpack-d` returns all packages

Open timotheecour opened this issue 9 years ago • 6 comments

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

timotheecour avatar Dec 01 '16 01:12 timotheecour

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.

s-ludwig avatar Dec 19 '16 00:12 s-ludwig

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 avatar Dec 20 '16 11:12 timotheecour

also, dub search msgpac returns nothing

timotheecour avatar Dec 31 '16 15:12 timotheecour

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

timotheecour avatar Feb 13 '18 04:02 timotheecour

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

Geod24 avatar Jan 03 '20 04:01 Geod24

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 ?

Geod24 avatar Dec 28 '23 17:12 Geod24