Package com.netfever.site.dynovisz.web.spring.data

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


      @ModelAttribute("searchForm") SearchForm searchForm,
      @ModelAttribute("categories") TreeMap<Integer, String> categories,
      @ModelAttribute("languages") TreeMap<String, String> languages,
      @ModelAttribute("pageForm") PageForm pageForm,
      BindingResult result) throws IOException {
    final SolrQuery solrQuery = SOLR_QUERY_ADP.adapt(searchForm);
   
    String s;
   
    final String url = solrQuery.toString();
    try {
      s = HttpUtils.get(url);
    } catch (IOException e) {
      LOG.log(Level.WARNING, "Call to SOLR: " + url + " failed with " + e.getMessage(), e);
      throw e;
View Full Code Here

TOP

Related Classes of com.netfever.site.dynovisz.web.spring.data.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.