- public void search(SupportType searchOn, String keywords, int page, int item) throws IOException {
-
+ public void search(SupportType searchOn, String keywords, int page,
+ int item, boolean sync) throws IOException {
+ BasicSearchable search = BasicSearchable.getSearchable(searchOn);
+
+ if (page == 0) {
+ System.out.println(search.searchPages(keywords));
+ } else {
+ List<MetaData> metas = search.search(keywords, page);
+
+ if (item == 0) {
+ System.out.println("Page " + page + " of stories for: "
+ + keywords);
+ displayStories(metas);
+ } else {
+ // ! 1-based index !
+ if (item <= 0 | item > metas.size()) {
+ throw new IOException("Index out of bounds: " + item);
+ }
+
+ MetaData meta = metas.get(item - 1);
+ displayStory(meta);
+ }
+ }