com.xpn.xwiki.plugin.globalsearch
Class GlobalSearchPluginApi

java.lang.Object
  extended by com.xpn.xwiki.api.Api
      extended by com.xpn.xwiki.plugin.PluginApi<GlobalSearchPlugin>
          extended by com.xpn.xwiki.plugin.globalsearch.GlobalSearchPluginApi

public class GlobalSearchPluginApi
extends com.xpn.xwiki.plugin.PluginApi<GlobalSearchPlugin>

API tool to be able to make and merge multi wikis search queries.

Version:
$Id$

Field Summary
static java.lang.String CONTEXT_LASTERRORCODE
          Field name of the last error code inserted in context.
static java.lang.String CONTEXT_LASTEXCEPTION
          Field name of the last API exception inserted in context.
protected static org.apache.commons.logging.Log LOG
          Logging tool.
 
Fields inherited from class com.xpn.xwiki.api.Api
context
 
Constructor Summary
GlobalSearchPluginApi(GlobalSearchPlugin plugin, XWikiContext context)
          Create an instance of GlobalSearchPluginApi.
 
Method Summary
 void logError(java.lang.String errorMessage, XWikiException e)
          Log error and store details in the context.
 GlobalSearchQuery newQuery()
          Create a new instance of GlobalSearchQuery and return it.
 java.util.Collection<GlobalSearchResult> search(GlobalSearchQuery query)
          Execute query in all provided wikis and return list containing all results.
 java.util.Collection<Document> searchDocuments(GlobalSearchQuery query, boolean distinctbylanguage)
          Search wiki pages in all provided wikis and return list containing found Document.
 java.util.Collection<java.lang.String> searchDocumentsNames(GlobalSearchQuery query, boolean distinctbylanguage, boolean checkRight)
          Search wiki pages in all provided wikis and return list containing found Document.
 
Methods inherited from class com.xpn.xwiki.plugin.PluginApi
getInternalPlugin, getPlugin, getProtectedPlugin, setPlugin
 
Methods inherited from class com.xpn.xwiki.api.Api
checkProgrammingRights, convert, convert, getXWikiContext, hasAccessLevel, hasAdminRights, hasProgrammingRights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_LASTERRORCODE

public static final java.lang.String CONTEXT_LASTERRORCODE
Field name of the last error code inserted in context.

See Also:
Constant Field Values

CONTEXT_LASTEXCEPTION

public static final java.lang.String CONTEXT_LASTEXCEPTION
Field name of the last API exception inserted in context.

See Also:
Constant Field Values

LOG

protected static final org.apache.commons.logging.Log LOG
Logging tool.

Constructor Detail

GlobalSearchPluginApi

public GlobalSearchPluginApi(GlobalSearchPlugin plugin,
                             XWikiContext context)
Create an instance of GlobalSearchPluginApi.

Parameters:
plugin - the entry point of the Global Search plugin.
context - the XWiki context.
Method Detail

logError

public void logError(java.lang.String errorMessage,
                     XWikiException e)
Log error and store details in the context.

Parameters:
errorMessage - error message.
e - the catched exception.

newQuery

public GlobalSearchQuery newQuery()
Create a new instance of GlobalSearchQuery and return it.

Returns:
a new instance of GlobalSearchQuery and return it.

search

public java.util.Collection<GlobalSearchResult> search(GlobalSearchQuery query)
                                                throws XWikiException
Execute query in all provided wikis and return list containing all results. Compared to XWiki Platform search, searchDocuments and searchDocumentsName it's potentially "time-consuming" since it issues one request per provided wiki.

Parameters:
query - the query parameters. The hql has some constraints:
  • "*" is not supported in SELECT clause.
  • All ORDER BY fields has to be listed in SELECT clause.
Returns:
the search result as list of GlobalSearchResult containing all selected fields values.
Throws:
XWikiException - error when executing query.

searchDocuments

public java.util.Collection<Document> searchDocuments(GlobalSearchQuery query,
                                                      boolean distinctbylanguage)
                                               throws XWikiException
Search wiki pages in all provided wikis and return list containing found Document. Compared to XWiki Platform search, searchDocuments and searchDocumentsName it's potentially "time-consuming" since it issues one request per provided wiki.

Parameters:
query - the query parameters. The hql has some constraints:
  • "*" is not supported in SELECT clause.
  • All ORDER BY fields has to be listed in SELECT clause.
distinctbylanguage - when a document has multiple version for each language it is returned as one document a language.
Returns:
the found Document.
Throws:
XWikiException - error when executing query.

searchDocumentsNames

public java.util.Collection<java.lang.String> searchDocumentsNames(GlobalSearchQuery query,
                                                                   boolean distinctbylanguage,
                                                                   boolean checkRight)
                                                            throws XWikiException
Search wiki pages in all provided wikis and return list containing found Document. Compared to XWiki Platform search, searchDocuments and searchDocumentsName it's potentially "time-consuming" since it issues one request per provided wiki.

Parameters:
query - the query parameters. The hql has some constraints:
  • "*" is not supported in SELECT clause.
  • All ORDER BY fields has to be listed in SELECT clause.
distinctbylanguage - when a document has multiple version for each language it is returned as one document a language.
checkRight - if true check for each found document if context's user has "view" rights for it.
Returns:
the found Document.
Throws:
XWikiException - error when executing query.


Copyright © 2004-2011 XWiki. All Rights Reserved.