Help talk:Extension:WikibaseCirrusSearch

About this board

RoyZuo (talkcontribs)

take File:Test.wav for example. it has P170=some value with qualifier P4174=RZuo. how do i make a search that finds all files with this?

Dipsacus fullonum (talkcontribs)

I may be wrong, but I doubt that you can use WikibaseCirrusSearch to search structured data for files on Commons. You can however use the Wikimedia Commons Query Service (WCQS) with a SPARQL query like this:

SELECT ?file
WHERE
{
    ?file p:P170 ?statement.
    ?statement ps:P170 ?value.
    FILTER wikibase:isSomeValue(?value)
    ?statement pq:P4174 "RZuo".
}

Try it!

Edit: After testing on Commons I see that I was wrong: You can use WikibaseCirrusSearch on Commons. However there seems to be no support for "some value" values, so you will have to use the SPARQL query anyway.

RoyZuo (talkcontribs)
Reply to "P = some value?"

haswbstatement:*[*=Q…]

6
Mykhal (talkcontribs)

From the description it seems that e.g. haswbstatement:*[*=Q603908] (or haswbstatement:"*[*=Q603908]") (like in working SPARQL: ?item ?tmpprop [ ?tmpqual wd:Q603908 ]) would work for search of whatever item with whatever statement with whatever qualifier of given qid value, but it's invalid statement, currently. —Mykhal (talk) 10:42, 4 January 2024 (UTC)

This post was hidden by Mykhal (history)
Matěj Suchánek (talkcontribs)

Which part of the documentation implies that something like haswbstatement:*[*] should be possible?

Mykhal (talkcontribs)

I think it does not need further explanation (I did not say implies).

It could be considered a (sub-)feature request (not at the best place though).

Regards, —Mykhal (talk) 09:23, 6 January 2024 (UTC)

Matěj Suchánek (talkcontribs)

Oh sorry, my misunderstanding. Could indeed be useful.

Mykhal (talkcontribs)

After revisiting… misunderstanding might be mine – my assumptions/premises about currently supported syntax (after ":" for brevity):

  1. Pxyz=Qxyz
  2. …[Pxyz=Qxyz]
  3. *
  4. *=Qxyz

of which #4 seems to be wrong. —Mykhal (talk) 12:36, 6 January 2024 (UTC)

Reply to "haswbstatement:*[*=Q…]"

haswbstatement not working for me. What to check?

3
Clausekwis (talkcontribs)

We have a wikibase installation with several thousand items.

I have checked that CirrusSearch and WikibaseCirrusSearch are both enabled and that $wgWBCSUseCirrus = true; is set.

While inlabel: works fine for me, haswbstatement: doesn't give me any results. Not even using haswbstatement:*.

I checked the elasticsearch query using cirrusDumpQuery and I can see that it gets created properly, yet this does not return anything.

"should": [{ "match": { "statement_keywords.property": { "query": "P1" } } } ]


Furthermore, I have found that these work:

  • hasdescription:fr
  • haslabel:fr
  • inlabel:Metz


And these do not:

  • haswbstatement:*
  • wbstatementquantity:P1=Q17<2


I suppose the next step would be checking the configuration of my elasticsearch index. Any advice on what to look for?

Clausekwis (talkcontribs)

I have started looking at the the various queries, and then at the documents as they are being indexed. And I can see that none of my documents actually have values in the statement_keywords field that is used by the haswbstatement query:

E.g.

"descriptions" : { "en-gb" : "A record with all possible information filled in." }, "statement_keywords" : [ ], "statement_count" : 32, …

Clausekwis (talkcontribs)

Turns out, the wikibase docker set-up is missing the required configuration parameters to actually index statements/properties.

Here's what I have added to our LocalSettings.php:

// For WikibaseCirrusSearch, see

// https://github.com/wikimedia/mediawiki-extensions-WikibaseCirrusSearch/blob/REL1_39/src/Fields/StatementsField.php

// Changing this requires `make setup-elastic` to recreate the mapping and re-index all data

$wgWBRepoSettings['searchIndexProperties'] = [ 'P1', 'P19', 'P23', ];

$wgWBRepoSettings['searchIndexTypes'] = [

'string', 'external-id', 'url', 'wikibase-item', 'wikibase-property',

'wikibase-lexeme', 'wikibase-form', 'wikibase-sense'

];


Of course, you'll need to adapt the property IDs to the ones you need/want to be indexed.

Reply to "haswbstatement not working for me. What to check?"

Wildcard and negative property search

1
Waldyrious (talkcontribs)

I've been exploring usage of relative image positions qualifiers using d:Property:P2677. The documentation in this page seems to suggest that I can search for images that have depicts statements (P180) with the relative image position qualifier (P2677) using a query like haswbstatement:P180=Q76|P2677=*, but that seems to capture both images with that qualifier and those without. Using something like haswbstatement:P180=Q76[P2677=*] doesn't seem to work either (no results are returned).

And actually, my main goal was to search for images with depict statements but without the qualifier. I tried a query like haswbstatement:P180=Q76 -haswbstatement:P180=Q76[P2677=*] but that (unsurprisingly, given the above) also doesn't return any results.

Is this a limitation of the extension, or am I using the syntax incorrectly?

Reply to "Wildcard and negative property search"

Retrieving a wikidata QID in-wiki knowing only a property value using LUA?

1
Evolution and evolvability (talkcontribs)

Adapted from: Extension talk:Wikibase Client/Lua#Retrieving an ID knowing only a property value?

Is this extension usable on WMF wikis? I'm looking for an in-wiki way to retrieve a QID based on a property value within mediawiki? For example, knowing an author's ORCID number, and returning their QID within mediawiki?

  • Something like wikibase.getEntityIdForPropertyValue(Property, Value)
  • Such that wikibase.getEntityIdForPropertyValue(P496,'0000-0002-6779-3151') → Q4693015

Any ideas welcomed!

Reply to "Retrieving a wikidata QID in-wiki knowing only a property value using LUA?"
Juandev (talkcontribs)

I would like to list all orange flowers flowering in July or August in the Czech Republic or Pennyslvania. For this I am using haswbstatement:P180=Q506[P462=Q39338] haswbstatement:P17=Q213|haswbstatement:P17=Q1400 haswbstatement:P2922=Q121|haswbstatement:P2922=Q122, but it doesnt work. Why? What is wrong? If I want to search just for orange flowering plants from one country it works, but it doesnt for both.

Reply to "Example"
Juandev (talkcontribs)

Would it be possible to add here translatewiki tags, that we can translate it?

Mainframe98 (talkcontribs)

Yes Done

Give the results stored within the subproperties too

1
Christian Ferrer (talkcontribs)

Hello, it would be very very great that when you search for a specific statement value then the result includes the values stored by subproperties. Exemple: P189 is a subproperty of P276, I think that https://commons.wikimedia.org/w/index.php?sort=relevance&search=haswbstatement%3AP276%3DQ668084&title=Special%3ASearch&profile=advanced&fulltext=1&advancedSearch-current=%7B%7D&ns0=1&ns6=1&ns9=1&ns12=1&ns14=1&ns100=1&ns106=1 should includes all the results of https://commons.wikimedia.org/w/index.php?sort=relevance&search=haswbstatement%3AP189%3DQ668084&title=Special%3ASearch&profile=advanced&fulltext=1&advancedSearch-current=%7B%7D&ns0=1&ns6=1&ns9=1&ns12=1&ns14=1&ns100=1&ns106=1. The opposite being of course not true as the purpose of a subproperty being to be more specific. Regards,

Reply to "Give the results stored within the subproperties too"
Christian Ferrer (talkcontribs)

Hello, in case that a search implies an item that is (instance of a) a taxon, it would be great if the results could integrate the child taxa. Exxemple this search works well : https://commons.wikimedia.org/w/index.php?sort=relevance&search=haswbstatement%3AP180%3DQ33767+haswbstatement%3AP180%3DQ2698352&title=Special%3ASearch&profile=advanced&fulltext=1&advancedSearch-current=%7B%7D&ns0=1&ns6=1&ns12=1&ns14=1&ns100=1&ns106=1 however the search with the direct parent taxon don't show any results, however it should (IMO) : https://commons.wikimedia.org/w/index.php?sort=relevance&search=haswbstatement%3AP180%3DQ33767+haswbstatement%3AP180%3DQ2108367&title=Special%3ASearch&profile=advanced&fulltext=1&advancedSearch-current=%7B%7D&ns0=1&ns6=1&ns12=1&ns14=1&ns100=1&ns106=1

Reply to "Search for taxa"
There are no older topics
Return to "Extension:WikibaseCirrusSearch" page.