Index: xwiki-xmlrpc/xwiki-xmlrpc-client/src/main/java/org/xwiki/xmlrpc/XWikiXmlRpcClient.java
===================================================================
--- xwiki-xmlrpc/xwiki-xmlrpc-client/src/main/java/org/xwiki/xmlrpc/XWikiXmlRpcClient.java	(revision 22772)
+++ xwiki-xmlrpc/xwiki-xmlrpc-client/src/main/java/org/xwiki/xmlrpc/XWikiXmlRpcClient.java	(working copy)
@@ -146,7 +146,26 @@
 
         return result;
     }
+    
+    /**
+     * Get spaces.
+     * 
+     * @return A list of SpaceSummaries for each space defined in the remote XWiki.
+     * @throws XmlRpcException
+     */
+    public List<SpaceSummary> getSpaces(int start, int limit) throws XmlRpcException
+    {
+        Object[] objects = (Object[]) invokeRpc("getSpaces", this.token, start, limit);
+        List<SpaceSummary> result = new ArrayList<SpaceSummary>();
+        for (Object object : objects) {
+            Map<String, Object> spaceSummaryMap = (Map) object;
+            SpaceSummary spaceSummary = new SpaceSummary(spaceSummaryMap);
+            result.add(spaceSummary);
+        }
 
+        return result;
+    }
+
     /**
      * Get information about a given space.
      * 
@@ -236,6 +255,51 @@
     }
 
     /**
+     * Get pages in space, with range specified by start and limit. Range->[start,start+limit]
+     * 
+     * @param spaceName
+     * @param start
+     * @param limit
+     * @return A list of SpaceSummaries for each page in the given space.
+     * @throws XmlRpcException
+     */
+    public List<XWikiPageSummary> getPages(String spaceName, int start, int limit) throws XmlRpcException
+    {
+        Object[] objects = (Object[]) invokeRpc("getPages", this.token, spaceName, start, limit);
+        List<XWikiPageSummary> result = new ArrayList<XWikiPageSummary>();
+        for (Object object : objects) {
+            Map pageSummaryMap = (Map) object;
+            XWikiPageSummary pageSummary = new XWikiPageSummary(pageSummaryMap);
+            result.add(pageSummary);
+        }
+
+        return result;
+    }
+    
+    /**
+     * 
+     * @param spaceName
+     * @param index
+     * @return
+     * @throws XmlRpcException
+     */
+    public XWikiPageSummary getPageSummaryAtIndex(String spaceName, int index) throws XmlRpcException
+    {
+        XWikiPageSummary object = (XWikiPageSummary) invokeRpc("getPageSummaryAtIndex", this.token, spaceName, index);
+        return object;
+    }
+
+    /**
+     * Convenience method.
+     * 
+     * @see XWikiXmlRpcClient#getPages(String, int, int)
+     */
+    public List<XWikiPageSummary> getPages(SpaceSummary space, int start, int limit) throws XmlRpcException
+    {
+        return getPages(space.getKey(), start, limit);
+    }
+
+    /**
      * Get full page information and content.
      * 
      * @param pageId
@@ -343,6 +407,29 @@
         return getPage(pageHistorySummary.getId(), pageHistorySummary.getVersion(), pageHistorySummary
             .getMinorVersion());
     }
+    
+    /**
+     * Return the number of pages in a space.
+     * 
+     * @param spaceKey The name of space. Eg. Main, XWiki etc.
+     * @return The Integer number of the pages in the space
+     * @throws XmlRpcException
+     */
+    public Integer getNumberOfPages(String spaceKey) throws XmlRpcException
+    {
+        return (Integer) invokeRpc("getNumberOfPages", this.token, spaceKey);
+    }
+    
+    /**
+     * Return the number of spaces
+     * 
+     * @return The Integer number of the spaces
+     * @throws XmlRpcException
+     */
+    public Integer getNumberOfSpaces() throws XmlRpcException
+    {
+        return (Integer) invokeRpc("getNumberOfSpaces", this.token);
+    }
 
     /**
      * Get the history of a page.
@@ -857,6 +944,33 @@
     }
 
     /**
+     * Search pages, with specified parameters.
+     * 
+     * @param query Specifies the string to be searched according to searchedField key of Map parameters argument.
+     *            Current Implementation supports only fullName property of document as the searchedField key. If it is
+     *            "__ALL_PAGES__" the search will return all the page Ids available.
+     * @param parameters Map containing specific parameters like the space to be searched, modified on (today, week,
+     *            month), startIndex of results to be returned, the maximum Number of Results to be returned (which
+     *            overrides maxResults parameter if present) and the field to be searched for 'query' argument given.
+     * @param maxResults Sets the maximum number of results. Is overridden if maxResults key is specified in Map
+     *            parameters argument above
+     * @return A list of maps representing Search Results.
+     * @throws Exception An invalid token is provided.
+     */
+    public List<SearchResult> search(String query, Map parameters, int maxResults) throws XmlRpcException
+    {
+
+        Object[] objects = (Object[]) invokeRpc("search", this.token, query, parameters, maxResults);
+        List<SearchResult> result = new ArrayList<SearchResult>();
+        for (Object object : objects) {
+            Map<String, Object> searchResultMap = (Map<String, Object>) object;
+            SearchResult searchResult = new SearchResult(searchResultMap);
+            result.add(searchResult);
+        }
+        return result;
+    }
+
+    /**
      * Returns a list of XWikiPageHistorySummary containing all the pages that have been modified since a given date in
      * all their versions.
      * 
@@ -932,6 +1046,142 @@
     }
 
     /**
+     * Move/Rename Attachment from first pageId to same/another (second) pageId
+     * 
+     * @param oldpageId The first pageId of the page which contains the attachment
+     * @param oldfileName The fileName(name) of the Attachment
+     * @param newpageId The second/new pageId where the attachment has to be transferred/moved to.
+     * @param newfileName The new FileName of the Attachment
+     * @return True if moved/renamed successfully.
+     * @throws XmlRpcException
+     */
+    public Boolean moveAttachment(String oldpageId, String oldfileName, String newpageId, String newfileName)
+        throws Exception
+    {
+        Object object = invokeRpc("moveAttachment", this.token, oldpageId, oldfileName, newpageId, newfileName);
+        return (Boolean) object;
+    }
+
+    /**
+     * Convenience function
+     * 
+     * @param pageId The pageId of the page which contains the attachment
+     * @param oldfileName The fileName(name) of the Attachment
+     * @param newfileName The new FileName of the Attachment
+     * @return True if renamed successfully.
+     * @throws XmlRpcException
+     */
+    public Boolean moveAttachment(String pageId, String oldfileName, String newfileName) throws Exception
+    {
+        return moveAttachment(pageId, oldfileName, pageId, newfileName);
+    }
+
+    /**
+     * Convenience function
+     * 
+     * @param attachment
+     * @param newfileName The new FileName of the Attachment
+     * @return True if renamed successfully.
+     * @throws XmlRpcException
+     */
+    public Boolean moveAttachment(Attachment attachment, String newpageId) throws Exception
+    {
+        return moveAttachment(attachment.getPageId(), attachment.getFileName(), newpageId, attachment.getFileName());
+    }
+
+    /**
+     * Copy attachment from one page to another page.
+     * 
+     * @param oldpageId PageId of the page which contains the attachment to be copied
+     * @param oldfileName fileName of the Attachment to be copied
+     * @param newpageId PageId of the page to copy/include the new attachment to.
+     * @param newfileName fileName of the new Attachment.
+     * @return True if copy is successful.
+     * @throws XmlRpcException
+     */
+    public Boolean copyAttachment(String oldpageId, String oldfileName, String newpageId, String newfileName)
+    {
+        Object object;
+        try {
+            object = invokeRpc("copyAttachment", this.token, oldpageId, oldfileName, newpageId, newfileName);
+            return (Boolean) object;
+        } catch (XmlRpcException e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
+
+    /**
+     * Convenience function.
+     * 
+     * @param oldpageId PageId of the page which contains the attachment to be copied
+     * @param fileName fileName of the Attachment to be copied
+     * @param newpageId PageId of the page to copy/include the new attachment to.
+     * @return True if copy is successful.
+     * @throws Exception
+     * @throws XmlRpcException
+     */
+    public Boolean copyAttachment(String oldpageId, String fileName, String newpageId)
+    {
+        return copyAttachment(oldpageId, fileName, newpageId, fileName);
+    }
+
+    /**
+     * Convenience function.
+     * 
+     * @param attachment
+     * @param newpageId PageId of the page to copy/include the new attachment to.
+     * @return True if copy is successful.
+     * @throws XmlRpcException
+     */
+    public Boolean copyAttachment(Attachment attachment, String newpageId)
+    {
+        return copyAttachment(attachment.getPageId(), attachment.getFileName(), newpageId);
+    }
+
+    /**
+     * Convenience function.
+     * 
+     * @param attachment
+     * @param newpageId PageId of the page to copy/include the new attachment to.
+     * @param newfileName fileName of the new Attachment.
+     * @return True if copy is successful.
+     * @throws XmlRpcException
+     */
+    public Boolean copyAttachment(Attachment attachment, String newpageId, String newfileName)
+    {
+        return copyAttachment(attachment.getPageId(), attachment.getFileName(), newpageId, newfileName);
+    }
+
+    /**
+     * Copy Page from one space to another, very generic.
+     * 
+     * @param oldpageId PageId of page to be copied
+     * @param newpageId PageId of destination page to be created.
+     * @return True if successful.
+     * @throws XmlRpcException
+     */
+    public Boolean copyPage(String oldpageId, String newpageId) throws Exception
+    {
+        Object object = invokeRpc("copyPage", this.token, oldpageId, newpageId);
+        return (Boolean) object;
+    }
+
+    /**
+     * Move Page from one space to another.
+     * 
+     * @param oldpageId PageId of page to be moved.
+     * @param newpageId Destination PageId.
+     * @return True if successfully moved.
+     * @throws XmlRpcException
+     */
+    public Boolean movePage(String oldpageId, String newpageId) throws Exception
+    {
+        Object object = invokeRpc("movePage", this.token, oldpageId, newpageId);
+        return (Boolean) object;
+    }
+
+    /**
      * Utility method for invoking remote RPC methods.
      * 
      * @param methodName
Index: xwiki-xmlrpc/xwiki-xmlrpc-model/src/main/java/org/xwiki/xmlrpc/XWikiXmlRpcApi.java
===================================================================
--- xwiki-xmlrpc/xwiki-xmlrpc-model/src/main/java/org/xwiki/xmlrpc/XWikiXmlRpcApi.java	(revision 22772)
+++ xwiki-xmlrpc/xwiki-xmlrpc-model/src/main/java/org/xwiki/xmlrpc/XWikiXmlRpcApi.java	(working copy)
@@ -41,6 +41,8 @@
 
     /* Spaces */
     public List/* List<SpaceSummary> */getSpaces(String token) throws Exception;
+    
+    public List/* List<SpaceSummary> */getSpaces(String token, int start, int limit) throws Exception;
 
     public Map/* Space */getSpace(String token, String spaceKey) throws Exception;
 
@@ -51,6 +53,10 @@
     /* Pages */
     public List/* List<PageSummary> */getPages(String token, String spaceKey) throws Exception;
 
+    public List/* List<PageSummary> */getPages(String token, String spaceKey, int start, int limit) throws Exception;
+    
+    public Object getPageSummaryAtIndex(String token, String spaceName, int index) throws Exception;
+
     public Map/* XWikiPage */getPage(String token, String pageId) throws Exception;
 
     public Map/* XWikiPage */storePage(String token, Map pageMap) throws Exception;
@@ -107,4 +113,21 @@
     public List/* List<XWikiPageHistorySummary> */getModifiedPagesHistory(String token, Date date, int numberOfResults,
         int start, boolean fromLatest) throws Exception;
 
+    public List/* List<SearchResult> */search(String token, String query, Map parameters, int maxResults)
+        throws Exception;
+
+    public Boolean moveAttachment(String token, String oldpageId, String oldfileName, String newpageId,
+        String newfileName) throws Exception;
+
+    public Boolean copyAttachment(String token, String oldpageId, String oldfileName, String newpageId,
+        String newfileName);
+
+    public Boolean copyPage(String token, String oldpageId, String newpageId) throws Exception;
+
+    public Boolean movePage(String token, String oldpageId, String newpageId) throws Exception;
+    
+    public Integer getNumberOfPages(String token, String spaceKey) throws Exception;
+    
+    public Integer getNumberOfSpaces(String token) throws Exception;
+
 }
Index: xwiki-core/src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcApiImpl.java
===================================================================
--- xwiki-core/src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcApiImpl.java	(revision 22772)
+++ xwiki-core/src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcApiImpl.java	(working copy)
@@ -193,6 +193,44 @@
     }
 
     /**
+     * @param token The authentication token.
+     * @param start The index of first space to be provided.
+     * @param limit The index of last space to be provided, is calculated as start+limit, i.e Spaces returned are of
+     *            indices start->start+limit. If start+limit exceeds, the total number of spaces in the space, then
+     *            corresponding truncated list returned.
+     * @return List of spaceSummaries.
+     * @throws Exception An invalid token is provided.
+     */
+    public List getSpaces(String token, int start, int limit) throws Exception
+    {
+        XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
+        LOG.debug(String.format("User %s has called getSpaces(start, limit)", user.getName()));
+
+        List result = new ArrayList();
+        List<String> spaceKeys = this.xwikiApi.getSpaces();
+
+        for (int i = start; (i < start + limit && i < spaceKeys.size()); i++) {
+            String spaceKey = spaceKeys.get(i);
+            String spaceWebHomeId = String.format("%s.WebHome", spaceKey);
+
+            if (!this.xwikiApi.exists(spaceWebHomeId)) {
+                result.add(DomainObjectFactory.createSpaceSummary(spaceKey).toRawMap());
+            } else {
+                Document spaceWebHome = this.xwikiApi.getDocument(spaceWebHomeId);
+
+                /*
+                 * If doc is null, then we don't have the rights to access the document, and therefore to the space.
+                 */
+                if (spaceWebHome != null) {
+                    result.add(DomainObjectFactory.createSpaceSummary(spaceWebHome).toRawMap());
+                }
+            }
+        }
+
+        return result;
+    }
+
+    /**
      * Get information about a given space.
      * 
      * @param token The authentication token.
@@ -346,6 +384,77 @@
     }
 
     /**
+     * @param token The authentication token.
+     * @param spaceKey The space name.
+     * @param start The index of first page to be provided.
+     * @param limit The index of last page to be provided, is calculated as start+limit, i.e Pages returned are of
+     *            indices start->start+limit. If start+limit exceeds, the total number of pages in the space, then
+     *            corresponding truncated list returned.
+     * @return A list containing PageSummary objects.
+     * @throws Exception An invalid token is provided.
+     */
+    public List getPages(String token, String spaceKey, int start, int limit) throws Exception
+    {
+        XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
+        LOG.debug(String.format("User %s has called getPages(start, limit)", user.getName()));
+
+        List result = new ArrayList();
+        List<String> pageNames = this.xwikiApi.getSpaceDocsName(spaceKey);
+        for (int i = start; (i < start + limit && i < pageNames.size()); i++) {
+            String pageName = pageNames.get(i);
+            String pageFullName = String.format("%s.%s", spaceKey, pageName);
+
+            if (!this.xwikiApi.exists(pageFullName)) {
+                LOG.warn(String.format("[Page '%s' appears to be in space '%s' but no information is available.]",
+                    pageName, spaceKey));
+            } else {
+                Document doc = this.xwikiApi.getDocument(pageFullName);
+
+                /* We only add pages we have the right to access */
+                if (doc != null) {
+                    XWikiPageSummary pageSummary = DomainObjectFactory.createXWikiPageSummary(doc);
+                    result.add(pageSummary.toRawMap());
+                }
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * @param token The authentication token.
+     * @param spaceKey The space name.
+     * @param index The index of the page to be fetched.
+     * @return PageSummary object of the page to be fetched.
+     * @throws Exception An invalid token is provided.
+     */
+    public Object getPageSummaryAtIndex(String token, String spaceKey, int index) throws Exception
+    {
+        XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
+        LOG.debug(String.format("User %s has called getPageSummaryAtIndex()", user.getName()));
+
+        List<String> pageNames = this.xwikiApi.getSpaceDocsName(spaceKey);
+        if (index > pageNames.size())
+            throw new Exception("[Requested Document-index is greater than total number of documnets]");
+        String pageName = pageNames.get(index);
+        String pageFullName = String.format("%s.%s", spaceKey, pageName);
+        if (!this.xwikiApi.exists(pageFullName)) {
+            LOG.warn(String.format("[Page '%s' appears to be in space '%s' but no information is available.]",
+                pageName, spaceKey));
+        } else {
+            Document doc = this.xwikiApi.getDocument(pageFullName);
+
+            /* We only add pages we have the right to access */
+            if (doc != null) {
+                XWikiPageSummary pageSummary = DomainObjectFactory.createXWikiPageSummary(doc);
+                return pageSummary;
+            }
+        }
+        throw new Exception(String.format("[Page '%s' appears to be in space '%s' but no information is available.]",
+                pageName, spaceKey));
+    }
+
+    /**
      * Retrieves a page. The returned page title is set the current title if the current title != "", otherwise it is
      * set to the page name (i.e., the name part in the page Space.Name id)
      * 
@@ -366,6 +475,38 @@
     }
 
     /**
+     * @param spaceKey The name of space. Eg. Main, XWiki etc.
+     * @return The Integer number of the pages in the space
+     * @throws Exception
+     */
+    public Integer getNumberOfPages(String token, String spaceKey) throws Exception
+    {
+        XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
+        LOG.debug(String.format("User %s has called getNumberOfPages()", user.getName()));
+
+        List<String> pageNames = this.xwikiApi.getSpaceDocsName(spaceKey);
+
+        return pageNames.size();
+
+    }
+
+    /**
+     * @param spaceKey The name of space. Eg. Main, XWiki etc.
+     * @return The Integer number of the pages in the space
+     * @throws Exception
+     */
+    public Integer getNumberOfSpaces(String token) throws Exception
+    {
+        XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
+        LOG.debug(String.format("User %s has called getNumberOfSpaces()", user.getName()));
+
+        List<String> spaceNames = this.xwikiApi.getSpaces();
+
+        return spaceNames.size();
+
+    }
+
+    /**
      * Store or rename a page, or create it if it doesn't exist.
      * <p>
      * The way confluence clients rename pages is the following:
@@ -598,6 +739,52 @@
     }
 
     /**
+     * Copy Page from one space to another, very generic.
+     * 
+     * @param token The authentication token.
+     * @param oldpageId PageId of page to be copied
+     * @param newpageId PageId of destination page to be created.
+     * @return True if successful.
+     * @throws Exception
+     */
+    public Boolean copyPage(String token, String oldpageId, String newpageId) throws Exception
+    {
+        XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
+        LOG.debug(String.format("User %s has called copyPage()", user.getName()));
+
+        try {
+            this.xwiki.copyDocument(oldpageId, newpageId, this.xwikiContext);
+        } catch (Exception e) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Move Page from one space to another.
+     * 
+     * @param token The authentication token.
+     * @param oldpageId PageId of page to be moved.
+     * @param newpageId Destination PageId.
+     * @return True if successfully moved.
+     * @throws Exception
+     */
+    public Boolean movePage(String token, String oldpageId, String newpageId) throws Exception
+    {
+        XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
+        LOG.debug(String.format("User %s has called movePage()", user.getName()));
+
+        try {
+            Document doc = XWikiUtils.getDocument(this.xwikiApi, oldpageId, true);
+
+            doc.rename(newpageId);
+        } catch (Exception e) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
      * Get revision history of a page.
      * 
      * @param token The authentication token.
@@ -925,6 +1112,60 @@
     }
 
     /**
+     * Move/Rename Attachment from first pageId to same/another (second) pageId
+     * 
+     * @param token The authentication token.
+     * @param oldpageId The first pageId of the page which contains the attachment
+     * @param oldfileName The fileName(name) of the Attachment
+     * @param newpageId The second/new pageId where the attachment has to be transferred/moved to.
+     * @param newfileName The new FileName of the Attachment
+     * @return True if moved/renamed successfully.
+     * @throws Exception
+     */
+    public Boolean moveAttachment(String token, String oldpageId, String oldfileName, String newpageId,
+        String newfileName) throws Exception
+    {
+        XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
+        LOG.debug(String.format("User %s has called moveAttachment()", user.getName()));
+
+        boolean result = copyAttachment(token, oldpageId, oldfileName, newpageId, newfileName);
+        return result && removeAttachment(token, oldpageId, oldfileName);
+
+    }
+
+    /**
+     * Copy attachment from one page to another page.
+     * 
+     * @param token The authentication token.
+     * @param oldpageId PageId of the page which contains the attachment to be copied
+     * @param oldfileName fileName of the Attachment to be copied
+     * @param newpageId PageId of the page to copy/include the new attachment to.
+     * @param newfileName fileName of the new Attachment.
+     * @return True if copy is successful.
+     */
+    public Boolean copyAttachment(String token, String oldpageId, String oldfileName, String newpageId,
+        String newfileName)
+    {
+        try {
+            XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
+            LOG.debug(String.format("User %s has called copyAttachment()", user.getName()));
+
+            XWikiExtendedId extendedId = new XWikiExtendedId(oldpageId);
+            Document doc = XWikiUtils.getDocument(this.xwikiApi, extendedId.getBasePageId(), true);
+            com.xpn.xwiki.api.Attachment xwikiAttachment = doc.getAttachment(oldfileName);
+
+            XWikiExtendedId newextendedId = new XWikiExtendedId(newpageId);
+            Document newdoc = XWikiUtils.getDocument(this.xwikiApi, newextendedId.getBasePageId(), true);
+            newdoc.addAttachment(newfileName, xwikiAttachment.getContent());
+
+        } catch (Exception e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
      * Get classes.
      * 
      * @param token The authentication token.
@@ -1343,4 +1584,76 @@
 
         return DomainObjectFactory.createXWikiObject(this.xwiki, this.xwikiContext, doc, object).toRawMap();
     }
+
+    /**
+     * Search pages, with specified parameters.
+     * 
+     * @param token The authentication token.
+     * @param query Specifies the string to be searched according to searchedField key of Map parameters argument.
+     *            Current Implementation supports only fullName property of document as the searchedField key. If it is
+     *            "__ALL_PAGES__" the search will return all the page Ids available.
+     * @param parameters Map containing specific parameters like the space to be searched, modified on (today, week,
+     *            month), startIndex of results to be returned, the maximum Number of Results to be returned (which
+     *            overrides maxResults parameter if present) and the field to be searched for 'query' argument given.
+     * @param maxResults Sets the maximum number of results. Is overridden if maxResults key is specified in Map
+     *            parameters argument above
+     * @return A list of maps representing Search Results.
+     * @throws Exception An invalid token is provided.
+     */
+    public List search(String token, String query, Map parameters, int maxResults) throws Exception
+    {
+        XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
+        LOG.debug(String.format("User %s has called map-parametered search()", user.getName()));
+        String sqlQuery = "where";
+        List result = new ArrayList();
+        int nb = 0;
+        if (query.equals("__ALL_PAGES__") || query.equalsIgnoreCase("") || query.equalsIgnoreCase("*")) {
+            query = "";
+        }
+        if (parameters.containsKey("spaceKey")) {
+            sqlQuery +=
+                " doc.space like '%" + com.xpn.xwiki.web.Utils.SQLFilter((parameters.get("spaceKey").toString()))
+                    + "%' and";
+        }
+        if (parameters.containsKey("modified")) {
+            String modified = parameters.get("modified").toString();
+            if (modified.equalsIgnoreCase("today")) {
+                sqlQuery +=
+                    " year(doc.date) = year(current_date()) and month(doc.date) = month(current_date()) and day(doc.date) > (day(current_date()) - 1) order by doc.date desc and";
+            } else if (modified.equalsIgnoreCase("week")) {
+                sqlQuery +=
+                    " year(doc.date) = year(current_date()) and month(doc.date) = month(current_date()) and day(doc.date) > (day(current_date()) - 7) order by doc.date desc and";
+            } else if (modified.equalsIgnoreCase("month")) {
+                sqlQuery +=
+                    " year(doc.date) = year(current_date()) and ((month(doc.date) > (month(current_date()) - 1)) or ((month(doc.date) = (month(current_date()) - 1)) and (day(doc.date) > day(current_date())) )) order by doc.date desc and";
+            }
+        }
+        if (parameters.containsKey("searchedField")) {
+            if (parameters.get("searchedField").toString().equalsIgnoreCase("fullname")) {
+                sqlQuery += " doc.fullName like '%" + query + "%' and"; // for now, only document fullname property.
+            }
+        }
+        sqlQuery += " 1=1"; // Hack for final 'and' that appears in the sql query'
+
+        if (parameters.containsKey("startIndex")) {
+            nb = Integer.parseInt(parameters.get("startIndex").toString());
+        }
+        if (parameters.containsKey("maxResults")) {
+            maxResults = Integer.parseInt(parameters.get("maxResults").toString());
+        }
+
+        LOG
+            .debug(("Executing HQL: " + sqlQuery + " with maxResults: " + maxResults + " starting with record number: " + nb)
+                .toString());
+
+        List<String> searchResults =
+            this.xwiki.getStore().searchDocumentsNames(sqlQuery, maxResults, nb, this.xwikiContext);
+
+        for (String pageId : searchResults) {
+            LOG.info(("pageId: " + pageId).toString());
+            result.add(DomainObjectFactory.createSearchResult(pageId).toMap());
+        }
+
+        return result;
+    }
 }
