Dspace 5.4 and searching with REST

529 views
Skip to first unread message

Mark Ehle

unread,
Feb 10, 2016, 7:41:44 AM2/10/16
to DSpace Technical Support
Folks -

We are in the middle of replacing our really old instance of dspace (3.?) with 5.4. I have a VM all cranked up and ready to go with a stock install of Dspace 5.4, and have imported all of our data with no trouble. I can search and retrieve data from the jspui. Very nice work on the UI btw. Much better than before.

As I would like to create a custom browse interface using openseadragon, I have been playing around with the REST interface and it seems to do what it's supposed to but I can't seem to make it search for anything.

This URL:
    http://localhost:8080/rest/collections
returns a JSON formatted list of collections as it should.

This...

http://localhost:8080/rest/discover.json?q=*

...returns nothing. What am I doing wrong?


Thanks!

Mark Ehle
Willard Library
Battle Creek, MI

helix84

unread,
Feb 10, 2016, 7:58:29 AM2/10/16
to Mark Ehle, DSpace Technical Support
Hi Mark,

DSpace REST API doesn't have an endpoint for search at this time
(although there is an endpoint to find item by metadata value:
/items/find-by-metadata-field). I recommend using Solr for search
until we have a REST endpoint for Discovery (we won't have one yet as
of DSpace 6).


Regards,
~~helix84

Compulsory reading: DSpace Mailing List Etiquette
https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Mark Ehle

unread,
Feb 11, 2016, 3:31:21 PM2/11/16
to DSpace Technical Support
Ok - making progress with querying dspace's SOLR and then using REST. But - how do you find the primary bitstream thumbnail? I can get a list of bitstreams and find the thumbnails, but if there are more than one, there is no indication which is which.

Terry Brady

unread,
Feb 11, 2016, 4:03:26 PM2/11/16
to Mark Ehle, DSpace Technical Support
Mark,

Another approach would be to write a customized REST endpoint that will query SOLR using the DSpace API.  

If you go with this approach, you can store your custom endpoint in dspace/modules/rest.  

We had some legacy code that queried SOLR directly.  We have been able to replace that legacy code with a new custom endpoint.

If this approach sounds useful, I will be happy to share some example code.

     DiscoverQuery query = new DiscoverQuery();
    query.setQuery(search);
    query.setMaxResults(rows);
    query.setStart(from);
    DiscoverResult discoverResult = null;
    if (scopeHandle != null) {
    DSpaceObject obj = HandleManager.resolveToObject(context, scopeHandle.trim());
    if (obj != null) {
    discoverResult = SearchUtils.getSearchService().search(context, obj, query);
    }
   
   
    if (discoverResult == null){
    discoverResult = SearchUtils.getSearchService().search(context, query);           
    }


Terry

--
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To post to this group, send email to dspac...@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.



--
Terry Brady
Applications Programmer Analyst
Georgetown University Library Information Technology
425-298-5498 (Seattle, WA)

Mark Ehle

unread,
Feb 11, 2016, 4:54:47 PM2/11/16
to DSpace Technical Support
Well, if I knew anything about Java, I would be interested. Sadly, the code you posted means nothing to me.

Seems to me that the REST interface would benefit if it presented which bitstream was primary.

Mark Ehle

unread,
Feb 18, 2016, 6:11:54 PM2/18/16
to DSpace Technical Support
So after messing around with dspace's REST and getting a semi-working php search to work with it, I am struck by how much I still had to talk to SOLR and postgres directly. So it got me wondering, just what is the REST interface for? I was under the impression that I would be able to use it to write a custom browse interface.

Here are the things I needed that I could not get from REST that I had to ask SOLR and postgres for:
  • Search dspace for anything
  • Give me the total number found.
  • Find out what the primary bitstream is.
  • The owning collection of an item
I am guessing that I had the wrong impression of REST. What was it's intended purpose in dspace? Is it a work in progress? Will there be more features? Or am I completely barking up the wrong tree?

Thanks -

Mark

Terry Brady

unread,
Feb 18, 2016, 6:50:28 PM2/18/16
to Mark Ehle, DSpace Technical Support
Mark,

The DSpace REST API has been enhanced with each of the major DSpace releases, and it is still a work in progress.

You may be interested in the discussions around the future of the DSpace User Interface.  https://wiki.duraspace.org/display/DSPACE/DSpace+UI+Prototype+Challenge

The evolution of the DSpace User Interface will likely require/drive changes to the REST API.

Terry


--

Mark Ehle

unread,
Feb 18, 2016, 8:44:28 PM2/18/16
to DSpace Technical Support

---------- Forwarded message ----------
From: Mark Ehle <mark...@gmail.com>
Date: Thu, Feb 18, 2016 at 6:55 PM
Subject: Re: [dspace-tech] Re: Dspace 5.4 and searching with REST
To: Terry Brady <Terry...@georgetown.edu>


OK - good to know. What was/is the intended purpose of the rest interface?  Who is using it now and for what?

Thanks again -

Mark

helix84

unread,
Feb 19, 2016, 4:12:45 AM2/19/16
to Mark Ehle, DSpace Technical Support
On Fri, Feb 19, 2016 at 12:11 AM, Mark Ehle <mark...@gmail.com> wrote:
> The owning collection of an item

Did you use the expand parameter?

https://demo.dspace.org/rest/items?expand=parentCollection

Mark Ehle

unread,
Feb 19, 2016, 7:55:49 AM2/19/16
to Ivan Masár, DSpace Technical Support
Nope, hadn't been using that. That does help.Thanks!

Now - as far as the primary bitstream and it's thumbnail, is that in REST somewhere, or do I still have to ask postgres?

I am sorry to be a pest about this, but I can't put dspace's jspui or xmlui in front of our inner-city public library patrons, and I just don't have skill with java to customize either but I code PHP pretty well so that's what I am doing. Our customers need to see pretty pictures right up front and hence the custom browsing interface we have now with cooliris and it's replacement I am coding now. My manager says either I put a pretty face on dspace or we are going to have to move on. I would rather not. And I know that there is some work being done in that area right now with the UI contest and all, but I don't see it moving in a direction that makes dspace more accessible to non-librarians.

I am aiming for something similar to this: http://www.bacarchive.org.uk/

Thanks -

Mark

helix84

unread,
Feb 19, 2016, 8:02:42 AM2/19/16
to Mark Ehle, DSpace Technical Support
Hi Mark,

the plan is definitely to extend the REST API to provide those
functions, it just doesn't have them yet. The DSpace 7 UI decision
could be a huge boon to add all the needed endpoints for implementing
a UI in any non-Java language. Using Solr or the DB where REST API
falls short is the best thing you can do at the moment.

This could be potentialy interesting for you as a stopgap measure:
http://postgrest.com/

Mark Ehle

unread,
Feb 19, 2016, 8:17:05 AM2/19/16
to Ivan Masár, DSpace Technical Support
Thanks, Ivan. I always get the sense that you understand what I am trying to do and I really appreciate that. It's good to know I am basically on the right track.

I don't know if you remember, but you were coaching me a while back when I was coding up our digitized newspaper portal. It wound up being a huge success and we now serve up, as of this morning, 1,373,233 pages on it and the number grows daily. After trying hard to make it work,I made the decision not to use dspace for that because I would have to really twist it hard to fit but by learning more about how dspace works (especially SOLR) I was able to, with your help, come up with an effective tool for our librarians and patrons. It does not happen often, but when it's down my phone rings off the hook.

It strikes me that it's odd that dspace would not make searching through rest a feature right up front. What was the thought process behind that?

postgrest.com looks very interesting. I will be checking that out!

helix84

unread,
Feb 19, 2016, 8:35:56 AM2/19/16
to Mark Ehle, DSpace Technical Support
Yes, I remember. Glad to hear it's chugging along and getting many visitors.

There was a pull request to add a searching endpoint at one time, but
diverged from the latest development in REST and wasn't easy to merge.
Moreover, it was based on Lucene and the trend was to move DSpace to a
single search backend which turned out to be Solr.

I'm pretty sure we'll see a search endpoint sooner (DSpace 7) rather
than later. It should wrap our discovery abstraction interface rather
than Solr directly to allow us to swap the search backend if we decide
to do so in the future.

Luiz dos Santos

unread,
Feb 19, 2016, 9:03:43 AM2/19/16
to Terry Brady, DSpace Technical Support

Hi Terry,

   I quick question,  this DiscoverQuery is available in Dspace 5?

Tks
Luiz

helix84

unread,
Feb 19, 2016, 9:05:41 AM2/19/16
to Luiz dos Santos, Terry Brady, DSpace Technical Support
On Fri, Feb 19, 2016 at 3:03 PM, Luiz dos Santos <lui...@gmail.com> wrote:
> I quick question, this DiscoverQuery is available in Dspace 5?

Yes, it is:

https://github.com/DSpace/DSpace/blob/dspace-5_x/dspace-api/src/main/java/org/dspace/discovery/DiscoverQuery.java
Reply all
Reply to author
Forward
0 new messages