Page MenuHomePhabricator

[haswbstatement] wildcard for qualifiers doesn't do job
Open, LowPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Along with documentation searching for any qualifier of specific property should be done with pipe, like haswbstatement:P180=Q146|P462=* (but in other place pipe is used as OR between properties…) – but it doesn't work:
    • working example; Commons; cats, that are black; using brackets, not pipe; haswbstatement:P180=Q146[P462=Q23445]: link
    • working example; Wikidata; elements with name ''William'' as second one; using brackets, not pipe; haswbstatement:P735=Q12344159[P1545=2]: link
    • not working example; Commons; cats that have any color; using pipe as doc says; haswbstatement:P180=Q146|P462=*: link (there are results, but images doesn't have qualifier P462 for pair P180:Q146)
    • not working example; Wikidata; elements with name ''William'' on any defined place; with pipe so according to docs; haswbstatement:P735=Q12344159|P1545=*: link (also gives results, but among many results some without P1545 for P735:Q12344159 pair, as Q465898)
    • not working example; Commons; cats with any color using brackets; against current docu, but probably more logical; haswbstatement:P180=Q146[P462=*]: link (no results)
    • not working example; Wikidata; elements with name ''William'' on any defined place; using brackets, against current docu, but probably more logical; haswbstatement:P735=Q12344159[P1545=*]: link (no results)

What happens?:
Wildcard for qualifiers doesn't appear to work – neither in described way or the logical one.
Examples described as more logical seems this way to me, as pipe is used as OR for two (or more) properties, so using it (pipe) in way it is described in docu (for qualifiers if it has wildcard) seems confusing (and other qualifiers stuff is using square brackets, so…).

What should have happened instead?:
If wildcard for qualifier works, but in some other way – docu should be updated.
If it doesn't work, it should be fixed/implemented (or removed from docu).
If it's just me, and I can't use it in proper way – excuse me :)

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
Stuck on this during translating docs to pl.

Other information (browser name/version, screenshots, etc.):

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Thanks for reporting this, I believe there are indeed a couple issues here:

  • the doc is clearly wrong when stating A wildcard can also be used when specifying qualifiers - to find all items that depict a cat of any color use haswbstatement:P180=Q146|P462=*, the use of | is used for something else.
  • the syntax haswbstatement:P180=Q146[P462=*] would indeed the one that makes the most sense but it does inhibit the prefix search because it expects * to be the last character
  • the syntax haswbstatement:P180=Q146[P462=* could possible work but we lower-case these terms internally and the use of the prefix query does not goes though the term analyzer (we'd have to use a normalizer here)
  • finally the syntax haswbstatement:p180=q146[p462=* (lowercasing manually) seems to work but it's definitely a poor workaround

Note that the use of wildcards this way will be subject to some limitations (we should clarify this in the documentation), it will extract at most 1024 possible qualifiers, in other words requesting a wildcard on a qualifier that may link or have a high number of distinct values might still miss some results.

Suggested fix:

  • use a normalizer for statement_keywords if possible
  • attempt to support the haswbstatement:P180=Q146[P462=*] syntax
  • fix the documentation
  • mention the 1024 terms limitation in the documentation