maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
227 stars 24 forks source link

wd search --type property does not find property #169

Closed bablf closed 1 year ago

bablf commented 1 year ago

The command wd search --type property "drug used for treatment" --lang en does not find any properties even though drug or therapy used for treatment exists.

My question is how does the search work and how can it be improved?

drug used for treatment seems to have been a used property a while ago. Here are some other old properties that can not be found any more: 'drug used for treatment',

'number of representatives in an organization/legislature or won in elections',
'time of spacecraft orbit decay',
'name version for other gender',
'official color or colors'
maxlath commented 1 year ago

By default, the wd search command uses the wbsearchentities API endpoint (ex: searching drug used for treatment), which is not great for fuzzy search, as I far as I understand, its based on a simple MySQL search.

wd search --cirrus is a bit better, as it relies on ElasticSearch and the WikibaseCirrusSearch extension, but then the --type filder doesn't work.

Note that for that purpose, there is also the wd props command, which has it own filtering mechanism (ex: wd props drug), or can be piped to grep, or even better, to fzf, which does fuzzy search: wd props | fzf --query 'drug used for treatment' --exit-0 --select-1

bablf commented 1 year ago

Thanks for the swift response! fzf seems to work :hugs:

bablf commented 1 year ago

Some of the aliases returned by wd search -j also seem to contain the old name.

maxlath commented 1 year ago

@bablf wd props downloads the full list once, and then use that local list, which might be out-dated: you can use wd props --reset to force a refresh