org.opencms.search
Class CmsSearchParameters

java.lang.Object
  extended by org.opencms.search.CmsSearchParameters

public class CmsSearchParameters
extends Object

Contains the search parameters for a call to CmsSearchIndex.search(org.opencms.file.CmsObject, CmsSearchParameters, int, int).

Since:
6.0.0
Version:
$Revision: 1.5 $, $Revision: 1.5 $
Author:
Alexander Kandzior

Constructor Summary
CmsSearchParameters(String query, List fields, List roots, List categories, boolean calculateCategories, Sort sort)
          Creates a new search parameter instance with the provided parameter values.
 
Method Summary
 List getCategories()
          Returns the list of categories to limit the search to.
 List getFields()
          Returns the list of search index fields to search in.
 String getQuery()
          Returns the search query to use.
 List getRoots()
          Returns the search roots to use.
 Sort getSort()
          Returns the sort order for the search.
 boolean isCalculateCategories()
          Returns true if the category count is calculated for all search results.
 CmsSearchParameters restrict(CmsSearchParameters restriction)
          Creates a merged parameter set from this parameters, restricted by the given other parameters.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsSearchParameters

public CmsSearchParameters(String query,
                           List fields,
                           List roots,
                           List categories,
                           boolean calculateCategories,
                           Sort sort)
Creates a new search parameter instance with the provided parameter values.

Parameters:
query - the search term to search the index
fields - the list of fields to search
roots - only resource that are sub-resource of one of the search roots are included in the search result
categories - the list of categories to limit the search to
calculateCategories - if true, the category count is calculated for all search results (use with caution, this option uses much performance)
sort - the sort order for the search
Method Detail

getCategories

public List getCategories()
Returns the list of categories to limit the search to.

Returns:
the list of categories to limit the search to

getFields

public List getFields()
Returns the list of search index fields to search in.

Returns:
the list of search index fields to search in

getQuery

public String getQuery()
Returns the search query to use.

Returns:
the search query to use

getRoots

public List getRoots()
Returns the search roots to use.

Only resource that are sub-resource of one of the search roots are included in the search result.

Returns:
the search roots to use

getSort

public Sort getSort()
Returns the sort order for the search.

Returns:
the sort order for the search

isCalculateCategories

public boolean isCalculateCategories()
Returns true if the category count is calculated for all search results.

Returns:
true if the category count is calculated for all search results

restrict

public CmsSearchParameters restrict(CmsSearchParameters restriction)
Creates a merged parameter set from this parameters, restricted by the given other parameters.

This is mainly intended for "search in search result" functions.

The restricted query is build of the queries of both parameters, appended with AND.

The lists in the restriction for getFields(), getRoots() and getCategories() are intersected with the lists of this search parameters. Only elements containd in both lists are included for the created search parameters. If a list in either the restriction or in this search parameters is null, the list from the other search parameters is used direclty.

The values for isCalculateCategories() and getSort() of this parameters are used for the restricted parameters.

Parameters:
restriction - the parameters to restrict this parameters with
Returns:
the restricted parameters

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()