diff --git a/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java b/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java index 3a3ad173a..95117cb46 100644 --- a/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java +++ b/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java @@ -771,50 +771,6 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi { return CategoryImageUtils.getMediaList(childNodes); } - /** - * This method takes search keyword as input and returns a list of Media objects filtered using search query - * It uses the generator query API to get the images searched using a query, 25 at a time. - * @param query keyword to search images on commons - * @return - */ -// @Override - @NonNull - public List searchImages(String query, int offset) { - List imageNodes = null; - List authorNodes = null; - CustomApiResult customApiResult; - try { - customApiResult= api.action("query") - .param("format", "xml") - .param("generator", "search") - .param("gsrwhat", "text") - .param("gsrnamespace", "6") - .param("gsrlimit", "25") - .param("gsroffset",offset) - .param("gsrsearch", query) - .param("prop", "imageinfo") - .get(); - imageNodes= customApiResult.getNodes("/api/query/pages/page/@title"); - authorNodes= customApiResult.getNodes("/api/query/pages/page/imageinfo/ii/@user"); - } catch (IOException e) { - Timber.e(e, "Failed to obtain searchImages"); - } - - if (imageNodes == null) { - return new ArrayList<>(); - } - - List images = new ArrayList<>(); - - for (int i=0; i< imageNodes.size();i++){ - String imgName = imageNodes.get(i).getDocument().getTextContent(); - Media media = new Media(imgName); - media.setCreator(authorNodes.get(i).getDocument().getTextContent()); - images.add(media); - } - return images; - } - /** * This method takes search keyword as input and returns a list of categories objects filtered using search query * It uses the generator query API to get the categories searched using a query, 25 at a time.