Package org.apache.solr.client.solrj

Examples of org.apache.solr.client.solrj.SolrQuery


public class BoboSolrTestCase extends TestCase {

  public void testFacetExpand() throws Exception{
    String fakeField = "fake";
    SolrQuery solrQ = new SolrQuery();
   
    BoboRequestBuilder.applyFacetExpand(solrQ, fakeField, true);
    assertTrue(BoboRequestBuilder.isFacetExpand(solrQ, fakeField));
   
    solrQ = new SolrQuery();
    BoboRequestBuilder.applyFacetExpand(solrQ, fakeField, false);
    assertFalse(BoboRequestBuilder.isFacetExpand(solrQ, fakeField));
  }
View Full Code Here


    assertFalse(BoboRequestBuilder.isFacetExpand(solrQ, fakeField));
  }
 
  public void testSelectionOperation() throws Exception{
    String fakeField = "fake";
    SolrQuery solrQ = new SolrQuery();
   
    ValueOperation op = ValueOperation.ValueOperationAnd;
    BoboRequestBuilder.applySelectionOperation(solrQ, fakeField, op);
    assertEquals(op,BoboRequestBuilder.getSelectionOperation(solrQ, fakeField));
   
    solrQ = new SolrQuery();
        op = ValueOperation.ValueOperationOr;
        BoboRequestBuilder.applySelectionOperation(solrQ, fakeField, op);
        assertEquals(op,BoboRequestBuilder.getSelectionOperation(solrQ, fakeField));
  }
View Full Code Here

        assertEquals(op,BoboRequestBuilder.getSelectionOperation(solrQ, fakeField));
  }
 
  public void testSelectionNots() throws Exception{
    String fakeField = "fake";
    SolrQuery solrQ = new SolrQuery();
   
    HashSet<String> set = new HashSet<String>();
    set.add("s1");
    set.add("s2");
   
View Full Code Here

    }
  }
 
  public void testSelectionProps() throws Exception{
    String fakeField = "fake";
    SolrQuery solrQ = new SolrQuery();
   
    HashMap<String,String> prop = new HashMap<String,String>();
    prop.put("p1","v1");
    prop.put("p2","v2");
   
View Full Code Here

     * @param querystring
     * @throws IOException
     */
    public SolrDocumentList get(final String querystring, final int offset, final int count) throws IOException {
        // construct query
        final SolrQuery query = new SolrQuery();
        query.setQuery(querystring);
        query.setRows(count);
        query.setStart(offset);
        //query.addSortField( "price", SolrQuery.ORDER.asc );

        // query the server
        //SearchResult result = new SearchResult(count);
        try {
View Full Code Here

        /*ModifiableSolrParams params = new ModifiableSolrParams();
        params.set("q", query);

            QueryResponse response = server.query(params);*/
    logger.debug("Solr query terms: " + query);
      SolrQuery queryObj = new SolrQuery();
      queryObj.setQuery(query);
      QueryResponse response = null;
      try {
        response = server.query(queryObj);
      } catch (Exception e){
        logger.error(e.getMessage());
View Full Code Here

 
  @Override
  public SolrRecord getAllLayerInfo(String layerId) throws SolrServerException{
    String query = "LayerId:" + layerId.trim();
      SolrQuery queryObj = new SolrQuery();
      queryObj.setQuery( query );
    List<SolrRecord> results = solrClient.getSolrServer().query(queryObj).getBeans(SolrRecord.class);
    return results.get(0);
  }
View Full Code Here

    } else {
      this.layerId = null;
      return null;
    }

    SolrQuery query = new SolrQuery();
    query.setQuery( descriptor + ":" + identifier );
    query.addField("FgdcText");
    query.setRows(1);
   
     SolrDocumentList docs = this.solrClient.getSolrServer().query(query).getResults();
     return (String) docs.get(0).getFieldValue("FgdcText");
  }
View Full Code Here

    return size;
  }
 
  private QueryResponse query(String query) throws SolrServerException, IOException {
    commit();
    QueryResponse rsp = solrServer.query(new SolrQuery(query).setRows(Integer.MAX_VALUE));
    LOGGER.debug("rsp: {}", rsp);
    return rsp;
  }
View Full Code Here

      client.commit();
    }

    // Query the documents
    {
      SolrQuery query = new SolrQuery();
      query.setQuery("units_i:2");
      query.addSortField("value_i", SolrQuery.ORDER.asc);
      query.setRows(Integer.MAX_VALUE);

      QueryResponse response = client.query(query);
      SolrDocumentList results = response.getResults();
      Assert.assertEquals(results.getNumFound(), docCount / 10);
      for (int i = 0; i < results.size(); i++) {
View Full Code Here

TOP

Related Classes of org.apache.solr.client.solrj.SolrQuery

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.