//# 0 errors, 217 messages
//#

    //#searchapihandler.java:1:1: class: net.sourceforge.pebble.webservice.SearchAPIHandler
package net.sourceforge.pebble.webservice;

import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import net.sourceforge.pebble.domain.Blog;
import net.sourceforge.pebble.domain.BlogEntry;
import net.sourceforge.pebble.domain.BlogService;
import net.sourceforge.pebble.domain.Category;
import net.sourceforge.pebble.search.SearchHit;
import net.sourceforge.pebble.search.SearchResults;
import net.sourceforge.pebble.util.Pageable;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


/**
 * Extension to allow search and query of Blog posting via XML-RPC.
 *
 * @author tcp@favoritemedium.com
 */
public class SearchAPIHandler extends AbstractAPIHandler {
    //#searchapihandler.java:27: method: void net.sourceforge.pebble.webservice.SearchAPIHandler.net.sourceforge.pebble.webservice.SearchAPIHandler()
    //#input(void net.sourceforge.pebble.webservice.SearchAPIHandler()): this
    //#searchapihandler.java:27: end of method: void net.sourceforge.pebble.webservice.SearchAPIHandler.net.sourceforge.pebble.webservice.SearchAPIHandler()

    static final String URL = "url";
    static final String BLOG_ID = "blogid";
    static final String BLOG_NAME = "blogName";
    static final String DATE_CREATED = "dateCreated";
    static final String USER_ID = "userId";
    static final String POST_ID = "postid";
    static final String CONTENT = "content";

    static final String TITLE_START_DELIMITER = "<title>";
    static final String TITLE_END_DELIMITER = "</title>";
    static final String CATEGORY_START_DELIMITER = "<category>";
    static final String CATEGORY_END_DELIMITER = "</category>";
    static final char BLOG_ID_SEPARATOR = '/';

    static final int PAGE_SIZE = 20;


    /** the log used by this class */
    private static Log log = LogFactory.getLog(SearchAPIHandler.class);
    //#searchapihandler.java:47: method: net.sourceforge.pebble.webservice.SearchAPIHandler.net.sourceforge.pebble.webservice.SearchAPIHandler__static_init
    //#searchapihandler.java:47: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: net.sourceforge.pebble.webservice.SearchAPIHandler__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Descendant_Table[net/sourceforge/pebble/webservice/SearchAPIHandler]
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.adaptBlogEntry(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/util/Hashtable;
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.authenticate(Lnet/sourceforge/pebble/domain/Blog;Ljava/lang/String;Ljava/lang/String;)V
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.formatPostId(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.getAuthenticationManager()Lorg/acegisecurity/AuthenticationManager;
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.getBlogWithBlogId(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Blog;
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.getBlogWithPostId(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Blog;
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.getPostId(Ljava/lang/String;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.search(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Vector;
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.search(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;II)Ljava/util/Vector;
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.searchResultSummary(Ljava/util/List;Ljava/lang/String;Ljava/lang/String;II)Ljava/util/Map;
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.setAuthenticationManager(Lorg/acegisecurity/AuthenticationManager;)V
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): log
    //#output(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): net/sourceforge/pebble/webservice/AbstractAPIHandler.__Descendant_Table[net/sourceforge/pebble/webservice/SearchAPIHandler]
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Descendant_Table[net/sourceforge/pebble/webservice/SearchAPIHandler] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): net/sourceforge/pebble/webservice/AbstractAPIHandler.__Descendant_Table[net/sourceforge/pebble/webservice/SearchAPIHandler] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.adaptBlogEntry(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/util/Hashtable; == &adaptBlogEntry
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.authenticate(Lnet/sourceforge/pebble/domain/Blog;Ljava/lang/String;Ljava/lang/String;)V == &net/sourceforge/pebble/webservice/AbstractAPIHandler.authenticate
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.formatPostId(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; == &net/sourceforge/pebble/webservice/AbstractAPIHandler.formatPostId
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.getAuthenticationManager()Lorg/acegisecurity/AuthenticationManager; == &net/sourceforge/pebble/webservice/AbstractAPIHandler.getAuthenticationManager
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.getBlogWithBlogId(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Blog; == &net/sourceforge/pebble/webservice/AbstractAPIHandler.getBlogWithBlogId
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.getBlogWithPostId(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Blog; == &net/sourceforge/pebble/webservice/AbstractAPIHandler.getBlogWithPostId
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.getPostId(Ljava/lang/String;)Ljava/lang/String; == &net/sourceforge/pebble/webservice/AbstractAPIHandler.getPostId
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.search(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Vector; == &search
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.search(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;II)Ljava/util/Vector; == &search
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.searchResultSummary(Ljava/util/List;Ljava/lang/String;Ljava/lang/String;II)Ljava/util/Map; == &searchResultSummary
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): __Dispatch_Table.setAuthenticationManager(Lorg/acegisecurity/AuthenticationManager;)V == &net/sourceforge/pebble/webservice/AbstractAPIHandler.setAuthenticationManager
    //#post(net.sourceforge.pebble.webservice.SearchAPIHandler__static_init): init'ed(log)
    //#searchapihandler.java:47: end of method: net.sourceforge.pebble.webservice.SearchAPIHandler.net.sourceforge.pebble.webservice.SearchAPIHandler__static_init


    /**
     * Search blog for specific string.
     * 
     * @param blogid    the ID of the blog (ignored)
     * @param username  the username used for logging in via XML-RPC
     * @param password  the password used for logging in via XML-RPC
     */
    public Vector search(String blogid, String username, String password, 
                        String searchString, String sortBy) {
        log.debug("search.search(" +
    //#searchapihandler.java:59: method: Vector net.sourceforge.pebble.webservice.SearchAPIHandler.search(String, String, String, String, String)
    //#searchapihandler.java:59: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    //#input(Vector search(String, String, String, String, String)): __Descendant_Table[net/sourceforge/pebble/webservice/SearchAPIHandler]
    //#input(Vector search(String, String, String, String, String)): __Descendant_Table[others]
    //#input(Vector search(String, String, String, String, String)): __Dispatch_Table.formatPostId(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //#input(Vector search(String, String, String, String, String)): __Dispatch_Table.getBlogWithBlogId(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Blog;
    //#input(Vector search(String, String, String, String, String)): blogid
    //#input(Vector search(String, String, String, String, String)): log
    //#input(Vector search(String, String, String, String, String)): searchString
    //#input(Vector search(String, String, String, String, String)): sortBy
    //#input(Vector search(String, String, String, String, String)): this
    //#input(Vector search(String, String, String, String, String)): this.__Tag
    //#input(Vector search(String, String, String, String, String)): username
    //#output(Vector search(String, String, String, String, String)): new Vector(search#2) num objects
    //#output(Vector search(String, String, String, String, String)): return_value
    //#new obj(Vector search(String, String, String, String, String)): new Vector(search#2)
    //#pre[2] (Vector search(String, String, String, String, String)): log != null
    //#pre[6] (Vector search(String, String, String, String, String)): (soft) this.__Tag == net/sourceforge/pebble/webservice/SearchAPIHandler
    //#presumption(Vector search(String, String, String, String, String)): java.util.Iterator:next(...)@80 != null
    //#presumption(Vector search(String, String, String, String, String)): net.sourceforge.pebble.domain.Blog:getSearchIndex(...)@69 != null
    //#presumption(Vector search(String, String, String, String, String)): net.sourceforge.pebble.domain.BlogService:getBlogEntry(...)@81 != null
    //#presumption(Vector search(String, String, String, String, String)): net.sourceforge.pebble.index.SearchIndex:search(...)@69 != null
    //#presumption(Vector search(String, String, String, String, String)): net.sourceforge.pebble.search.SearchResults:getHits(...)@77 != null
    //#post(Vector search(String, String, String, String, String)): return_value == &new Vector(search#2)
    //#post(Vector search(String, String, String, String, String)): new Vector(search#2) num objects == 1
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.util.Hashtable
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.util.List:size
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.lang.Integer:valueOf
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getCategories
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.util.Set:iterator
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.lang.String:valueOf
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.Category:getId
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getDate
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:java.util.Hashtable:put
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getAuthor
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getBlog
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getId
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getId
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:formatPostId
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getTitle
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getBody
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:org.apache.xmlrpc.XmlRpcException
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.BlogManager:getInstance
    //#unanalyzed(Vector search(String, String, String, String, String)): Effects-of-calling:net.sourceforge.pebble.domain.BlogManager:getBlog
    //#test_vector(Vector search(String, String, String, String, String)): sortBy: Addr_Set{null}, Inverse{null}
    //#test_vector(Vector search(String, String, String, String, String)): java.lang.String:equalsIgnoreCase(...)@71: {0}, {1}
    //#test_vector(Vector search(String, String, String, String, String)): java.util.Iterator:hasNext(...)@80: {1}, {0}
            blogid + ", " +
            username + ", xxxxxx, \"" +
            searchString + "," + 
            sortBy + "\")");

        Vector posts = new Vector();
        try {

            Blog blog = getBlogWithBlogId(blogid);
            SearchResults result = blog.getSearchIndex().search( searchString );
    //#searchapihandler.java:69: Warning: method not available
    //#    -- call on SearchIndex net.sourceforge.pebble.domain.Blog:getSearchIndex()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: SearchIndex net.sourceforge.pebble.domain.Blog:getSearchIndex()
    //#searchapihandler.java:69: Warning: method not available
    //#    -- call on SearchResults net.sourceforge.pebble.index.SearchIndex:search(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: SearchResults net.sourceforge.pebble.index.SearchIndex:search(String)

            if ( sortBy != null && sortBy.equalsIgnoreCase("date") ) {
                result.sortByDateDescending();
    //#searchapihandler.java:72: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.search.SearchResults:sortByDateDescending()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: void net.sourceforge.pebble.search.SearchResults:sortByDateDescending()
            } else {
                result.sortByScoreDescending();
    //#searchapihandler.java:74: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.search.SearchResults:sortByScoreDescending()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: void net.sourceforge.pebble.search.SearchResults:sortByScoreDescending()
            }

            List<SearchHit> hits = result.getHits();
    //#searchapihandler.java:77: Warning: method not available
    //#    -- call on List net.sourceforge.pebble.search.SearchResults:getHits()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: List net.sourceforge.pebble.search.SearchResults:getHits()
            BlogService service = new BlogService();
    //#searchapihandler.java:78: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService()

            for (SearchHit hit : hits) {
                BlogEntry entry = service.getBlogEntry(hit.getBlog(), hit.getId());
    //#searchapihandler.java:81: Warning: method not available
    //#    -- call on Blog net.sourceforge.pebble.search.SearchHit:getBlog()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: Blog net.sourceforge.pebble.search.SearchHit:getBlog()
    //#searchapihandler.java:81: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.search.SearchHit:getId()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: String net.sourceforge.pebble.search.SearchHit:getId()
    //#searchapihandler.java:81: Warning: method not available
    //#    -- call on BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
                adaptBlogEntry(entry);
                posts.add(adaptBlogEntry(entry));
            }
            posts.add( searchResultSummary(hits, sortBy, searchString, 0, 0) );

        } catch (Exception ex) {
            log.error(ex);
    //#searchapihandler.java:88: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
        }
        return posts;
    //#searchapihandler.java:90: end of method: Vector net.sourceforge.pebble.webservice.SearchAPIHandler.search(String, String, String, String, String)
    }

    /**
     * Search blog for specific string with pagable parameters
     * 
     * @param blogid    the ID of the blog (ignored)
     * @param username  the username used for logging in via XML-RPC
     * @param password  the password used for logging in via XML-RPC
     */
    public Vector search(String blogid, String username, String password, 
                        String searchString, String sortBy, int pageSize, int offset) {
        log.debug("search.search(" +
    //#searchapihandler.java:102: method: Vector net.sourceforge.pebble.webservice.SearchAPIHandler.search(String, String, String, String, String, int, int)
    //#searchapihandler.java:102: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    //#input(Vector search(String, String, String, String, String, int, int)): __Descendant_Table[net/sourceforge/pebble/webservice/SearchAPIHandler]
    //#input(Vector search(String, String, String, String, String, int, int)): __Descendant_Table[others]
    //#input(Vector search(String, String, String, String, String, int, int)): __Dispatch_Table.formatPostId(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //#input(Vector search(String, String, String, String, String, int, int)): __Dispatch_Table.getBlogWithBlogId(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Blog;
    //#input(Vector search(String, String, String, String, String, int, int)): blogid
    //#input(Vector search(String, String, String, String, String, int, int)): log
    //#input(Vector search(String, String, String, String, String, int, int)): offset
    //#input(Vector search(String, String, String, String, String, int, int)): pageSize
    //#input(Vector search(String, String, String, String, String, int, int)): searchString
    //#input(Vector search(String, String, String, String, String, int, int)): sortBy
    //#input(Vector search(String, String, String, String, String, int, int)): this
    //#input(Vector search(String, String, String, String, String, int, int)): this.__Tag
    //#input(Vector search(String, String, String, String, String, int, int)): username
    //#output(Vector search(String, String, String, String, String, int, int)): new Vector(search#2) num objects
    //#output(Vector search(String, String, String, String, String, int, int)): return_value
    //#new obj(Vector search(String, String, String, String, String, int, int)): new Vector(search#2)
    //#pre[2] (Vector search(String, String, String, String, String, int, int)): log != null
    //#pre[8] (Vector search(String, String, String, String, String, int, int)): (soft) this.__Tag == net/sourceforge/pebble/webservice/SearchAPIHandler
    //#presumption(Vector search(String, String, String, String, String, int, int)): java.util.Iterator:next(...)@132 != null
    //#presumption(Vector search(String, String, String, String, String, int, int)): net.sourceforge.pebble.domain.Blog:getSearchIndex(...)@113 != null
    //#presumption(Vector search(String, String, String, String, String, int, int)): net.sourceforge.pebble.domain.BlogService:getBlogEntry(...)@133 != null
    //#presumption(Vector search(String, String, String, String, String, int, int)): net.sourceforge.pebble.index.SearchIndex:search(...)@113 != null
    //#presumption(Vector search(String, String, String, String, String, int, int)): net.sourceforge.pebble.util.Pageable:getListForPage(...)@128 != null
    //#post(Vector search(String, String, String, String, String, int, int)): return_value == &new Vector(search#2)
    //#post(Vector search(String, String, String, String, String, int, int)): new Vector(search#2) num objects == 1
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.util.Hashtable
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.util.List:size
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.lang.Integer:valueOf
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getCategories
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.util.Set:iterator
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.lang.String:valueOf
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.Category:getId
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getDate
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:java.util.Hashtable:put
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getAuthor
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getBlog
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getId
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getId
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:formatPostId
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getTitle
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getBody
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:org.apache.xmlrpc.XmlRpcException
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.BlogManager:getInstance
    //#unanalyzed(Vector search(String, String, String, String, String, int, int)): Effects-of-calling:net.sourceforge.pebble.domain.BlogManager:getBlog
    //#test_vector(Vector search(String, String, String, String, String, int, int)): pageSize: {1..4_294_967_295}, {-2_147_483_648..0}
    //#test_vector(Vector search(String, String, String, String, String, int, int)): sortBy: Addr_Set{null}, Inverse{null}
    //#test_vector(Vector search(String, String, String, String, String, int, int)): java.lang.String:equalsIgnoreCase(...)@115: {0}, {1}
    //#test_vector(Vector search(String, String, String, String, String, int, int)): java.util.Iterator:hasNext(...)@132: {1}, {0}
            blogid + ", " +
            username + ", xxxxxx, \"" +
            searchString + "," + 
            sortBy + "\")");


        Vector posts = new Vector();
        try {

            Blog blog = getBlogWithBlogId(blogid);
            SearchResults result = blog.getSearchIndex().search( searchString );
    //#searchapihandler.java:113: Warning: method not available
    //#    -- call on SearchIndex net.sourceforge.pebble.domain.Blog:getSearchIndex()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: SearchIndex net.sourceforge.pebble.domain.Blog:getSearchIndex()
    //#searchapihandler.java:113: Warning: method not available
    //#    -- call on SearchResults net.sourceforge.pebble.index.SearchIndex:search(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: SearchResults net.sourceforge.pebble.index.SearchIndex:search(String)
            
            if ( sortBy != null && sortBy.equalsIgnoreCase("date") ) {
                result.sortByDateDescending();
    //#searchapihandler.java:116: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.search.SearchResults:sortByDateDescending()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: void net.sourceforge.pebble.search.SearchResults:sortByDateDescending()
            } else {
                result.sortByScoreDescending();
    //#searchapihandler.java:118: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.search.SearchResults:sortByScoreDescending()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: void net.sourceforge.pebble.search.SearchResults:sortByScoreDescending()
            }

            if ( pageSize <= 0 ) 
                pageSize = PAGE_SIZE;

            List<SearchHit> hits = result.getHits();
    //#searchapihandler.java:124: Warning: method not available
    //#    -- call on List net.sourceforge.pebble.search.SearchResults:getHits()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: List net.sourceforge.pebble.search.SearchResults:getHits()
            Pageable pageable = new Pageable(hits);
    //#searchapihandler.java:125: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.util.Pageable(List)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: void net.sourceforge.pebble.util.Pageable(List)
            pageable.setPageSize(pageSize);
    //#searchapihandler.java:126: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.util.Pageable:setPageSize(int)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: void net.sourceforge.pebble.util.Pageable:setPageSize(int)
            pageable.setPage(offset);
    //#searchapihandler.java:127: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.util.Pageable:setPage(int)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: void net.sourceforge.pebble.util.Pageable:setPage(int)
            List<SearchHit> subList = pageable.getListForPage();
    //#searchapihandler.java:128: Warning: method not available
    //#    -- call on List net.sourceforge.pebble.util.Pageable:getListForPage()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: List net.sourceforge.pebble.util.Pageable:getListForPage()

            BlogService service = new BlogService();
    //#searchapihandler.java:130: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService()

            for (SearchHit hit : subList ) {
                BlogEntry entry = service.getBlogEntry(hit.getBlog(), hit.getId());
    //#searchapihandler.java:133: Warning: method not available
    //#    -- call on Blog net.sourceforge.pebble.search.SearchHit:getBlog()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: Blog net.sourceforge.pebble.search.SearchHit:getBlog()
    //#searchapihandler.java:133: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.search.SearchHit:getId()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: String net.sourceforge.pebble.search.SearchHit:getId()
    //#searchapihandler.java:133: Warning: method not available
    //#    -- call on BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
                adaptBlogEntry(entry);
                posts.add(adaptBlogEntry(entry));
            }
            posts.add( searchResultSummary(subList, sortBy, searchString, pageSize, offset) );

        } catch (Exception ex) {
            log.error(ex);
    //#searchapihandler.java:140: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Vector search(String, String, String, String, String, int, int)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
        }
        return posts;
    //#searchapihandler.java:142: end of method: Vector net.sourceforge.pebble.webservice.SearchAPIHandler.search(String, String, String, String, String, int, int)
    }

    /**
     * Helper method to adapt a blog entry into an XML-RPC compatible struct.
     * Since the Blogger API doesn't support titles, the title is wrapped in
     * &lt;title&gt;&lt;/title&gt; tags.
     *
     * @param entry   the BlogEntry to adapt
     * @return  a Hashtable representing the major properties of the entry
     */
    private Hashtable adaptBlogEntry(BlogEntry entry) {
        Hashtable post = new Hashtable();
    //#searchapihandler.java:154: method: Hashtable net.sourceforge.pebble.webservice.SearchAPIHandler.adaptBlogEntry(BlogEntry)
    //#input(Hashtable adaptBlogEntry(BlogEntry)): __Descendant_Table[net/sourceforge/pebble/webservice/SearchAPIHandler]
    //#input(Hashtable adaptBlogEntry(BlogEntry)): __Descendant_Table[others]
    //#input(Hashtable adaptBlogEntry(BlogEntry)): __Dispatch_Table.formatPostId(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //#input(Hashtable adaptBlogEntry(BlogEntry)): entry
    //#input(Hashtable adaptBlogEntry(BlogEntry)): this
    //#input(Hashtable adaptBlogEntry(BlogEntry)): this.__Tag
    //#output(Hashtable adaptBlogEntry(BlogEntry)): new Hashtable(adaptBlogEntry#1) num objects
    //#output(Hashtable adaptBlogEntry(BlogEntry)): return_value
    //#new obj(Hashtable adaptBlogEntry(BlogEntry)): new Hashtable(adaptBlogEntry#1)
    //#pre[1] (Hashtable adaptBlogEntry(BlogEntry)): entry != null
    //#pre[3] (Hashtable adaptBlogEntry(BlogEntry)): this.__Tag == net/sourceforge/pebble/webservice/SearchAPIHandler
    //#presumption(Hashtable adaptBlogEntry(BlogEntry)): java.util.Iterator:next(...)@158 != null
    //#presumption(Hashtable adaptBlogEntry(BlogEntry)): net.sourceforge.pebble.domain.BlogEntry:getBlog(...)@166 != null
    //#presumption(Hashtable adaptBlogEntry(BlogEntry)): net.sourceforge.pebble.domain.BlogEntry:getCategories(...)@156 != null
    //#post(Hashtable adaptBlogEntry(BlogEntry)): return_value == &new Hashtable(adaptBlogEntry#1)
    //#post(Hashtable adaptBlogEntry(BlogEntry)): new Hashtable(adaptBlogEntry#1) num objects == 1
    //#unanalyzed(Hashtable adaptBlogEntry(BlogEntry)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(Hashtable adaptBlogEntry(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(Hashtable adaptBlogEntry(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(Hashtable adaptBlogEntry(BlogEntry)): Effects-of-calling:java.lang.String:valueOf
    //#test_vector(Hashtable adaptBlogEntry(BlogEntry)): java.util.Iterator:hasNext(...)@157: {1}, {0}
    //#test_vector(Hashtable adaptBlogEntry(BlogEntry)): java.util.Iterator:hasNext(...)@160: {0}, {1}
        String categories = "";
        Iterator it = entry.getCategories().iterator();
    //#searchapihandler.java:156: Warning: method not available
    //#    -- call on Set net.sourceforge.pebble.domain.BlogEntry:getCategories()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Hashtable adaptBlogEntry(BlogEntry)
    //#    unanalyzed callee: Set net.sourceforge.pebble.domain.BlogEntry:getCategories()
        while (it.hasNext()) {
            Category category = (Category)it.next();
            categories += category.getId();
    //#searchapihandler.java:159: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Category:getId()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Hashtable adaptBlogEntry(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Category:getId()
            if (it.hasNext()) {
                categories += ",";
            }
        }
        post.put(DATE_CREATED, entry.getDate());
    //#searchapihandler.java:164: Warning: method not available
    //#    -- call on Date net.sourceforge.pebble.domain.BlogEntry:getDate()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Hashtable adaptBlogEntry(BlogEntry)
    //#    unanalyzed callee: Date net.sourceforge.pebble.domain.BlogEntry:getDate()
        post.put(USER_ID, entry.getAuthor());
    //#searchapihandler.java:165: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getAuthor()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Hashtable adaptBlogEntry(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getAuthor()
        post.put(POST_ID, formatPostId(entry.getBlog().getId(), entry.getId()));
    //#searchapihandler.java:166: Warning: method not available
    //#    -- call on Blog net.sourceforge.pebble.domain.BlogEntry:getBlog()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Hashtable adaptBlogEntry(BlogEntry)
    //#    unanalyzed callee: Blog net.sourceforge.pebble.domain.BlogEntry:getBlog()
    //#searchapihandler.java:166: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Blog:getId()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Hashtable adaptBlogEntry(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Blog:getId()
    //#searchapihandler.java:166: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getId()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Hashtable adaptBlogEntry(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getId()
        post.put(CONTENT, TITLE_START_DELIMITER + entry.getTitle() + TITLE_END_DELIMITER
    //#searchapihandler.java:167: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Hashtable adaptBlogEntry(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getTitle()
                + CATEGORY_START_DELIMITER + categories + CATEGORY_END_DELIMITER + entry.getBody());
    //#searchapihandler.java:168: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getBody()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.webservice.SearchAPIHandler
    //#    method: Hashtable adaptBlogEntry(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getBody()

        return post;
    //#searchapihandler.java:170: end of method: Hashtable net.sourceforge.pebble.webservice.SearchAPIHandler.adaptBlogEntry(BlogEntry)
    }

    /**
     * Auto create a Map of search result summary.
     * @param result of the search hits.
     */
    private Map searchResultSummary(List<SearchHit> result, String sortBy,
                                        String query, int pageIndex, int offset) {
        Map data = new Hashtable();
    //#searchapihandler.java:179: method: Map net.sourceforge.pebble.webservice.SearchAPIHandler.searchResultSummary(List, String, String, int, int)
    //#input(Map searchResultSummary(List, String, String, int, int)): offset
    //#input(Map searchResultSummary(List, String, String, int, int)): pageIndex
    //#input(Map searchResultSummary(List, String, String, int, int)): query
    //#input(Map searchResultSummary(List, String, String, int, int)): result
    //#input(Map searchResultSummary(List, String, String, int, int)): sortBy
    //#output(Map searchResultSummary(List, String, String, int, int)): new Hashtable(searchResultSummary#1) num objects
    //#output(Map searchResultSummary(List, String, String, int, int)): return_value
    //#new obj(Map searchResultSummary(List, String, String, int, int)): new Hashtable(searchResultSummary#1)
    //#pre[4] (Map searchResultSummary(List, String, String, int, int)): result != null
    //#post(Map searchResultSummary(List, String, String, int, int)): return_value == &new Hashtable(searchResultSummary#1)
    //#post(Map searchResultSummary(List, String, String, int, int)): new Hashtable(searchResultSummary#1) num objects == 1
        data.put("size", result.size() );
        data.put("sortBy", sortBy);
        data.put("index", pageIndex);
        data.put("offset", offset);
        data.put("query", query);

        return data;
    //#searchapihandler.java:186: end of method: Map net.sourceforge.pebble.webservice.SearchAPIHandler.searchResultSummary(List, String, String, int, int)
    }

}
    //#searchapihandler.java:: end of class: net.sourceforge.pebble.webservice.SearchAPIHandler
