[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Re: Autocompletion, external source: ROMEO



On 01/12/2015 05:23 ??, George Mamalakis wrote:
> On 01/12/2015 01:14 ??, George Mamalakis wrote:
>> On 01/12/2015 09:59 ??, Ian Stuart wrote:
>>> On 30/11/15 15:52, George Mamalakis wrote:
>>>> Hi everybody,
>>>>
>>>> I'm almost done with my installation/configuration. These are my last
>>>> questions, and once I'm through with them I'll finally air my EPrints
>>>> installation!! :):)
>>>>
>>>> My library staff asked me to use the ROMEO url lookup (by looking up its
>>>> database). So, I tried to follow the specific wiki section of the
>>>> autocompletion guide
>>>> (http://wiki.eprints.org/w/Autocompletion#external_source), aaaaand...of
>>>> course I didn't manage it :(.
>>>>
>>>> I edited my field to call the new lookup function and added the new
>>>> lookup function in my config. I don't seem to be getting any errors in
>>>> my apache log files, and I can see with tcpdump that whenever the
>>>> autocomplete ajax request is triggered, traffic from my machine to port
>>>> 80 of www.nottingham.ac.uk is generated (which probably implies that my
>>>> queries are sent there via some service). Nonetheless, I don't seem to
>>>> see any feedback in my field.
>>>>
>>>> More specifically, my cfg/workflows/eprint/default.xml is as follows:
>>>>
>>>> <component type="Field::Multi"><field ref="ml_title" required="yes"
>>>> input_lookup_url="{$config{rel_cgipath}}/users/lookup/get_journals"
>>>> input_lookup_params="id={eprintid}&amp;dataset=eprint&amp;field=ml_title"/></component>
>>>>
>>>>
>>>> since I'm using a multilingual setup (so I'm using the ml_title field
>>>> instead of the title field), and my
>>>> ~eprints/cgi/users/lookup/get_journals is exactly the one shown in the
>>>> wiki page.
>>> I recognise my writing style :)
>>>
>>> Is cgi/get_journals returning any data?
>>>
>>> Try knocking up a quick script which basically does "perl get_journals"
>>> - but includes all the stuff you need to get the library path for
>>> EPrints, and provides the current repository.
>>>
>>> The get_journals script as on the page should be dumping html fragments
>>> into your apache error_log (the ' warn "\n\n$html\n\n";' line in
>>> 'process_journal' - if you're seeing nothing, then the LWP::UserAgent
>>> call isn't getting any data - add some debugging statements into the
>>> code to check the value of $query, and of $content (in 'get_journals')
>>>
>> :):)
>>
>> OK Ian, I'll look into it and will come with my findings!
>>
>> Thanks!
>>
> Hi Ian,
>
> I think that the problem was related to me having misunderstood what to
> expect :). I thought that ROMEO was looking for a publication's title
> (title field), not Journal's title (publication field), so I was not
> getting any results when I used some known publication titles. Once I
> saw the query sent in the specific code:
>
> my $query =
> "http://www.sherpa.ac.uk/romeoapi.php?qtype=starts&jtitle=$journal";;
>
> I realised my mistake. So, I tried the query myself with some known
> journal titles, and found out it didn't work either. So, for example
> running:
>
> http://www.sherpa.ac.uk/romeoapi.php?qtype=starts&jtitle=computers
>
> in my browser returned notFound, whereas it shouldn't. Surfing through
> sherpa.ac.uk site, I read that they are now using a different api
> (http://www.sherpa.ac.uk/romeo/api.html), from where I copied the new
> url in the proper place, and now it seems to work. The change is this:
>
> my $query =
> "http://www.sherpa.ac.uk/romeo/api29.php?qtype=starts&jtitle=$journal";;
>
> OK, so the fun part is that I accidentally found a bug and its
> "solution" :):).
>
> Sadly, I'm not super-convinced that it works very well (the results are
> OK, but maybe the return-value syntax has changed or something), because
> when playing with it I see that once I start typing a query using the
> form (let's say "computers") the form returns some suggestions. Once I
> delete it and type something else (eg. applied) then the new suggestions
> contain some suggestions from the previous query -especially if the
> mouse pointer is on top of the list that appears-, and generally results
> start becoming a bit messy. Hence, I am not sure we should change the
> Wiki yet, because maybe the script still needs some changes.
>
> Thanks again for the help!!
>
> George.
>
Moreover, does anybody know how someone could achieve the autocompletion 
of journal title found here: 
http://www.eprints.org/software/training/users/depositing.php  ? 
(including the colours I mean).

Thanks 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