Full Text Search service

Es un mecanismo para busquedas en Couchbase

Documentación oficial

https://developer.couchbase.com/documentation/server/4.5/sdk/java/full-text-searching-with-sdk.html

MatchQuery

 PlanetasRepository planetasRepository= new PlanetasRepository();

        MatchQuery fts = SearchQuery.match("term");


        List<Planetas> list = planetasRepository.fullTexSearch(fts);
        list.forEach((p) -> {
            System.out.println(p.toString());
        });

Query Types

  PlanetasFacade planetasFacade = new PlanetasFacade();

        MatchQuery fts = SearchQuery.match("term")
                //query options:
                .fuzziness(2).field("content");
        SearchQuery query = new SearchQuery("default", fts)
                //search options:
                //will show value for idplaneta and planeta
                .fields("idplaneta", "planeta")
                //will have max 3 hits
                .limit(3);

        List<Planetas> list = planetasFacade.fullTexSearch(fts);
        list.forEach((p) -> {
            System.out.println(p.toString());
        });

Query Facets

Añade búsquedas por parámetros.

 PlanetasFacade planetasFacade = new PlanetasFacade();

        MatchQuery fts = SearchQuery.match("term")
                //query options:
                .fuzziness(2).field("content");
 SearchQuery query = new SearchQuery("travel-search", fts)
    //will have max 3 hits
    .limit(3)
    //will have a "category" facet on the top 3 countries in terms of hits
    .addFacet("planetas",SearchFacet.term("planetas", 3));

        List<Planetas> list = planetasFacade.fullTexSearch(fts);
        list.forEach((p) -> {
            System.out.println(p.toString());
        });
    }

Last updated