Search in sources :

Example 1 with SearchService

use of com.rbmhtechnology.vind.demo.step3.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));
    }
}
Also used : JavaTimeModule(com.fasterxml.jackson.datatype.jsr310.JavaTimeModule) SearchService(com.rbmhtechnology.vind.demo.step4.service.SearchService) SearchResult(com.rbmhtechnology.vind.api.result.SearchResult) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with SearchService

use of com.rbmhtechnology.vind.demo.step3.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) {
        }
    }
}
Also used : SearchService(com.rbmhtechnology.vind.demo.step5.service.SearchService) ResultTransformer(com.rbmhtechnology.vind.demo.step5.guardian.ResultTransformer)

Example 3 with SearchService

use of com.rbmhtechnology.vind.demo.step3.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);
    }
}
Also used : SearchService(com.rbmhtechnology.vind.demo.step3.service.SearchService) SearchResult(com.rbmhtechnology.vind.api.result.SearchResult)

Aggregations

SearchResult (com.rbmhtechnology.vind.api.result.SearchResult)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JavaTimeModule (com.fasterxml.jackson.datatype.jsr310.JavaTimeModule)1 SearchService (com.rbmhtechnology.vind.demo.step3.service.SearchService)1 SearchService (com.rbmhtechnology.vind.demo.step4.service.SearchService)1 ResultTransformer (com.rbmhtechnology.vind.demo.step5.guardian.ResultTransformer)1 SearchService (com.rbmhtechnology.vind.demo.step5.service.SearchService)1