Include search corrections in API.

This commit is contained in:
FireMaskterK 2021-10-10 00:24:29 +01:00
parent 2c7baa0710
commit 022a0af007
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
2 changed files with 11 additions and 3 deletions

View file

@ -407,8 +407,8 @@ public class ResponseHelper {
Page nextpage = info.getNextPage(); Page nextpage = info.getNextPage();
return Constants.mapper return Constants.mapper.writeValueAsBytes(new SearchResults(items,
.writeValueAsBytes(new SearchResults(items, Constants.mapper.writeValueAsString(nextpage))); Constants.mapper.writeValueAsString(nextpage), info.getSearchSuggestion(), info.isCorrectedSearch()));
} }

View file

@ -5,10 +5,18 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class SearchResults { public class SearchResults {
public ObjectArrayList<Object> items; public ObjectArrayList<Object> items;
public String nextpage; public String nextpage, suggestion;
public boolean corrected;
public SearchResults(ObjectArrayList<Object> items, String nextpage) { public SearchResults(ObjectArrayList<Object> items, String nextpage) {
this.nextpage = nextpage; this.nextpage = nextpage;
this.items = items; this.items = items;
} }
public SearchResults(ObjectArrayList<Object> items, String nextpage, String suggestion, boolean corrected) {
this.items = items;
this.nextpage = nextpage;
this.suggestion = suggestion;
this.corrected = corrected;
}
} }