Difference between revisions of "API:EPrints/DataObj/SavedSearch"

From EPrints Documentation
Jump to: navigation, search
 
Line 350: Line 350:
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 
</div>
 
</div>
<!-- Pod2Wiki=head_object_methods -->
+
<!-- Pod2Wiki=head_utility_methods -->
===Object Methods===
+
===Utility Methods===
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<span style='display:none'>User Comments</span>

Latest revision as of 17:29, 10 January 2022

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::DataObj::SavedSearch - Single saved search.

User Comments


DESCRIPTION

A saved search is a sub class of EPrints::DataObj::SubObject.

Each one belongs to one and only one user, although one user may own multiple saved searches.

User Comments


CORE METADATA FIELDS

User Comments


id (counter)

The ID of the saved search,

User Comments


name (text)

A name assigned to the saved search.

User Comments


spec (search)

A serialization of the search specification.

User Comments


frequency (set)

How often to send saves search email updates.

User Comments


mailempty (boolean)

Whether to send saved search email updates if there are no results.

User Comments


additional_recipients (text)

Additional email addresses to send updates about saved search results.

User Comments


public (boolean)

If the saved search results should be publicly accessible.

User Comments


REFERENCES AND RELATED OBJECTS

User Comments


userid (itemref)

The ID of the user to whom created this saved search.

User Comments


INSTANCE VARIABLES

Also see [[API:<EPrints/DataObj#INSTANCE_VARIABLES|EPrints::DataObj]].

User Comments


$self->{user}

The user who owns this saved search.

User Comments


METHODS

User Comments


Constructor Methods

User Comments


create

$saved_search = EPrints::DataObj::SavedSearch->create( $session, $userid )

Creates a new saved search, belonging to user with ID $userid.

User Comments


Class Methods

User Comments


get_system_field_info

$field_config = EPrints::DataObj::SavedSearch->get_system_field_info

Returns an array describing the system metadata of the saved search dataset.

User Comments


get_dataset_id

$dataset = EPrints::DataObj::SavedSearch->get_dataset_id

Returns the ID of the EPrints::DataSet object to which this record belongs.

User Comments


Object Methods

User Comments


get_dataset

$dataset = $saved_search->get_dataset

Get the dataset that this saved search covers.

User Comments


commit

$success = $saved_search->commit( [ $force ] )

Writes this object to the database.

If $force is not true then it only actually modifies the database if one or more fields have been changed.

Returns true if commit was successfully. Otherwise, returns false.

User Comments


get_user

$user = $saved_search->get_user

Returns the EPrints::DataObj::User which owns this saved search.

User Comments


make_searchexp

$searchexp = $saved_search->make_searchexp

Returns an EPrints::Search describing how to find the data objects which are in the scope of this saved search.

User Comments


send_out_alert

$saved_search->send_out_alert

Sends out an email for this subscription. If there are no matching new data objects then an email is only sent if the saved search has mailempty set to true.

User Comments


has_owner

$boolean = $saved_search->has_owner( $possible_owner )

Returns true if $possible_owner is the same as the owner of this saved search. Otherwise, returns false.

User Comments


parent

$parent = $saved_search->parent

Returns the parent data object for this saved search. I.e. the user who owns this saved search. This is similar to get_user but is not as fault tolerant and does set instance variable:

$self->{user}
 

User Comments


get_url

$url = $saved_search->get_url( [ $staff ] )

Gets the URL for this saved search. Currently $staff will not effect the URL but in future this may return a specialised URL for staff only.

User Comments


Utility Methods

User Comments


process_set

EPrints::DataObj::SavedSearch::process_set( $session, $frequency );

Static method.

Calls send_out_alert on every saved search with a frequency matching $frequency.

Also saves a file logging that the alerts for this frequency was sent out at the current time.

User Comments


get_last_timestamp

$timestamp = EPrints::DataObj::SavedSearch::get_last_timestamp( $session, $frequency );

Static method.

Return sthe timestamp of the last time this $frequency of alert was sent.

User Comments


SEE ALSO

EPrints::DataObj::SubObject, EPrints::DataObj and EPrints::DataSet.

User Comments


COPYRIGHT

© Copyright 2022 University of Southampton.

EPrints 3.4 is supplied by EPrints Services.

http://www.eprints.org/eprints-3.4/

LICENSE

This file is part of EPrints 3.4 http://www.eprints.org/.

EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.

EPrints 3.4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints 3.4. If not, see http://www.gnu.org/licenses/.

User Comments