We have a bunch of new data in an experimental search index for commons (see T286562)
First attempt to improve search by using the new data hasn't worked (see https://phabricator.wikimedia.org/T286565#7523908)
The new data works in a very similar way to the image matching algorithm, so I think we ought to be able to do better
Let's create a new search feature connectedtowikidataid so that you can search directly for images that are related to a wikidata item via one of the new fields or via statements e.g. by searching for connectedtowikidataid:Q144
Once it's done run the analysis script on it and see how it performs, and if possible compare to how the IMA itself performs (calling the IMA via https://image-suggestion-api.wmcloud.org/image-suggestions/v0/<product>/<language>/pages/<searchTerm>?source=ima)