Search: ezcSearchSession
[ ]
[ Solr schema ]
[ ]
[ ]
[ ]
[ ]
Class: ezcSearchSession
|
ezcSearchSession is the main runtime interface for searching documents. [
source]
Properties
Method Summary
|
public ezcSearchSession |
__construct(
$handler, $manager )
Constructs a new search session that works on the handler $handler. |
|
public void |
beginTransaction(
)
Starts a transaction for indexing. |
|
public void |
commit(
)
Ends a transaction and calls commit. |
|
public ezcQueryDelete |
createDeleteQuery(
$type, $type
)
Returns a delete query for the given document type $type. |
|
public ezcSearchFindQuery |
createFindQuery(
$type, $type
)
Returns a search query for the given document type $type. |
|
public void |
delete(
$document )
Deletes the document $document from the index. |
|
public void |
deleteFromQuery(
$query )
Deletes documents using the query $query. |
|
public ezcSearchResult |
find(
$query, $query
)
Returns the result of the search query $query as a list of objects. |
|
public void |
index(
$document )
Indexes the new document $document to the search index. |
|
public void |
update(
$document )
Indexes a new document after removing the old one first. |
Methods
__construct
Constructs a new search session that works on the handler $handler.
The $manager provides valid search document definitions to the session. The $handler will be used to perform all search operations.
Parameters
beginTransaction
void beginTransaction(
)
Starts a transaction for indexing.
When using a transaction, the amount of processing that the search backend does decreases, increasing indexing performance. Without this, the component sends a commit after every document that is indexed. Transactions can be nested, when commit() is called the same number of times as beginTransaction(), the component sends a commit.
commit
void commit(
)
Ends a transaction and calls commit.
Throws
| Class | Description |
ezcSearchTransactionException |
if no transaction is active. |
createDeleteQuery
Returns a delete query for the given document type $type.
Parameters
| Name |
Type |
Description |
$type
|
string |
|
$type |
|
|
Throws
| Class | Description |
ezcSearchException |
if there is no such document type. |
createFindQuery
Returns a search query for the given document type $type.
The query is initialized to fetch all properties.
Example:
1. $q = $session->createFindQuery( 'Person' );
2. $allPersons = $session->find( $q, 'Person' );
Parameters
| Name |
Type |
Description |
$type
|
string |
|
$type |
|
|
Throws
| Class | Description |
ezcSearchException |
if there is no such document type. |
delete
void delete(
object
$document )
Deletes the document $document from the index.
Parameters
| Name |
Type |
Description |
$document |
object |
The document to delete |
Throws
| Class | Description |
ezcSearchDefinitionNotFoundxception |
if the object is not recognized as valid document type. |
ezcSearchDocumentNotAvailableException |
if $document is not stored in the database already |
ezcSearchQueryException |
if the object could not be deleted. |
deleteFromQuery
Deletes documents using the query $query.
Parameters
Throws
| Class | Description |
ezcSearchQueryException |
if the delete query failed. |
find
Returns the result of the search query $query as a list of objects.
Returns the documents found for document type $type using the submitted $query. $query should be created using
createFindQuery().
Parameters
Throws
| Class | Description |
ezcSearchDefinitionNotFoundException |
if there is no such persistent class. |
ezcSearchQueryException |
if the find query failed. |
index
void index(
object
$document )
Indexes the new document $document to the search index.
Parameters
| Name |
Type |
Description |
$document |
object |
|
Throws
| Class | Description |
ezcSearchException |
if $document is not of a valid document type. |
ezcSearchException |
if it was not possible to generate a unique identifier for the new object. |
ezcSearchException |
if the indexing failed. |
update
void update(
object
$document )
Indexes a new document after removing the old one first.
Parameters
| Name |
Type |
Description |
$document |
object |
|
Throws
| Class | Description |
ezcSearchDefinitionNotFoundException |
if $document is not of a valid document type. |
ezcSearchDocumentNotAvailableException |
if $document is not stored in the database already. |
Last updated: Tue, 02 Dec 2008