Page MenuHomePhabricator

Change object search API to optionally include functions' return types as the 'type' filter
Closed, ResolvedPublic

Description

Currently the API for searching objects by name that can be filtered by the type of the objects.

We want to introduce a flag that can have three settings:

  • only return objects with that exact type
  • return objects of that type and functions that return objects of that type
  • return objects of that type, functions that return objects of that type, and functions that return objects of any type

Let one of these be a default.

The result should rank them together in a single list. Each result should state its type (so we can mark up functions)

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
StalledNone
Resolvedcmassaro
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
DuplicateNone
OpenNone
Resolvedcmassaro
OpenNone
ResolvedJdforrester-WMF
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
ResolvedNone
ResolvedNone
Resolvedcmassaro
Resolvedcmassaro
ResolvedNone
Resolvedgengh
Resolvedgengh
DeclinedLindsaykwardell
ResolvedLindsaykwardell
Resolvedcmassaro
Resolvedcmassaro
ResolvedNone
ResolvedNone
Resolvedcmassaro
ResolvedNone
InvalidNone
Invalidgengh
ResolvedNone
ResolvedNone
ResolvedJdforrester-WMF
ResolvedNone
ResolvedNone
DeclinedNone
ResolvedSimoneThisDot
ResolvedSimoneThisDot
Resolvedcmassaro
ResolvedSimoneThisDot
ResolvedSimoneThisDot
Resolvedgengh
ResolvedJdforrester-WMF
ResolvedSimoneThisDot
ResolvedJdforrester-WMF
ResolvedDVrandecic
ResolvedNone
ResolvedNone
Resolvedcmassaro
ResolvedDVrandecic
ResolvedLindsaykwardell
Resolvedarthurlorenzi
ResolvedNone
InvalidNone
Resolvedcmassaro
Resolvedcmassaro
Resolvedcmassaro
Resolvedcmassaro
Resolvedcmassaro
ResolvedJdforrester-WMF
Resolvedcmassaro
Resolvedcmassaro
Resolvedcmassaro
ResolvedNone
ResolvedSimoneThisDot
ResolvedSimoneThisDot
ResolvedSimoneThisDot
ResolvedJdforrester-WMF
Resolvedcmassaro
Resolvedgengh
Resolvedcmassaro
ResolvedJdforrester-WMF
Resolvedcmassaro
Resolvedcmassaro
ResolvedNone
ResolvedDVrandecic
Resolvedcmassaro
Resolvedarthurlorenzi
ResolvedAdesojiThisDot

Event Timeline

Jdforrester-WMF renamed this task from Search object API to optionally include functions to Change object search API to optionally include functions' return types as the 'type' filter.Dec 20 2021, 11:41 AM
Jdforrester-WMF added a project: WikiLambda.

Current implementation of wikilambdasearch_labels API allows for all of this. See the API updated documentation:
https://www.mediawiki.org/wiki/Extension:WikiLambda/API#list=wikilambdasearch_labels

Responding to each point:

only return objects with that exact type:

api.php?action=query&format=json&list=wikilambdasearch_labels&wikilambdasearch_language=en&wikilambdasearch_type=Z40

return objects of that type and functions that return objects of that type

api.php?action=query&format=json&list=wikilambdasearch_labels&wikilambdasearch_language=en&wikilambdasearch_type=Z40&wikilambdasearch_return_type=Z40&wikilambdasearch_strict_return_type=true

return objects of that type, functions that return objects of that type, and functions that return objects of any type

api.php?action=query&format=json&list=wikilambdasearch_labels&wikilambdasearch_language=en&wikilambdasearch_type=Z40&wikilambdasearch_return_type=Z40

The result should rank them together in a single list. Each result should state its type (so we can mark up functions)

The results are returned in a single list and each element contains information of its type and return type:

{
    "batchcomplete": "",
    "query": {
        "wikilambdasearch_labels": [
            {
                "page_namespace": 0,
                "page_title": "Z111",
                "page_type": "Z111",
                "return_type": null,
                "label": "foo",
                "is_primary": 1,
                "page_id": 0,
                "page_content_model": "zobject",
                "page_lang": "eu"
            }
        ]
    }
}

I believe this task should be marked as done.