[EP-tech] Re: How to set a field to be multilang (search)

George Mamalakis mamalos at eng.auth.gr
Tue Oct 6 11:29:25 BST 2015


Hi all,

As promised, I'm back with the search within multilang fields:). My 
problem is that it seems that I cannot search correctly within my 
multilingual title and abstract fields (ml_title and ml_abstract 
respectively), unless my dataset is reindexed manually.

What I've done so far is the following: I've added a script for each 
type of search (advanced and simple) that basically replaces the 
original fields with their multilingual counterparts. So I've added 
archives/myrepo/cfg/cfg.d/eprint_search_advanced_local.pl:

$c->{search}->{advanced} =
{
     search_fields => [
         { meta_fields => [ "documents" ] },
         { meta_fields => [ "ml_title" ] },
         { meta_fields => [ "creators_name" ] },
         { meta_fields => [ "ml_abstract" ] },
         { meta_fields => [ "date" ] },
         { meta_fields => [ "collection" ] },
         { meta_fields => [ "keywords" ] },
         { meta_fields => [ "subjects" ] },
         { meta_fields => [ "type" ] },
         { meta_fields => [ "department" ] },
         { meta_fields => [ "editors_name" ] },
         { meta_fields => [ "ispublished" ] },
         { meta_fields => [ "refereed" ] },
         { meta_fields => [ "publication" ] },
         { meta_fields => [ "documents.format" ] },
     ],
     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",
     show_zero_results => 1,
};

and archives/testpamak1/cfg/cfg.d/eprint_search_simple_local.pl:

$c->{search}->{simple} =
{
     search_fields => [
         {
             id => "q",
             meta_fields => [
                 "documents",
                 "ml_title",
                 "ml_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",
     show_zero_results => 1,
};


When I search for a keyword which exists in one of my deposits' ml_title 
field, both search functions return nothing, unless I manually reindex 
my dataset. After that, searches work as expected.

What exactly am I doing wrong and needs to be taken care of?

Thanks all in advance!

George.

-- 
George Mamalakis

IT and Security Officer,
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379




More information about the Eprints-tech mailing list