Examples of SolrQuery


Examples of com.netfever.site.dynovisz.web.spring.data.SolrQuery

import com.netfever.site.dynovisz.web.utils.Cache;

public final class SearchFormToSolQuery implements Adapter<SearchForm, SolrQuery> {
  @Override
  public SolrQuery adapt(SearchForm in) {
    final SolrQuery res = new SolrQuery();

    String category = Cache.getCategories().get(new Integer(in.getCategory()));
    res.setCategory(category);

    res.setStartDate(in.getStartDateAsDate());
    res.setEndDate(in.getEndDateAsDate());
   
    res.setLanguage(in.getLanguage());
   
    try {
      final int page = Integer.parseInt(in.getPage());
      res.setPage(page);
    } catch (NumberFormatException e) {
      res.setPage(1);
    }
   
    res.setQuery(in.getQuery());
             
    if (in.getSafeSortBy().equals("R")) {
      res.setSortedBy(SortedBy.VIDEO_DATE);
    } else {
      res.setSortedBy(SortedBy.NUMBER_OF_VIEW);     
    }

    res.setWithcomments(in.isWithcomments());
   
    return res;
  }
View Full Code Here

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

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

    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

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

        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

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

    }
  }
 
  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

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

     * @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

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

        /*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

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

 
  @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

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

    } 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

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

    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
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.