Skip to content

Commit 8a1a92d

Browse files
maskaravivekdomdomegg
authored andcommitted
Remove unused code in ApacheHttpClientMediaWikiApi (commons-app#2722)
1 parent 052d09e commit 8a1a92d

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java

-44
Original file line numberDiff line numberDiff line change
@@ -771,50 +771,6 @@ public List<Media> getCategoryImages(String categoryName) {
771771
return CategoryImageUtils.getMediaList(childNodes);
772772
}
773773

774-
/**
775-
* This method takes search keyword as input and returns a list of Media objects filtered using search query
776-
* It uses the generator query API to get the images searched using a query, 25 at a time.
777-
* @param query keyword to search images on commons
778-
* @return
779-
*/
780-
// @Override
781-
@NonNull
782-
public List<Media> searchImages(String query, int offset) {
783-
List<CustomApiResult> imageNodes = null;
784-
List<CustomApiResult> authorNodes = null;
785-
CustomApiResult customApiResult;
786-
try {
787-
customApiResult= api.action("query")
788-
.param("format", "xml")
789-
.param("generator", "search")
790-
.param("gsrwhat", "text")
791-
.param("gsrnamespace", "6")
792-
.param("gsrlimit", "25")
793-
.param("gsroffset",offset)
794-
.param("gsrsearch", query)
795-
.param("prop", "imageinfo")
796-
.get();
797-
imageNodes= customApiResult.getNodes("/api/query/pages/page/@title");
798-
authorNodes= customApiResult.getNodes("/api/query/pages/page/imageinfo/ii/@user");
799-
} catch (IOException e) {
800-
Timber.e(e, "Failed to obtain searchImages");
801-
}
802-
803-
if (imageNodes == null) {
804-
return new ArrayList<>();
805-
}
806-
807-
List<Media> images = new ArrayList<>();
808-
809-
for (int i=0; i< imageNodes.size();i++){
810-
String imgName = imageNodes.get(i).getDocument().getTextContent();
811-
Media media = new Media(imgName);
812-
media.setCreator(authorNodes.get(i).getDocument().getTextContent());
813-
images.add(media);
814-
}
815-
return images;
816-
}
817-
818774
/**
819775
* This method takes search keyword as input and returns a list of categories objects filtered using search query
820776
* It uses the generator query API to get the categories searched using a query, 25 at a time.

0 commit comments

Comments
 (0)