use of com.rbmhtechnology.vind.demo.step4.service.SearchService in project vind by RBMHTechnology.
the class SearchApplication method main.
public static void main(String[] args) throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.registerModule(new JavaTimeModule());
try (SearchService searchService = new SearchService()) {
// index
searchService.index();
// search
SearchResult result = searchService.news("vind");
System.out.println(mapper.writeValueAsString(result));
}
}
use of com.rbmhtechnology.vind.demo.step4.service.SearchService in project vind by RBMHTechnology.
the class SearchApplication method main.
public static void main(String[] args) {
try (SearchService search = new SearchService(args[0])) {
get("/index", (req, res) -> search.index());
Spark.get("/search", (req, res) -> search.search(req.queryParams("q"), req.queryParamsValues("filter")), new ResultTransformer());
get("/news", (req, res) -> search.search(req.queryParams("q"), Integer.parseInt(StringUtils.defaultIfBlank(req.queryParams("p"), "1")), SearchService.Sort.pares(req.queryParams("sort"))), new ResultTransformer());
get("/suggest", (req, res) -> search.suggest(req.queryParams("q")), new ResultTransformer());
// of the core is deleted.
while (true) {
}
}
}
use of com.rbmhtechnology.vind.demo.step4.service.SearchService in project vind by RBMHTechnology.
the class SearchApplication method main.
public static void main(String[] args) {
try (SearchService searchService = new SearchService()) {
// index
searchService.index();
// search
SearchResult result = searchService.search("vind", 1);
System.out.println(result);
}
}
Aggregations