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

From EPrints Documentation
Jump to: navigation, search
Line 1: Line 1:
 
<!-- Pod2Wiki=_preamble_  
 
<!-- Pod2Wiki=_preamble_  
This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.
+
This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.
  -->
+
  -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/DataObj/SavedSearch.pm|package_name=EPrints::DataObj::SavedSearch}}[[Category:API|SAVEDSEARCH]][[Category:API:EPrints/DataObj|SAVEDSEARCH]]<div><!-- Edit below this comment -->
__NOTOC__
 
{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/DataObj/SavedSearch.pm|package_name=EPrints::DataObj::SavedSearch}}[[Category:API|SavedSearch]]<div><!-- Edit below this comment -->
 
  
  
<!-- Pod2Wiki=head_name --></div>
+
<!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name -->
 
==NAME==
 
==NAME==
 
'''EPrints::DataObj::SavedSearch''' - Single saved search.
 
'''EPrints::DataObj::SavedSearch''' - Single saved search.
  
 
<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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=head_description --></div>
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_description -->
 
==DESCRIPTION==
 
==DESCRIPTION==
A saved search is a sub class of EPrints::DataObj.
+
A saved search is a sub class of [[API:EPrints/DataObj|EPrints::DataObj]].
  
 
Each one belongs to one and only one user, although one user may own multiple saved searches.
 
Each one belongs to one and only one user, although one user may own multiple saved searches.
  
 
<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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=item_get_system_field_info --></div>
+
<!-- Pod2Wiki= -->
===$field_config = EPrints::DataObj::SavedSearch-&gt;get_system_field_info===
+
</div>
 +
<!-- Pod2Wiki=head_instance_variables -->
 +
==INSTANCE VARIABLES==
 +
<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>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_$self->{user} -->
 +
===$self-&gt;{user}===
 +
 
 +
The user who owns this saved search.
 +
 
 +
<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>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_methods -->
 +
==METHODS==
 +
<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>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_constructor_methods -->
 +
===Constructor Methods===
 +
<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>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_create -->
 +
====create====
 +
 
 +
$saved_search = EPrints::DataObj::SavedSearch-&gt;create( $session, $userid )
 +
Creates a new saved search, belonging to user with ID <tt>$userid</tt>.
 +
 
 +
<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>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_class_methods -->
 +
===Class Methods===
 +
<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>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_system_field_info -->
 +
====get_system_field_info====
 +
 
 +
$field_config = EPrints::DataObj::SavedSearch-&gt;get_system_field_info
 +
Returns an array describing the system metadata of the saved search  dataset.
 +
 
 +
<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>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_dataset_id -->
 +
====get_dataset_id====
  
Return an array describing the system metadata of the saved search. dataset.
+
$dataset = EPrints::DataObj::SavedSearch-&gt;get_dataset_id
 +
Returns the ID of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record  belongs.
  
 
<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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=item_get_dataset_id --></div>
+
<!-- Pod2Wiki= -->
===$dataset = EPrints::DataObj::SavedSearch-&gt;get_dataset_id===
+
</div>
 +
<!-- Pod2Wiki=head_object_methods -->
 +
===Object Methods===
 +
<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>
 +
<!-- Edit below this comment -->
  
Returns the id of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs.
+
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_dataset -->
 +
====get_dataset====
 +
 
 +
$dataset = $saved_search-&gt;get_dataset
 +
Get the dataset that this saved search covers.
  
 
<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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=item_commit --></div>
+
<!-- Pod2Wiki= -->
===$success = $saved_search-&gt;commit( [$force] )===
+
</div>
 +
<!-- Pod2Wiki=item_commit -->
 +
====commit====
  
Write this object to the database.
+
$success = $saved_search-&gt;commit( [ $force ] )
 +
Writes this object to the database.
  
If $force isn't true then it only actually modifies the database if one or more fields have been changed.
+
If <tt>$force</tt> is not true then it only actually modifies the database if one or more fields have been changed.
 +
 
 +
Returns <tt>true</tt> if commit was successfully. Otherwise, returns  <tt>false</tt>.
  
 
<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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=item_get_user --></div>
+
<!-- Pod2Wiki= -->
===$user = $saved_search-&gt;get_user===
+
</div>
 +
<!-- Pod2Wiki=item_get_user -->
 +
====get_user====
  
Return the EPrints::User which owns this saved search.
+
$user = $saved_search-&gt;get_user
 +
Returns the <tt>EPrints::DataObj::User</tt> which owns this saved search.
  
 
<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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=item_make_searchexp --></div>
+
<!-- Pod2Wiki= -->
===$searchexp = $saved_search-&gt;make_searchexp===
+
</div>
 +
<!-- Pod2Wiki=item_make_searchexp -->
 +
====make_searchexp====
  
Return a EPrints::Search describing how to find the eprints which are in the scope of this saved search.
+
$searchexp = $saved_search-&gt;make_searchexp
 +
Returns an [[API:EPrints/Search|EPrints::Search]] describing how to find the data objects which are in the scope of this saved search.
  
 
<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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=item_send_out_alert --></div>
+
<!-- Pod2Wiki= -->
===$saved_search-&gt;send_out_alert===
+
</div>
 +
<!-- Pod2Wiki=item_send_out_alert -->
 +
====send_out_alert====
  
Send out an email for this subcription. If there are no matching new items then an email is only sent if the saved search has mailempty set to true.
+
$saved_search-&gt;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 <tt>mailempty</tt> set to <tt>true</tt>.
  
 
<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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=item_process_set --></div>
+
<!-- Pod2Wiki= -->
===EPrints::DataObj::SavedSearch::process_set( $session, $frequency );===
+
</div>
 +
<!-- Pod2Wiki=item_has_owner -->
 +
====has_owner====
 +
 
 +
$boolean = $saved_search-&gt;has_owner( $possible_owner )
 +
Returns <tt>true</tt> if <tt>$possible_owner</tt> is the same as the owner of this saved search. Otherwise, returns <tt>false</tt>.
  
Static method. Calls send_out_alert on every saved search with a frequency matching $frequency.
+
<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>
 +
<!-- Edit below this comment -->
  
Also saves a file logging that the alerts for this frequency was sent out at the current time.
 
  
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_parent -->
 +
====parent====
 +
 +
$parent = $saved_search-&gt;parent
 +
Returns the parent data object for this saved search. I.e. the user  who owns this saved search.  This is similar to [[API:EPrints/DataObj/SavedSearch#get_user|get_user]] but is  not as fault tolerant and does set instance variable:
 +
 +
$self-&gt;{user}
 +
 
 
<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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=item_get_last_timestamp --></div>
+
<!-- Pod2Wiki= -->
===$timestamp = EPrints::DataObj::SavedSearch::get_last_timestamp( $session, $frequency );===
+
</div>
 +
<!-- Pod2Wiki=item_get_url -->
 +
====get_url====
 +
 
 +
$url = $saved_search-&gt;get_url( [ $staff ] )
 +
Gets the URL for this saved search.  Currently <tt>$staff</tt> will not  effect the URL but in future this may return a specialised URL for  staff only.
 +
 
 +
<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>
 +
<!-- Edit below this comment -->
  
Static method. Return the timestamp of the last time this frequency  of alert was sent.
 
  
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_object_methods -->
 +
===Object 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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=item_has_owner --></div>
+
<!-- Pod2Wiki= -->
===$boolean = $user-&gt;has_owner( $possible_owner )===
+
</div>
 +
<!-- Pod2Wiki=item_process_set -->
 +
====process_set====
 +
 
 +
EPrints::DataObj::SavedSearch::process_set( $session, $frequency );
 +
Static method.
 +
 
 +
Calls <tt>send_out_alert</tt> on every saved search with a frequency  matching <tt>$frequency</tt>.
 +
 
 +
Also saves a file logging that the alerts for this frequency was sent  out at the current time.
 +
 
 +
<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>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_last_timestamp -->
 +
====get_last_timestamp====
 +
 
 +
$timestamp = EPrints::DataObj::SavedSearch::get_last_timestamp( $session, $frequency );
 +
Static method.
 +
 
 +
Return sthe timestamp of the last time this <tt>$frequency</tt> of alert was  sent.
 +
 
 +
<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>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_see_also -->
 +
==SEE ALSO==
 +
[[API:EPrints/DataObj|EPrints::DataObj]] and [[API:EPrints/DataSet|EPrints::DataSet]].
 +
 
 +
<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>
 +
<!-- Edit below this comment -->
  
True if the users are the same record.
 
  
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_copyright -->
 +
==COPYRIGHT==
 +
{{API:Copyright}}
 
<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%; '>
<h4><span style='display:none'>User Comments</span></h4>
+
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 +
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->
 
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->

Revision as of 00:06, 4 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.

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

User Comments


INSTANCE VARIABLES

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


Object 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 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