Difference between revisions of "Eprint search simple.pl"
(Added page about config file) |
(Added example) |
||
| Line 11: | Line 11: | ||
* '''<code>default_order</code>''' - The default order search results will appear for simple search. | * '''<code>default_order</code>''' - The default order search results will appear for simple search. | ||
* '''<code>show_zero_results</code>''' - Should the simple search go to the results page if there are no results of stay on the search form page with a warning about no results. | * '''<code>show_zero_results</code>''' - Should the simple search go to the results page if there are no results of stay on the search form page with a warning about no results. | ||
| + | |||
| + | == Example == | ||
| + | $c->{search}->{simple} = { | ||
| + | search_fields => [ | ||
| + | { | ||
| + | id => "q", | ||
| + | meta_fields => [ | ||
| + | $EPrints::Utils::FULLTEXT, | ||
| + | "title", | ||
| + | "abstract", | ||
| + | "creators_name", | ||
| + | "date" | ||
| + | ] | ||
| + | }, | ||
| + | ], | ||
| + | preamble_phrase => "cgi/search:preamble", | ||
| + | title_phrase => "cgi/search:simple_search", | ||
| + | citation => "result", | ||
| + | page_size => 20, | ||
| + | order_methods => { | ||
| + | "byyear" => "-date/creators_name/title", | ||
| + | "byyearoldest" => "date/creators_name/title", | ||
| + | "byname" => "creators_name/-date/title", | ||
| + | "bytitle" => "title/creators_name/-date" | ||
| + | }, | ||
| + | default_order => "byyear", | ||
| + | }; | ||
== See Also == | == See Also == | ||
* [[API:EPrints/Search]] | * [[API:EPrints/Search]] | ||
Latest revision as of 19:17, 30 January 2022
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
eprint_search_simple.pl contains configuration for the simple search on eprint data objects, which can be found on the path /cgi/search/simple (e.g. https://eprints.example.org/cgi/search/simple). This configuration is stored under $c->{search}->{simple} hash reference. This contains the following parts:
search_fields- The fields that the simple search will query.preamble_phrase- The HTML phrase that will appear at the top of the simple search form explaining who to use it. By default commented out as simple search form is basically self-explanatory.title_phrase- The HTML phrase title, which appears as the main heading on the simple search page.citation- The citation format for items in the results page of simple search.page_size- The number of results that should appear per page.order_methods- Ordering options provided at the top of the simple search results page.default_order- The default order search results will appear for simple search.show_zero_results- Should the simple search go to the results page if there are no results of stay on the search form page with a warning about no results.
Example
$c->{search}->{simple} = {
search_fields => [
{
id => "q",
meta_fields => [
$EPrints::Utils::FULLTEXT,
"title",
"abstract",
"creators_name",
"date"
]
},
],
preamble_phrase => "cgi/search:preamble",
title_phrase => "cgi/search:simple_search",
citation => "result",
page_size => 20,
order_methods => {
"byyear" => "-date/creators_name/title",
"byyearoldest" => "date/creators_name/title",
"byname" => "creators_name/-date/title",
"bytitle" => "title/creators_name/-date"
},
default_order => "byyear",
};