Mixin_Search
Package: Record\Mixin
- class Mixin_Search
extends Omeka_Record_Mixin_AbstractMixin
Make an Omeka record fulltext searchable.
Any class that extends Omeka_Record_AbstractRecord can be made searchable by pushing an instance of this mixin into Omeka_Record::$_mixins during Omeka_Record::_initializeMixins(). It must be pushed after all mixins that can add search text–for example, after ElementText.
The record type must also be registered using the search_record_types filter in order for the records to be searchable.
This mixin leverages the Omeka_Record_AbstractRecord::afterSave() and Omeka_Record_Mixin_AbstractMixin::afterSave() callbacks, so note their order of execution. Records that initialize ActsAsElementText will automatically add their element texts to the search text.
- property Mixin_Search::$_text
protected
- property Mixin_Search::$_title
protected
- property Mixin_Search::$_public
protected
- Mixin_Search::__construct($record)
- Parameters:
$record –
- Mixin_Search::addSearchText($text)
Add search text to this record.
This method is meant to be called during afterSave().
- Parameters:
$text (
string
) –
- Mixin_Search::setSearchTextTitle($title)
Add a title to this record.
This method is meant to be called during afterSave().
- Parameters:
$title (
string
) –
- Mixin_Search::setSearchTextPrivate()
Mark this record’s search text as not public.
This method is meant to be called during afterSave().
- Mixin_Search::afterSave($args)
Save the accumulated search text to the database.
- Parameters:
$args –
- Mixin_Search::afterDelete()
Delete this record’s search text after it has been deleted.
- Mixin_Search::saveSearchText($recordType, $recordId, $text, $title, $public = 1)
Save a search text row.
Call this statically only when necessary. Used primarily when in a record that does not implement Mixin_Search but contains text that is needed for another record’s search text. For example, when saving a child record that contains search text that should be saved to its parent record.
- Parameters:
$recordType (
string
) –$recordId (
int
) –$text (
string
) –$title (
string
) –$public (
int
) –