Description
We want users to be able to search among functions that take the following input types:
- strings
- types with parsers
- enums
And output the following:
- strings
- types with renderers
Details
How to filter by input types:
- strings: wikilambda_zobject_join:
- where wlzo_key=Z8K1 and wlzo_related_object=Z6
- types with parser: wikilambda_zobject_join
- where wlzo_key=Z8K2 and wlzo_related_object=X, and
- wlzo_main_zid=X and wlzo_key=Z4K6 non empty
- enums: Impossible to know from secondary tables. Some alternative options:
- ❌ Option 1: Types that have instances. This means that we would also filter among functions that have input types as implementations, testers, types. There are few types with instances that will appear in function inputs that are not enums. Also, the output filter would restrict those. For example Z881, Z882 or Z883 take types as inputs, and types have instances. However, because their output is Z4, they would be filtered out.
- ❌ Option 2: Add renderer functions to all enum types. Enums have their own behavior in the front-end (selector with instances); also the string renderer field in the front-end only is shown when the type has both renderer and parser. If we created a renderer function for all enum types which just prints their identity, functions that have enum inputs would be shown in the "types with renderer" queries.
- ✅ Option 3: Add info about enums in the secondary tables. There is no good place to put this with current tables. Maybe adding additional rows for instances of enums into the wikilambda_zobject_join (see below)
How to filter by output type:
- strings: wikilambda_zobject_join
- where wlzo_key=Z8K2 and wlzo_related_object=Z6
- types with renderer: wikilambda_zobject_join
- where wlzo_key=Z8K1 and wlzo_related_object=X, and
- wlzo_main_zid=X and wlzo_key=Z4K5 non empty
Performance
TODO
- track parser and renderer relations in the wikilambda_zobject_join table: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/1105019
- track instances of enums in the wikilambda_zobject_join table: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/1105019
- run updateSecondaryTables for -zType Z4
- build SQL query to filter required functions: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/1105890
- incorporate this filter into API (or new API): https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/1105890
wikilambda_zobject_join to track enums
E.g. Z20000 and Z20001 are instances of Z10000, which is an enum type:
| wlzo_main_zid | wlzo_main_type | wlzo_key | wlzo_related_zobject | wlzo_related_type |
| Z20000 | Z10000 | "instanceofenum" or NULL | Z10000 | Z4 |
| Z20001 | Z10000 | "instanceofenum" or NULL | Z10000 | Z4 |
Completion checklist
- Before closing this task, review one by one the checklist available here: https://www.mediawiki.org/wiki/Abstract_Wikipedia_team/Definition_of_Done#Front-end_Task/Bug_Completion_Checklist