Commit d076129a authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

feat: basic search according to MVP

parent 7db35fbd
---
title: SearchAPI Specification
version: 0.0.1
---
# Search
The used query syntax and objects are prepared alike [Elasticsearch`s Search API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html), but
not completely similar.
## Endpoint
`https://ahikar.sub.uni-goettingen.de/api/search`
## Search Request
`POST` the following object to the endpoint to execute a search.
| Field Name | Cardinality | Type | Description |
|----|----|----|----|
| query.simple_query_string.query | 1 | string | search query [see Lucene syntax](https://lucene.apache.org/core/8_9_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package.description) |
| from | 1 | number | start item in response |
| size | 1 | number | number of hits to return |
```json
{
"query": {
"simple_query_string": {
"query": ""
}
},
"from": 0,
"size": 10,
}
```
## Search Response
| Field Name | Cardinality | Type | Description |
|----|----|----|----|
| hits | 1 | \[[Hits Object](#hits-object)\] | search result hits |
| took | 1 | number | time in ms search execution took back end side |
### Hits Object
| Field Name | Cardinality | Type | Description |
|----|----|----|----|
| total | 1 | [Total Object](#total-object) | properties of the hit list |
| hits | 1 | \[[Hits Array(#hits-array)]\] | sequence of hits (ordered by score) |
#### Total Object
| Field Name | Cardinality | Type | Description |
|----|----|----|----|
| value | 1 | number | number of total hits |
### Hits Array
This describes a single object form the `hits` array.
| Field Name | Cardinality | Type | Description |
|----|----|----|----|
| item | 1 | IRI | path to the item context, w/o base uri |
| label | 1 | string | label of the manifest [see TextAPI](../text-api-specs/#manifest-object) |
| n | 1 | string | page number as in `tei:pb/@n` [see TextAPI](../text-api-specs/#item-object) |
### Sample Response
```json
{
"hits" : {
"total" : {
"value" : 2
},
"hits" : [ {
"item": "/api/textapi/ahikar/syriac/3r678-186v/latest/item.json",
"label": "Cod. Arab. 236 Copenhagen",
"n": "123v"
}, {
"item": "/api/textapi/ahikar/syriac/3r678-126r/latest/item.json",
"label": "Cod. Arab. 236 Copenhagen",
"n": "126r"
} ]
},
"took" : 1
}
```
---
title: SearchAPI Specification
version: 0.0.1
---
# Search
The used query syntax and objects are prepared alike those for Elasticsearch, but
not completely similar.
## Endpoint
`https://ahikar.sub.uni-goettingen.de/api/search`
## Search Request
`POST` the following object to the endpoint to execute a search.
```json
{
"query": {
"simple_query_string": {
"query": ""
}
},
"from": 0,
"size": 10,
"kwicsize": 20
}
```
## Search Response
```json
{
"took" : 1,
"hits" : {
"total" : {
"value" : 2
}
"hits" : [ {
"kwic" : {
"following" : " lucene index",
"prev" : "",
"hit" : "element"
},
"score" : 3.5844567,
"hit" : "<ab xmlns=\"http://www.tei-c.org/ns/1.0\">element lucene index</ab>",
"title" : "element test lucene index"
}, {
"kwic" : {
"following" : ".",
"prev" : "Das ist ein ab ",
"hit" : "element"
},
"score" : 3.1363995,
"hit" : "<ab xmlns=\"http://www.tei-c.org/ns/1.0\">Das ist ein ab element.</ab>",
"title" : "element test lucene index"
} ]
},
}
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment