Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support query in a helper function #220

Open
dpriskorn opened this issue Sep 11, 2021 · 8 comments · May be fixed by #265
Open

Support query in a helper function #220

dpriskorn opened this issue Sep 11, 2021 · 8 comments · May be fixed by #265
Labels
enhancement New feature or request v0.11.x v0.13+

Comments

@dpriskorn
Copy link
Contributor

dpriskorn commented Sep 11, 2021

https://www.wikidata.org/w/api.php?action=help&modules=query
that module enables search using the cirrussearch extensions on Wikidata, see https://www.mediawiki.org/wiki/Help:Extension:WikibaseCirrusSearch

It is much more powerful than wbsearchentities it seems.

Example search is here: https://www.wikidata.org/w/api.php?format=json&action=query&list=search&srprop=&srlimit=10&srsearch=-haswbstatement:P31=Q13442814%20-haswbstatement:P31=Q5633421%20breast%20cancer

@LeMyst LeMyst added enhancement New feature or request v0.11.x v0.12.x labels Sep 11, 2021
@LeMyst
Copy link
Owner

LeMyst commented Sep 12, 2021

Hello @dpriskorn
Thank you for this issue. It's a really good idea.

I wonder how to create this function to be easily understandable by the user.

  • Allow to pass Claim as parameter
  • Use python dict
  • Use string

I started with the first one, but there is so much different case (has/hasnot, AND/OR, etc.), so i'm afraid the user will be lost.

@dpriskorn
Copy link
Contributor Author

I'm thinking pass a string for now and a limit will suffice. We can just link to the documentation. 😃

@LeMyst LeMyst linked a pull request Dec 18, 2021 that will close this issue
@LeMyst
Copy link
Owner

LeMyst commented Jan 23, 2022

There is probably no good way to support CirrusSearch without it being too complicated.

@LeMyst LeMyst added v0.13+ and removed v0.12.x labels Feb 15, 2022
@Thunderforge
Copy link

I am definitely interested in this functionality and would be happy to have a simple string as the parameter.

For instance, the documentation gives the example of kitten haswbstatement:P31=Q3305213. I was hoping I could do

wbi_helpers.search_entities("kitten haswbstatement:P31=Q3305213")

But this confusingly returns ['Q3305213'] (the same as the property value).

While a more complex method taking dict or Claim could be implemented, a string seems good enough for the web UI and it's good enough for my use cases.

@LeMyst
Copy link
Owner

LeMyst commented Oct 11, 2022

@dpriskorn
@Thunderforge

I've created the #436 to add a call to the query/search API endpoint.
But I can't really process the data because it only return "page" and not "Item" or "Lexeme".

It's good for you?

@dpriskorn
Copy link
Contributor Author

I would like it documented also with a Wikibase cirrus search example also. I can submit a patch if you would like 😀

@LeMyst
Copy link
Owner

LeMyst commented Oct 12, 2022

I would like it documented also with a Wikibase cirrus search example also. I can submit a patch if you would like 😀

With pleasure 😄

@Thunderforge
Copy link

@LeMyst This works great for my use cases. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v0.11.x v0.13+
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants