Package org.vosao.search

Examples of org.vosao.search.SearchResult


  public SearchResult searchFilter(List<String> sections, String text, int start,
      int count, int textSize) {
    String query = text.toLowerCase();
    String language = getBusiness().getLanguage();
    String defaultLanguage = getBusiness().getDefaultLanguage();
    SearchResult result = getBusiness().getSearchEngine().search(
        new SectionSearchFilter(sections),
        query, start, count, language, textSize);
   
    if (!language.equals(defaultLanguage)) {
      SearchResult enResult = getBusiness().getSearchEngine().search(
          new SectionSearchFilter(sections),
          query, start, count, defaultLanguage, textSize);
     
      for (Hit hit : enResult.getHits()) {
        hit.setLocalTitle(hit.getTitle());
        hit.setUrl(hit.getUrl() + "?language=" + defaultLanguage);
      }
      result.setCount(result.getCount() + enResult.getCount());
      result.getHits().addAll(enResult.getHits());
    }
    return result;
  }
View Full Code Here


        hits.addAll(getSearchIndex(lang.getCode()).search(filter, query,
            textSize));
      }
    }
    // paginate result and return
    SearchResult result = new SearchResult();
    result.setCount(hits.size());
    int startIndex = start < hits.size() ? start : hits.size();
    int endIndex = startIndex + count;
    if (count == -1) {
      endIndex = hits.size();
    }
    if (endIndex > hits.size()) {
      endIndex = hits.size();
    }
    result.setHits(ListUtil.slice(hits, startIndex, count));
    return result;
  }
View Full Code Here

TOP

Related Classes of org.vosao.search.SearchResult

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.