Package com.sun.syndication.feed.module.opensearch.impl

Examples of com.sun.syndication.feed.module.opensearch.impl.OpenSearchModuleImpl


    List<Module> mods = null;
    mods = feed.getModules();
    if(mods == null){
      mods = new ArrayList<Module>();
    }
    OpenSearchModule osm = new OpenSearchModuleImpl();
    osm.setItemsPerPage(itemsPerPage);
    osm.setStartIndex(startIdx);
    osm.setTotalResults(totalResult);
    if(searchDescriptionUrl != null){
      Link link = new Link();
      link.setHref(searchDescriptionUrl);
      link.setType("application/opensearchdescription+xml");
      osm.setLink(link);
    }
    mods.add(osm);
    feed.setModules(mods);
    return feed;
  }
View Full Code Here


     * @param searchResult
     * @param searchString
     */
    private void setFeedModules(SyndFeed feed, SearchResponse searchResult, String searchString) {

        OpenSearchModuleImpl osm = new OpenSearchModuleImpl();

        osm.setStartIndex(1);
        osm.setTotalResults(searchResult.getResults().size());
        osm.setItemsPerPage(50);

        Link link = new Link();
        link.setHref("http://www.jahia.org/opensearch-description.xml");
        link.setType("application/opensearchdescription+xml");
        link.setTitle("Jahia Open Search");
        osm.setLink(link);

        OSQuery query = new OSQuery();
        query.setRole("request");
        query.setSearchTerms(searchString);
        osm.addQuery(query);

        List<OpenSearchModule> modules = feed.getModules();
        modules.add(osm);
        feed.setModules(modules);
    }
View Full Code Here

     * @param qRes the search results
     * @return module
     */
    private static OpenSearchModule openSearchMarkup(String query, QueryResults qRes)
    {
      OpenSearchModule osMod = new OpenSearchModuleImpl();
      osMod.setTotalResults(qRes.getHitCount());
      osMod.setStartIndex(qRes.getStart());
      osMod.setItemsPerPage(qRes.getPageSize());
      OSQuery osq = new OSQuery();
      osq.setRole("request");
        try
        {
            osq.setSearchTerms(URLEncoder.encode(query, "UTF-8"));
          }
        catch(UnsupportedEncodingException e)
          {
            log.error(e);
          }
        osq.setStartPage(1 + (qRes.getStart() / qRes.getPageSize()));
        osMod.addQuery(osq);
        return osMod;
          }
View Full Code Here

     * @param qRes the search results
     * @return module
     */
    private static OpenSearchModule openSearchMarkup(String query, int totalResults, int start, int pageSize)
    {
      OpenSearchModule osMod = new OpenSearchModuleImpl();
      osMod.setTotalResults(totalResults);
      osMod.setStartIndex(start);
      osMod.setItemsPerPage(pageSize);
      OSQuery osq = new OSQuery();
      osq.setRole("request");
        try
        {
            osq.setSearchTerms(URLEncoder.encode(query, "UTF-8"));
        }
        catch(UnsupportedEncodingException e)
        {
            log.error(e);
        }
        osq.setStartPage(1 + (start / pageSize));
        osMod.addQuery(osq);
        return osMod;
    }
View Full Code Here

TOP

Related Classes of com.sun.syndication.feed.module.opensearch.impl.OpenSearchModuleImpl

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.