# com.bea.content.expression
Search Class

public class Search
extends `Object`
implements `Cloneable`, `Serializable`

This represents parameters for searching for Nodes.

There are reserved system properties (not type defined) that may be part of a search. They are:

- cm_uid -> Node.id.uid
- cm_createdDate -> Node.createDate
- cm_createdBy -> Node.createdBy
- cm_modifiedDate -> Node.modifiedBy
- cm_nodeName -> Node.name
- cm_path -> Node.path
- cm_isHierarchy -> Node.type == Node.HIERARCHY
- cm_isContent -> Node.type == Node.CONTENT
- cm_objectClass -> Node.objectClass.name
- cm_contentType -> BinaryValue.contentType
- cm_binarySize -> BinaryValue.size (For Node Properties)
- cm_binaryName -> BinaryValue.name (For Node Properties)

Hierarchy
  `Object`
  `Search`

All Implemented Interfaces
  `Cloneable`, `Serializable`

## Field Summary

`protected `Map`` | `contextParams` The context params.
`protected `Expression`` | `expression` The search expression.
`protected int` | `maxReturn` The maximum number of objects to return.
`protected `List`` | `searchPaths` The paths under which to search.
`protected `SortCriteria`` | `sortCriteria` The sorting criteria.

## Constructor Summary

Search() Empty constructor.
Search(`Expression` expr) Constructor.
Search(int maxReturn, `SortCriteria` sortCriteria, `Expression` expr) Constructor.
Search(int maxReturn, `SortCriteria` sortCriteria, `String` expr) Constructor.
Search(int maxReturn, `Expression` expr) Constructor.
Search(int maxReturn, `String` sort, `Expression` expr) Constructor.
Search(int maxReturn, `String` sort, `String` expr) Constructor.
Search(int maxReturn, `String` expr) Constructor.
Search(`String` searchPath, int maxReturn, `SortCriteria` sortCriteria, `Expression` expr) Constructor.
Search(`String` searchPath, int maxReturn, `SortCriteria` sortCriteria, `String` expr) Constructor.
Search(`String` searchPath, int maxReturn, `String` sort, `Expression` expr) Constructor.
Search(`String` searchPath, int maxReturn, `String` sort, `String` expr) Constructor.
Search(`String` expr) Constructor.

## Method Summary

`public void` | `addSearchPath`(`String` path) Add a search path.
`public void` | `clearSearchPaths`() Clear the search paths.
`public `Object`` | `clone`() Make a copy of this object
`public boolean` | `equals`(`Object` o) Determine if another object is equals to this.
`public `Object`` | `getContextParam`(`Object` key) Get the value of a context param.
`public `Map`` | `getContextParams`() Get an unmodifiable copy of the context params.
`public `Expression`` | `getExpression`() Get the search expression.
`public int` | `getMaxReturn`() Get the maximum number of objects to return.
`public int` | `getNumSearchPaths`() Get the number of search paths.
`public `String`[]` | `getSearchPaths`() Get the search paths.
`public `Iterator`` | `getSearchPathsIterator`() Get an iterator over the search paths.
`public `SortCriteria`[]` | `getSortCriteria`() Get the sort criteria.
`public int` | `hashCode`() Override hashcode to use our parts.
`public void` | `removeSearchPath`(`String` path) Remove a search path.
`public `Object`` | `setContextParam`(`Object` key, `Object` value) Set the value of a context param.
`public void` | `setContextParams`(`Map` input) Set the context params based upon the objects in the input map.
`public void` | `setExpression`(`Expression` expression) Set the search expression.
`public void` | `setMaxReturn`(int maxReturn) Set the maximum number of objects to return.
`public void` | `setSearchPath`(`String` searchPath) Set the search path to contain just this one.
`public void` | `setSearchPaths`(`String`[] paths) Set the search paths.
`public void` | `setSortCriteria`(`SortCriteria`[] sortCriteria) Set the sort criteria.
`public void` | `setSortCriteria`(`String` sort) Set the sort criteria.
`public `String`` | `toString`() Get a String representation of this.

Methods from class `java.lang.`Object``
`finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Detail

### contextParams

    protected Map contextParams

  The context params.

### expression

    protected Expression expression

  The search expression.

### maxReturn

    protected int maxReturn

  The maximum number of objects to return.

  Less than 0 signifies returning all matches.

### searchPaths

    protected List searchPaths

  The paths under which to search.

  This should be empty to search under all paths (repositories in a federeated search.) This is an OR'ed list.

  In a federated search, this can begin with "/*" (e.g."/*/some/path") to denote a search path under each repository. In non-federated search, this should not be construed to contain any special characters.

### sortCriteria

    protected SortCriteria sortCriteria

  The sorting criteria. The BEA Repository is only able to sort on system properties as defined above in the class javadoc.

## Constructor Detail

### Search

    public Search()

  Empty constructor.

### Search

    public Search(Expression expr)

  Constructor.

### Search

    public Search(int maxReturn,
                  SortCriteria[] sortCriteria,
                  Expression expr)

  Constructor.

### Search

    public Search(int maxReturn,
                  SortCriteria[] sortCriteria,
                  String expr)

  Constructor.

### Search

    public Search(int maxReturn,
                  Expression expr)

  Constructor.

### Search

    public Search(int maxReturn,
                  String sort,
                  Expression expr)

  Constructor.

### Search

    public Search(int maxReturn,
                  String sort,
                  String expr)

  Constructor.

### Search

    public Search(int maxReturn,
                  String expr)

  Constructor.

### Search

    public Search(String searchPath,
                  int maxReturn,
                  SortCriteria[] sortCriteria,
                  Expression expr)

  Constructor.

### Search

    public Search(String searchPath,
                  int maxReturn,
                  SortCriteria[] sortCriteria,
                  String expr)

  Constructor.

### Search

    public Search(String searchPath,
                  int maxReturn,
                  String sort,
                  Expression expr)

  Constructor.

### Search

    public Search(String searchPath,
                  int maxReturn,
                  String sort,
                  String expr)

  Constructor.

### Search

    public Search(String expr)

  Constructor.

## Method Detail

### addSearchPath(String) Method

    public void addSearchPath(String path)

Add a search path.

See `Search.searchPaths``` for details about what this can be.

### clearSearchPaths() Method

    public void clearSearchPaths()

Clear the search paths.

### clone() Method

    public Object clone()

Make a copy of this object

Overrides
  `Object.clone()`

### equals(Object) Method

    public boolean equals(Object o)

Determine if another object is equals to this.

Overrides
  `Object.equals(Object)`

### getContextParam(Object) Method

    public Object getContextParam(Object key)

Get the value of a context param.

### getContextParams() Method

    public Map getContextParams()

Get an unmodifiable copy of the context params.

### getExpression() Method

    public Expression getExpression()

Get the search expression.

### getMaxReturn() Method

    public int getMaxReturn()

Get the maximum number of objects to return.

Use less than 0 to signify returning all matches.

### getNumSearchPaths() Method

    public int getNumSearchPaths()

Get the number of search paths.

### getSearchPaths() Method

    public String[] getSearchPaths()

Get the search paths.

See `Search.searchPaths``` for details about what this can be.

### getSearchPathsIterator() Method

    public Iterator getSearchPathsIterator()

Get an iterator over the search paths.

See `Search.searchPaths``` for details about what this can be.

### getSortCriteria() Method

    public SortCriteria[] getSortCriteria()

Get the sort criteria.

### hashCode() Method

    public int hashCode()

Override hashcode to use our parts.

Overrides
  `Object.hashCode()`

### removeSearchPath(String) Method

    public void removeSearchPath(String path)

Remove a search path.

### setContextParam(Object, Object) Method

    public Object setContextParam(Object key,
                                  Object value)

Set the value of a context param.

The key and value must be Serializable.

#### Parameters

key
  the context param key.

value
  the context param value.

#### Returns

the old context param value or null if none.

### setContextParams(Map) Method

    public void setContextParams(Map input)

Set the context params based upon the objects in the input map.

### setExpression(Expression) Method

    public void setExpression(Expression expression)

Set the search expression.

### setMaxReturn(int) Method

    public void setMaxReturn(int maxReturn)

Set the maximum number of objects to return.

Use less than 0 to signify returning all matches.

### setSearchPath(String) Method

    public void setSearchPath(String searchPath)

Set the search path to contain just this one.

See `Search.searchPaths``` for details about what this can be.

### setSearchPaths(String[]) Method

    public void setSearchPaths(String[] paths)

Set the search paths.

### setSortCriteria(SortCriteria[]) Method

    public void setSortCriteria(SortCriteria[] sortCriteria)

Set the sort criteria.

### setSortCriteria(String) Method

    public void setSortCriteria(String sort)
         throws IllegalArgumentException

Set the sort criteria.

#### Exceptions

``IllegalArgumentException``
  if the str string isn't valid occurred to `SortCriteria.getSortCriteria(String)```.

### toString() Method

    public String toString()

Get a String representation of this.

Overrides
  `Object.toString()`