Package org.elasticsearch.search.facet

Examples of org.elasticsearch.search.facet.Facets


        for (int ii = 0; ii < MAX_VAL + 1; ii++) {
            ret.add(null);
        }

        if (rsp != null) {
            Facets facets = rsp.facets();
            if (facets != null)
                for (Facet facet : facets.facets()) {
                    if (facet instanceof TermsFacet) {
                        TermsFacet ff = (TermsFacet) facet;
                        Integer integ = filterToIndex.get(ff.getName());
                        if (integ != null && ff.entries() != null) {
                            List<FacetHelper> list = new ArrayList<FacetHelper>();
View Full Code Here


        }

        if (rsp == null)
            return ret;

        Facets facets = rsp.facets();
        if (facets == null)
            return ret;

        for (Facet facet : facets.facets()) {
            if (facet instanceof TermsFacet) {
                TermsFacet ff = (TermsFacet) facet;
                Integer integ = filterToIndex.get(ff.getName());
                if (integ != null && ff.entries() != null) {
                    List<FacetHelper> list = new ArrayList<FacetHelper>();
View Full Code Here

        SearchHits sh = mock(SearchHits.class);
        when(sh.getTotalHits()).thenReturn(10L);

        SearchResponse sr = mock(SearchResponse.class);
        when(sr.hits()).thenReturn(sh);
        when(sr.facets()).thenReturn(new Facets() {

            @Override
            public List<Facet> facets() {
                throw new UnsupportedOperationException("Not supported yet.");
            }
View Full Code Here

    @Test
    public void testUpdateFacetLinks() {
        FacetPanel panel = (FacetPanel) tester.startPanel(FacetPanel.class);              
        SearchResponse sr = mock(SearchResponse.class);               
        when(sr.facets()).thenReturn(new Facets() {

            @Override
            public List<Facet> facets() {
                Set<InternalStringTermsFacet.StringEntry> entries = new LinkedHashSet();
                entries.add(new InternalStringTermsFacet.StringEntry("de", 3));
View Full Code Here

    public Collection<String> searchTrends(JetwickQuery q, int limit) {
        try {
            q.addFacetField(TAG);
            SearchResponse rsp = query(q);
            Facets facets = rsp.facets();
            if (facets == null)
                return Collections.emptyList();

            Set<String> set = new LinkedHashSet<String>();
            for (Facet facet : facets.facets()) {
                if (facet instanceof TermsFacet) {
                    TermsFacet ff = (TermsFacet) facet;
                    for (TermsFacet.Entry e : ff.entries()) {
                        if (e.count() > limit)
                            set.add(e.getTerm());
View Full Code Here

    private IndexResults<T> toSearchResults(SearchResponse searchResponse) {
        // Get Total Records Found
        long count = searchResponse.getHits().totalHits();

        // Get Facets
        Facets facetsResponse = searchResponse.getFacets();

        // Get List results
        List<T> results = new ArrayList<T>();

        // Loop on each one
View Full Code Here

        // Validation stuff

        public void checkResults(final SearchResponse myResponse) throws IOException {
            _response = myResponse;
            final Facets facets = myResponse.getFacets();
            assertEquals("Found " + facets.facets().size() + " facets instead of 1", 1, facets.facets().size());
            final Facet facet = facets.facet(_facetName);
            assertEquals(queryType(), facet.getType());
            checkEntries(facet);
            checkHeaders(facet);
        }
View Full Code Here

    private IndexResults<T> toSearchResults(SearchResponse searchResponse) {
        // Get Total Records Found
        long count = searchResponse.getHits().totalHits();

        // Get Facets
        Facets facetsResponse = searchResponse.getFacets();

        // Get List results
        List<T> results = new ArrayList<T>();

        // Loop on each one
View Full Code Here

    private IndexResults<T> toSearchResults(SearchResponse searchResponse) {
        // Get Total Records Found
        long count = searchResponse.getHits().totalHits();

        // Get Facets
        Facets facetsResponse = searchResponse.getFacets();

        // Get List results
        List<T> results = new ArrayList<T>();

        // Loop on each one
View Full Code Here

    private IndexResults<T> toSearchResults(SearchResponse searchResponse) {
        // Get Total Records Found
        long count = searchResponse.getHits().totalHits();

        // Get Facets
        Facets facetsResponse = searchResponse.getFacets();

        // Get List results
        List<T> results = new ArrayList<T>();

        // Loop on each one
View Full Code Here

TOP

Related Classes of org.elasticsearch.search.facet.Facets

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.