Hi Andreas
Unfortunately the search service (q) is using still the old API, not
migrated to the Spring MVC API, so doesn't appear in Swagger test page and
also seem not documented.
Adding here some brief documentation that hope can be useful. I'll check
when time permits to include it in the official documentation:
*http://localhost:8080/geonetwork/srv/eng/q
<http://localhost:8080/geonetwork/srv/eng/q> *
*Query results parameters*
*• _content_type=json (returns results in json format, if not provided xml
format is used)*
• sortBy, sorts the results by different criteria (example,
sortBy=relevance):
• relevance (default sorting method if not provided)
• title (metadata title)
• changeDate (metadata datestamp)
• rating
• popularity
• denominatorDesc
• denominatorAsc
• sortOrder=reverse (used to sort alphabetically, for example when sorting
by title)
• from, to: used to return a subset of the results, usually for pagination
(example: from=1&to=20)
• *fast*, used to indicate the information to return. Values:
*• index: returns the metadata information from the Lucene index (a subset
of the*
*information). In most cases this is the best option as the retrieval of
information from the Lucene index is very fast.*
Returns the fields configured in
https://github.com/geonetwork/core-geonetwork/blob/
master/web/src/main/webapp/WEB-INF/config-lucene.xml#L107
• false: returns the raw (full) metadata, slower as should retrieve every
metadata from the database.
• If the parameter is not provided returns a minimal information of each
record: uuid, internal id, metadata schema, create/change dates
• buildSummary=false, used to indicate the information to return. Values:
• true (default if not provided the parameter): returns a summary element
with search facets
that can be used to filter the metadata.
• false: doesn’t return the summary element.
The summary is used typically to provide quick filters (facets) on the
search results page.
• summaryOnly
• 0 (default if not provided the parameter): returns the summary (depending
on the value ofthe parameter buildSummary) and results
• Any other value: returns the summary only.
• *resultType*: type of summary to return. Summaries are configured in
https://github.com/
geonetwork/core-geonetwork/blob/master/web/src/main/webapp/WEB-INF/config-
summary.xml#L132-L249
• hits (default value if not provided), returns the fields configured in
https://github.com/
geonetwork/core-geonetwork/blob/master/web/src/main/webapp/WEB-INF/config-
summary.xml#L185
*• details (recommended value to send), returns the fields configured in
https://github.com/
geonetwork/core-geonetwork/blob/master/web/src/main/webapp/WEB-INF/config-
summary.xml#L133*
• Other values in the summaries section are allowed
*Query filter parameters*
To filter the searches can be send any field(s) indexed in Lucene. For a
complete reference see
https://github.com/geonetwork/core-geonetwork/blob/master/schemas/iso19139/src/main/
plugin/iso19139/index-fields/index.xsl
Most relevant fields:
• any: There’s a special Lucene field that indexes all the text content in
the metadata, that is call any.
• http://localhost/geonetwork/srv/eng/q?
any=water&from=1&to=20&resultType=details&fast=index&_content_type=json
There’re some additional query fields, that use the content from the Lucene
field *any*.
• or: extract the tokens of the query parameter to return the results that
at least contain 1 of the tokens
• without: extract the tokens of the query parameter to return the results
that doesn’t contain any of the tokens.
• phrase: return the results that contain the exact text as provided in the
search query parameter.
• title: metadata title.
• abstract: metadata abstract.
• topicCat: metadata topic categories.
• keyword: metadata keywords.
• type: hierarchyLevel (dataset, service, etc.)
If provided several fields in the query, an AND query with all the fields
is executed, for example: • title=roads&topicCat=biota, returns the
metadata that contains roads in the title and have the topic category biota.
It can be done an OR query of several fields using this special format:
field1_OR_field2_OR_... =value. For example, title_OR_abstract=roads,
return the metadata that contain roads y the title or the abstract.
Additionally can be done an OR of several values for a field (this depends
on the Lucene field configuration), with the following format: field=value1
or value2 or ... For example, topicCat=biota or farming, return the
metadata that contain biota or farming. If would be provided as 2
parameters topicCat=biota&topicCat=farming would be returned only the
metadata that have both values.
*Query examples: *
-
Query with any field for metadata containing the value infraestructure:
http://localhost:8080/geonetwork/srv/eng/q?
any=infraestructure&_content_type=json&fast=index&from=1&resultType=det
ails&sortBy=relevance&to=20
-
Query datasets with title containing infraestructure:
http://localhost:8080/geonetwork/srv/eng/q?
title=infraestructure&type=dataset&_content_type=json&fast=index&from=1
&resultType=details&sortBy=relevance&to=20
Regards,
Jose García
On Mon, Apr 1, 2019 at 11:59 AM Andreas Böhme <andreas.boehme@anonymised.com.> wrote:
Hello all,
can anybody please give me an advice how I could use the geonetwork API
to query the geonetwork search (if possible), so I can use the return
values (JSON would be best) to interpret and show in another web
application.
I looked at the API but could not figure out if there is anything
appropriate to use.
Any help is really welcome.
Many thanks.
Andreas
--
Andreas Böhme
Department Landschaftsökologie / Computational Landscape Ecology
Helmholtz-Zentrum für Umweltforschung GmbH - UFZ
Helmholtz Centre for Environmental Research GmbH - UFZ
Permoserstraße 15, 04318 Leipzig, Germany
Phone +49 341 235 1058, Fax +49 341 235 451058 (optional)
andreas.boehme@anonymised.com, www.ufz.de
Sitz der Gesellschaft/Registered Office: Leipzig
Registergericht/Registration Office: Amtsgericht Leipzig
Handelsregister Nr./Trade Register Nr.: B 4703
Vorsitzender des Aufsichtsrats/Chairman of the Supervisory Board: MinDirig
Wilfried Kraus
Wissenschaftlicher Geschäftsführer/Scientific Managing Director:
Prof. Dr. Georg Teutsch
Administrative Geschäftsführerin/Administrative Managing Director:
Prof. Dr. Heike Graßmann (komm./interim)
Vermeiden Sie unnötige Ausdrucke./Think before printing.
Informationen aus der Wissenschaft (z.B. Veranstaltungshinweise,
Projektangaben, Publikationen,
Bücher)
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork
--
*Vriendelijke groeten / Kind regards,Jose García
<http://www.geocat.net/>Veenderweg 136721 WD BennekomThe NetherlandsT: +31
(0)318 416664 <+31318416664> <https://www.facebook.com/geocatbv>
<https://twitter.com/geocat_bv>
<https://plus.google.com/u/1/+GeocatNetbv/posts>Please consider the
environment before printing this email.*