[EP-tech] EPrints Search - Latest Items
Yuri
yurj at alfa.it
Wed Apr 29 08:31:04 BST 2020
Thanks for sharing, I'm sure most of us will will appreciate it. A
generic latest-like page with a search.pl search entry and some
parameters could be useful in a lot of situations.
Also reusing the advanced search can help:
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flivrepository.liverpool.ac.uk%2Fcgi%2Fsearch%2Farchive%2Fadvanced%3Ftitle_merge%3DANY%26title%3Dcovid%2Bcoronavirus&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=ZHQPrr1phlHZRYVG3HGkV%2BN3%2FhwpWdbs36OBAAWsh6o%3D&reserved=0
but it does AND by default if you add the keyword, so if you add the
keyword you get only 1 result:
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flivrepository.liverpool.ac.uk%2Fcgi%2Fsearch%2Farchive%2Fadvanced%3Ftitle_merge%3DANY%26title%3Dcovid%2Bcoronavirus%26%26keywords_merge%3DANY%26keywords%3Dcovid%2Bcoronavirus%2Bcovid19&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=6F%2FNKJYizMRQ%2FAEhGt5UM3FTAcoPLBZkvM8OiH6pys0%3D&reserved=0
So adding a way to add an "or" search in search.pl search entries could
help.
Il 28/04/20 21:03, James Kerwin via Eprints-tech ha scritto:
> Hi Yuri,
>
> Thank you for that. I had looked at the wiki page for this previously,
> but I'd not registered the add_field part. I was trying to add
> fiels/terms to the structure in the latest_tool.pl
> <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Flatest_tool.pl%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=fpjPHbojBFtESAHsXy9iMkBgnhhyuWsMwircvNQ5UGU%3D&reserved=0>
> file that sets up the filters.
>
> The part I addedlooks a bit like this, with some other parts that made
> it work too.
>
> I'm 99% sure most on this list could do this task quicker and better
> than I have, but tomorrow I'll share the various bits of code and
> where to put them if anybody is interested.
>
> This is the results page for it:
>
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flivrepository.liverpool.ac.uk%2Fcgi%2Flatest_covid&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=TuGlTH0GzMEphPRwPB7ctEVF%2Fa7glc9SlCXm3e%2FVVnA%3D&reserved=0
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flivrepository.liverpool.ac.uk%2Fcgi%2Flatest_covid&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=TuGlTH0GzMEphPRwPB7ctEVF%2Fa7glc9SlCXm3e%2FVVnA%3D&reserved=0>
>
>
> I've also put a box on the repo home page which updates on refresh
> (again, exactly how the latest_tool works just with a different search
> query and page title etc.).
>
> Thanks again for the pointers, I really appreciate it.
>
> James
>
> The part I added looks a bit like this, with some other parts that
> made it work too:
>
> $searchexp->add_field(
> fields => [
> $ds->field( "title" ),
> ],
> value => "coronavirus",
> );
> $searchexp->add_field(
> fields => [
> $ds->field( "keywords" ),
> ],
> value => "coronavirus",
> );
>
> On Mon, Apr 27, 2020 at 4:57 PM Yuri via Eprints-tech
> <eprints-tech at ecs.soton.ac.uk <mailto:eprints-tech at ecs.soton.ac.uk>>
> wrote:
>
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F3.3%2Fbin%2Flift_embargos&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=leTHo57nesOr682Hjuo17uXNZF5m3Cx%2BExQ6PZhzDFg%3D&reserved=0
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F3.3%2Fbin%2Flift_embargos&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=leTHo57nesOr682Hjuo17uXNZF5m3Cx%2BExQ6PZhzDFg%3D&reserved=0>
>
> and
>
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FAPI%3AEPrints%2FSearch&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=2Tr4XrxwGn8wMfXOZ8PR0pPp7NYy1kjm6QXAi19VwL4%3D&reserved=0
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FAPI%3AEPrints%2FSearch&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=2Tr4XrxwGn8wMfXOZ8PR0pPp7NYy1kjm6QXAi19VwL4%3D&reserved=0>
>
> should be a good starting point
>
> Il 27/04/20 17:06, James Kerwin via Eprints-tech ha scritto:
>> Hello All,
>>
>> I hope everyone is well in body and mind.
>>
>> I need some help with the EPrints search function. I have been
>> asked to add a box to the repository homepage that lists the
>> latest coronavirus-related deposits.
>>
>> I'm hoping to search via keywords for "coronavirus" and
>> "covid-19". I also want to search for either of these terms in
>> titles. To do this I'm currently butchering a copy of
>> cgi/latest_tool.
>>
>> I can get the keywords part to work using:
>>
>> $c->{latest_rona_modes} = {
>>
>> default => { citation => "noauth" },
>>
>> fplatest => {
>>
>> citation => "popular", max => 5,
>>
>> #citation => "result", max => 3,
>>
>> filters => [
>>
>> #{ meta_fields => [
>> "full_text_status","full_text_status" ], value =>
>> ("none"||"public") }
>>
>> { meta_fields => [ "keywords" ], value => "covid-19"}
>>
>> This also works with "title" as you would expect.
>>
>> What I really want is to do a search where the keywords can be
>> "covid-19" OR "coronavirus" as well as including some allowance
>> for adding an:
>>
>> "OR title LIKE '%covid-19%' OR title LIKE 'coronavirus' in
>> MYSQL-speak.
>>
>> Am I able to do this using the EPrints::Search plugin? I've tried
>> reading the codumentation and experimenting with it, but I'm not
>> getting very far.
>>
>> If it's not possible I can think of a number of bodges for it,
>> but decided it was best to attempt the proper way first.
>>
>> Thanks,
>> James
>>
>> *** Options:http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
>> *** Archive:https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=c6xDukIcpflnX%2BuEV3Jyihdj%2FVd6hM6Nodw60XIOeoY%3D&reserved=0 <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=c6xDukIcpflnX%2BuEV3Jyihdj%2FVd6hM6Nodw60XIOeoY%3D&reserved=0>
>> *** EPrints community wiki:https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=Gz%2BmAD%2BDwe2EIlqbPpWJbw4uxhR4n15G%2FJF3qOvOuoE%3D&reserved=0 <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=Gz%2BmAD%2BDwe2EIlqbPpWJbw4uxhR4n15G%2FJF3qOvOuoE%3D&reserved=0>
> *** Options:
> http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=c6xDukIcpflnX%2BuEV3Jyihdj%2FVd6hM6Nodw60XIOeoY%3D&reserved=0
> <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=c6xDukIcpflnX%2BuEV3Jyihdj%2FVd6hM6Nodw60XIOeoY%3D&reserved=0>
> *** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=Gz%2BmAD%2BDwe2EIlqbPpWJbw4uxhR4n15G%2FJF3qOvOuoE%3D&reserved=0
> <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=Gz%2BmAD%2BDwe2EIlqbPpWJbw4uxhR4n15G%2FJF3qOvOuoE%3D&reserved=0>
>
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=c6xDukIcpflnX%2BuEV3Jyihdj%2FVd6hM6Nodw60XIOeoY%3D&reserved=0
> *** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C9f845eae34204e56fa0008d7ec0f48c2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=Gz%2BmAD%2BDwe2EIlqbPpWJbw4uxhR4n15G%2FJF3qOvOuoE%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20200429/44dd50cd/attachment-0001.html
More information about the Eprints-tech
mailing list