linked-swissbib / vufind

A library resource discovery portal designed and developed for libraries by libraries
GNU General Public License v2.0
1 stars 2 forks source link

Recursive Elasticsearch Query #10

Closed ltog closed 8 years ago

ltog commented 8 years ago

In some cases we need to do more than one query to Elasticsearch in order to get all information we need.

Example: When looking at one Work, we would like to display information (e.g. the year (dct:issued)) for each instance = bibliographicResource. Elasticsearch doesn't allow to retrieve this information in one query. Therefore we need to modify the code to do two Elasticsearch/HTTP Requests.

ltog commented 8 years ago

Here's a list of useful information I found:

guenterh commented 8 years ago

Hi Lukas,

thanks for heading forward on this topic.

Instead of writing quite a lot of comments right now, could we start a call on this topic (either skype or good old telephone) in the course of this week?

Günter

ltog commented 8 years ago

At the newly created https://github.com/linked-swissbib/vufind/blob/69f43411ad4b25a5bbff0a1a3764b46969090dde/module/LinkedSwissbib/src/LinkedSwissbib/Search/Elasticsearch/RecursiveSearchListener.php#L69 (Branch: recursive_search) we have access to the search results of a (first-level) ES search. These could be enhanced now by a second ES query.

@guenterh : Do you like this approach?

ltog commented 8 years ago

Short summary of the phone call with Günter: I will continue implementing the recursive search as planned.

ltog commented 8 years ago

Here is a screenshot of a ElasticsearchRDF record in https://github.com/linked-swissbib/vufind/blob/69f43411ad4b25a5bbff0a1a3764b46969090dde/module/LinkedSwissbib/src/LinkedSwissbib/Search/Elasticsearch/RecursiveSearchListener.php#L71 .

elasticsearchrdf-record

Corresponding ES query is:

GET /testsb/work/_search
{
"query": {
"filtered": {
"filter": {
"bool": {
  "must": {"term": {"@id": "http://data.swissbib.ch/work/043422853"}}
}
}
}
}
}

My plan is to extend such a record with additional arrays (e.g. dct:issued) identical in style as the existing bf:hasInstance and dct:title.