Hi,

I tried to do something similar (all items with something in the field X), but 
it seems that find-by-metadata-field does not support wildcards, only exact 
matches. Helix84 suggested SOLR for me, There's also a new REST api for reports 
in 6.0 (Terry Brady suggested that to me). You can probably find the threads 
with my name & those mentioned.

For the other question, are there differences in the item access permissions 
and/or if any of the items are in the workflow or in the collections. I think 
the SQL queries will give you all the items, but I think there is some 
filtering done with the REST - didn't look very deeply into that, though.

Ilja

________________________________________
From: dspace-tech@googlegroups.com <dspace-tech@googlegroups.com> on behalf of 
Alan Orth <alan.o...@gmail.com>
Sent: Thursday, November 10, 2016 1:38:34 PM
To: DSpace Technical Support
Subject: [dspace-tech] Issues with REST find-by-metadata-field in DSpace 5

Hi,

We're trying to build an application that uses metadata from DSpace's REST API 
and I'm having some issues. We're testing on DSpace 5.5 with PostgreSQL.

First, it seems there is no way to use a wildcard value with the 
find-by-metadata-field endpoint—I want all items where a field 
`cg.subject.ilri` exists. Second, for another query, I'm not sure that the API 
is returning the correct results. Taking into account the text_lang of the 
metadata, the following database queries and REST API results don't add up. 
Here are the database results for null, blank, and en_US text_lang values:

dspace=# select count(text_value) from metadatavalue where resource_type_id=2 
and metadata_field_id=203 and text_value='SEEDS' and text_lang is null;
 count
-------
    15
dspace=# select count(text_value) from metadatavalue where resource_type_id=2 
and metadata_field_id=203 and text_value='SEEDS' and text_lang='';
 count
-------
     4
dspace=# select count(text_value) from metadatavalue where resource_type_id=2 
and metadata_field_id=203 and text_value='SEEDS' and text_lang='en_US';
 count
-------
    66

Then the API results, in the order of null, blank, and en_US language:

$ curl -s -H "accept: application/json" -H "Content-Type: application/json" -X 
POST "http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key": 
"cg.subject.ilri","value": "SEEDS"}' | jq length
55
$ curl -s -H "accept: application/json" -H "Content-Type: application/json" -X 
POST "http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key": 
"cg.subject.ilri","value": "SEEDS", "language":""}' | jq length
34
$ curl -s -H "accept: application/json" -H "Content-Type: application/json" -X 
POST "http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key": 
"cg.subject.ilri","value": "SEEDS", "language":"en_US"}' | jq length

The results don't even remotely match, and there are actually more results from 
the API than from the database (85 vs 89).

Does anyone know what's up with either of these issues? Thanks,
--

Alan Orth
alan.o...@gmail.com<mailto:alan.o...@gmail.com>
https://englishbulgaria.net
https://alaninkenya.org
https://mjanja.ch

--
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+unsubscr...@googlegroups.com<mailto:dspace-tech+unsubscr...@googlegroups.com>.
To post to this group, send email to 
dspace-tech@googlegroups.com<mailto:dspace-tech@googlegroups.com>.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to dspace-tech@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Reply via email to