Examples of QueryResponse


Examples of org.apache.solr.client.solrj.response.QueryResponse

        template.send("direct:start", exchange);
        solrCommit();

        // Check things were indexed.
        QueryResponse response = executeSolrQuery("id:MA147LL/A");

        assertEquals(0, response.getStatus());
        assertEquals(1, response.getResults().getNumFound());

        SolrDocument doc = response.getResults().get(0);
        assertArrayEquals(categories, ((List<?>) doc.getFieldValue("cat")).toArray());
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.response.QueryResponse

        exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
        exchange.getIn().setHeader("SolrField.name", "Apple 60 GB iPod with Video Playback Black");
        exchange.getIn().setHeader("SolrField.manu", "Apple Computer Inc.");
        template.send("direct:start", exchange);

        QueryResponse response = executeSolrQuery("*:*");
        assertEquals(0, response.getStatus());
        assertEquals(0, response.getResults().getNumFound());

        solrCommit();

        QueryResponse afterCommitResponse = executeSolrQuery("*:*");
        assertEquals(0, afterCommitResponse.getStatus());
        assertEquals(1, afterCommitResponse.getResults().getNumFound());
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.response.QueryResponse

        exchange.getIn().setHeader("SolrParam.invalid-param", "this is ignored");

        template.send("direct:start", exchange);
        solrCommit();

        QueryResponse response = executeSolrQuery("*:*");
        assertEquals(0, response.getStatus());
        assertEquals(1, response.getResults().getNumFound());
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.response.QueryResponse

        Exchange exchange = createExchangeWithBody(new File("src/test/resources/data/books.csv"));
        exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
        template.send("direct:start", exchange);
        solrCommit();

        QueryResponse response = executeSolrQuery("*:*");
        assertEquals(0, response.getStatus());
        assertEquals(10, response.getResults().getNumFound());

        response = executeSolrQuery("id:0553573403");
        SolrDocument doc = response.getResults().get(0);
        assertEquals("A Game of Thrones", doc.getFieldValue("name"));
        assertEquals(7.99f, doc.getFieldValue("price"));
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.response.QueryResponse

        exchange.getIn().setHeader("SolrParam.skipLines", 1);

        template.send("direct:start", exchange);
        solrCommit();

        QueryResponse response = executeSolrQuery("*:*");
        assertEquals(0, response.getStatus());
        assertEquals(10, response.getResults().getNumFound());

        SolrDocument doc = response.getResults().get(0);
        assertFalse(doc.getFieldNames().contains("cat"));
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.response.QueryResponse

        exchange.getIn().setHeader("SolrParam.literal.id", "tutorial.pdf");

        template.send("direct:start", exchange);
        solrCommit();

        QueryResponse response = executeSolrQuery("*:*");
        assertEquals(0, response.getStatus());
        assertEquals(1, response.getResults().getNumFound());

        SolrDocument doc = response.getResults().get(0);
        assertEquals("Solr", doc.getFieldValue("subject"));
        assertEquals("tutorial.pdf", doc.getFieldValue("id"));
        assertEquals(Arrays.asList("application/pdf"), doc.getFieldValue("content_type"));
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.response.QueryResponse

        exchange.getIn().setHeader("SolrParam.literal.id", "tutorial.pdf");

        template.send("direct:start", exchange);
        solrCommit();

        QueryResponse response = executeSolrQuery("*:*");
        assertEquals(0, response.getStatus());
        assertEquals(1, response.getResults().getNumFound());

        SolrDocument doc = response.getResults().get(0);
        assertEquals("Solr", doc.getFieldValue("subject"));
        assertEquals("tutorial.pdf", doc.getFieldValue("id"));
        assertEquals(Arrays.asList("application/pdf"), doc.getFieldValue("content_type"));
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.response.QueryResponse

                                + configurationName + "."
                                + RelationPreference.HIDED,
                        RelationPreference.PREFIX_RELATIONPREFERENCES
                                + configurationName + "."
                                + RelationPreference.SELECTED);
        QueryResponse qRes = searcher.search(solrQuery);
        result.setFilterRecords((int) qRes.getResults().getNumFound());
        if (StringUtils.isNotEmpty(userQuery))
        {
            result.setTotalRecords(qRes.getFacetQuery().get("{!ex=user}*:*"));
        }
        else
        {
            result.setTotalRecords((int) qRes.getResults().getNumFound());
        }
        List<Object[]> dsoList = new ArrayList<Object[]>();
        for (SolrDocument doc : qRes.getResults())
        {
            List<String> unlinked = (List<String>) doc
                    .getFieldValue(RelationPreference.PREFIX_RELATIONPREFERENCES
                            + configurationName
                            + "."
View Full Code Here

Examples of org.apache.solr.client.solrj.response.QueryResponse

        Map<String, Integer> result = new HashMap<String, Integer>();

        try
        {
            String query = "a_dept:\"" + from +"\" OR b_dept:\"" + from +"\"";
            QueryResponse rsp = shootQuery(query, true, "focus_dept");           
            FacetField relations = rsp.getFacetField("focus_dept");           
            int otherDPconnected = relations.getValueCount();

           
            query = "a_dept:\"" + from +"\" AND b_dept:\"" + from +"\"";
            rsp = shootQuery(query, true, "focus_auth");           
            relations = rsp.getFacetField("focus_auth");
            int internalRPs = relations.getValueCount();

            query = "a_dept:\"" + from +"\" OR b_dept:\"" + from +"\"";
            rsp = shootQuery(query, true, "focus_auth");           
            relations = rsp.getFacetField("focus_auth");           
            int fromOtherDPconnected = relations.getValueCount();
           
            query = "focus_dept:\"" + from +"|||null\" OR focus_dept:\"null|||" + from +"\"";
            rsp = shootQuery(query, true, "focus_dept");
            relations = rsp.getFacetField("focus_dept")
            int externalRPs = (int)rsp.getResults().getNumFound();
            int externalCardinality = relations.getValueCount();           
           
            //need to remove n row from facet because the first match the department and one or two are matching with external
            otherDPconnected = otherDPconnected - 1 - externalCardinality;
           
View Full Code Here

Examples of org.apache.solr.client.solrj.response.QueryResponse

        {
            solrQuery.setFacet(true);
            solrQuery.setFacetMinCount(1);
            solrQuery.addFacetField(facetField);
        }
        QueryResponse rsp = service.search(solrQuery);       
        return rsp;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.