Package org.apache.solr.client.solrj

Examples of org.apache.solr.client.solrj.SolrServer.query()


        assertEquals(1, res.getResults().size());
        byte[] storedImageData = (byte[])res.getResults().get(0).getFieldValue("image");
        assertEquals(imageData, storedImageData);
       
        params.set(CommonParams.Q, "cat:Japanese");
        res = solrServer.query(params);
        assertEquals(1, res.getResults().size());
       
        params.set(CommonParams.Q, "cat:Chinese");
        res = solrServer.query(params);
        assertEquals(1, res.getResults().size());
View Full Code Here


        params.set(CommonParams.Q, "cat:Japanese");
        res = solrServer.query(params);
        assertEquals(1, res.getResults().size());
       
        params.set(CommonParams.Q, "cat:Chinese");
        res = solrServer.query(params);
        assertEquals(1, res.getResults().size());
        storedImageData = (byte[])res.getResults().get(0).getFieldValue("image");
        assertEquals(imageData, storedImageData);
       
        params.set(CommonParams.Q, "bogus");
View Full Code Here

        assertEquals(1, res.getResults().size());
        storedImageData = (byte[])res.getResults().get(0).getFieldValue("image");
        assertEquals(imageData, storedImageData);
       
        params.set(CommonParams.Q, "bogus");
        res = solrServer.query(params);
        assertEquals(0, res.getResults().size());
    }


    private static void assertEquals(byte[] expected, byte[] actual) {
View Full Code Here

        SolrQuery solrQuery = new SolrQuery();
        solrQuery.set("df", "name");
        solrQuery.setQuery(name);
        solrQuery.set("fl", "lily.id");

        QueryResponse response = solr.query(solrQuery);
        // Convert query result into a list of record IDs
        SolrDocumentList solrDocumentList = response.getResults();
        List<RecordId> recordIds = new ArrayList<RecordId>();
        for (SolrDocument solrDocument : solrDocumentList) {
            String recordId = (String) solrDocument.getFirstValue("lily.id");
View Full Code Here

        SolrQuery solrQuery = new SolrQuery();
        //set default search field (no longer supported in schema.xml
        solrQuery.set("df", "name");
        solrQuery.setQuery(name);
        solrQuery.set("fl", "lily.id");
        QueryResponse response = solr.query(solrQuery);
        // Convert query result into a list of record IDs
        SolrDocumentList solrDocumentList = response.getResults();
        List<RecordId> recordIds = new ArrayList<RecordId>();
        for (SolrDocument solrDocument : solrDocumentList) {
            String recordId = (String) solrDocument.getFirstValue("lily.id");
View Full Code Here

        return results.getNumFound();
    }

    private SolrDocumentList getAllDocs(String coreName) throws SolrServerException {
        SolrServer server = lilyProxy.getSolrProxy().getSolrServer(coreName);
        QueryResponse queryResponse = server.query(new MapSolrParams(of("q", "*:*")));
        return queryResponse.getResults();
    }

    private void createRecord(LRepository repo, String recId, String fieldData) throws Exception {
        repo.getDefaultTable().recordBuilder()
View Full Code Here

      solrQuery.setFields(SolrConstants.ID_FIELD);
      solrQuery.setRows(1);

      QueryResponse response;
      try {
        response = solr.query(solrQuery);
      } catch (final SolrServerException e) {
        throw new IOException(e);
      }

      int numResults = (int)response.getResults().getNumFound();
View Full Code Here

      solrQuery.setStart(solrSplit.getDocBegin());
      solrQuery.setRows(numDocs);

      QueryResponse response;
      try {
        response = solr.query(solrQuery);
      } catch (final SolrServerException e) {
        throw new IOException(e);
      }

      final SolrDocumentList solrDocs = response.getResults();
View Full Code Here

    query.setRows(10);
    query.setFilterQueries("cool");
    query.set(FacetParams.FACET_QUERY, "color:red");
    BoboRequestBuilder.applyFacetExpand(query, "color", true);
   
    QueryResponse res = solrSvr.query(query);
   
    SolrDocumentList results = res.getResults();
    long numFound = results.getNumFound();
    System.out.println("num hits: "+numFound);
    for (SolrDocument doc : results){
View Full Code Here

      solrQuery.setFields(SolrConstants.ID_FIELD);
      solrQuery.setRows(1);

      QueryResponse response;
      try {
        response = solr.query(solrQuery);
      } catch (final SolrServerException e) {
        throw new IOException(e);
      }

      int numResults = (int)response.getResults().getNumFound();
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.