Lucas_Werkmeister_WMDE added a comment.

  Yeah, I like the array-of-arrays idea. Could be a separate method in the 
`TermIdsResolver` or a separate interface; in either case, I think 
`DatabaseTermIdsResolver` should still be the one database implementation, and 
if we go for a separate interface it should implement that one as well (and not 
have a separate class just for that purpose).
  
  ---
  
  Since Wikidata doesn’t use `wb_terms` for searching (T188993 
<https://phabricator.wikimedia.org/T188993>), and we’re not supporting third 
parties with the normalized schema at this point, we don’t need to implement 
full search yet. However, there is one class that uses `TermIndex`’s search 
functionality for other purposes: `TermPropertyLabelResolver` “searches” for 
all the property labels (case-insensitively, no prefix search, no limit), 
effectively preloading a map from label to property ID (which it also caches in 
memcached) to accelerate looking up properties by labels. (This is used in 
WikibaseClient, where we allow users to get data by specifying a property label 
instead of a property ID.)
  
  To support this case, we’ll also have to implement a separate 
`PropertyLabelResolver`. Like `TermPropertyLabelResolver`, it should do a 
prefetch of all property labels and store it in memcached (using the same key 
if possible). However, the current interfaces for the new term store would only 
allow us to get all the term IDs for properties (effectively the entire content 
of `wbt_property_terms`), then resolve all those terms and filter for labels in 
a certain language afterwards. We can’t afford to transfer all that data 
between PHP and the database, so instead the `wbt_property_terms` and 
`wbt_term_in_lang` parts will have to exchange JOIN conditions somehow, so that 
we can load all property labels in a certain language with just one query. (It 
still won’t be as efficient as in `wb_terms`, but with caching it should do for 
a while, and we can investigate improvements later.)

TASK DETAIL
  https://phabricator.wikimedia.org/T219303

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Lucas_Werkmeister_WMDE, Aklapper, alaa_wmde, darthmon_wmde, Premeditated, 
Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, 
rosalieper, Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to