@@ -771,50 +771,6 @@ public List<Media> getCategoryImages(String categoryName) {
771
771
return CategoryImageUtils .getMediaList (childNodes );
772
772
}
773
773
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
-
818
774
/**
819
775
* This method takes search keyword as input and returns a list of categories objects filtered using search query
820
776
* It uses the generator query API to get the categories searched using a query, 25 at a time.
0 commit comments