Difference between revisions of "Eprint search advanced.pl"

From EPrints Documentation
Jump to: navigation, search
(Added page about config file)
 
(Added example)
Line 11: Line 11:
 
* '''<code>default_order</code>''' - The default order search results will appear for advanced search.
 
* '''<code>default_order</code>''' - The default order search results will appear for advanced search.
 
* '''<code>show_zero_results</code>''' - Should the advanced 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 advanced 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}->{advanced} ={
 +
        search_fields => [
 +
                { meta_fields => [ $EPrints::Utils::FULLTEXT ] },
 +
                { meta_fields => [ "title" ] },
 +
                { meta_fields => [ "creators_name" ] },
 +
                { meta_fields => [ "creators_id" ] },
 +
                { meta_fields => [ "abstract" ] },
 +
                { meta_fields => [ "keywords" ] },
 +
                { meta_fields => [ "subjects" ] },
 +
 +
                { meta_fields => [ "divisions" ] },
 +
 +
                { meta_fields => [ "type" ] },
 +
                { meta_fields => [ "department" ] },
 +
                { meta_fields => [ "editors_name" ] },
 +
                { meta_fields => [ "ispublished" ] },
 +
                { meta_fields => [ "refereed" ] },
 +
                { meta_fields => [ "publication" ] },
 +
                { meta_fields => [ "date" ] }
 +
        ],
 +
        preamble_phrase => "cgi/advsearch:preamble",
 +
        title_phrase => "cgi/advsearch:adv_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]]

Revision as of 19:18, 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


Back to cfg.d

eprint_search_advanced.pl contains configuration for the advanced searchon eprint data objects, which can be found on the path /cgi/search/advanced (e.g. https://eprints.example.org/cgi/search/advanced). This configuration is stored under $c->{search}->{advanced} hash reference. This contains the following parts:

  • search_fields - The fields that the advanced search will query.
  • preamble_phrase - The HTML phrase that will appear at the top of the advanced search form explaining who to use it.
  • title_phrase - The HTML phrase title, which appears as the main heading on the advanced search page.
  • citation - The citation format for items in the results page of advanced search.
  • page_size - The number of results that should appear per page.
  • order_methods - Ordering options provided at the top of the advanced search results page.
  • default_order - The default order search results will appear for advanced search.
  • show_zero_results - Should the advanced 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}->{advanced} ={

        search_fields => [
                { meta_fields => [ $EPrints::Utils::FULLTEXT ] },
                { meta_fields => [ "title" ] },
                { meta_fields => [ "creators_name" ] },
                { meta_fields => [ "creators_id" ] },
                { meta_fields => [ "abstract" ] },
                { meta_fields => [ "keywords" ] },
                { meta_fields => [ "subjects" ] },

                { meta_fields => [ "divisions" ] },

                { meta_fields => [ "type" ] },
                { meta_fields => [ "department" ] },
                { meta_fields => [ "editors_name" ] },
                { meta_fields => [ "ispublished" ] },
                { meta_fields => [ "refereed" ] },
                { meta_fields => [ "publication" ] },
                { meta_fields => [ "date" ] }
        ],
        preamble_phrase => "cgi/advsearch:preamble",
        title_phrase => "cgi/advsearch:adv_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