Skip to content

Service: Search GET

Eliza Margaretha edited this page Mar 4, 2024 · 34 revisions

Returns query result for the given query according to the other given parameters.

This service can be used to retrieve public metadata of the query results only. See Search Public Metadata for an example.

Available in: lite and full version

Method: GET

Service URL: root/search

Parameters

Header Parameter (Optional)

Name Required Description Example
Authorization no HTTP authentication scheme Bearer and OAuth2 access token Bearer 9zJGaHfIY.aNesHjol36R4a2lsBp7KDnlaro

Query Parameters

Name Required Description Type Value
q yes search query String depends on ql
ql yes query language String poliqarp, cosmas2, annis, cql, fcsql
v no query language version number String 1.1 or 1.2, default: 1.2 (only applicable for CQL)
context no result context String sentence
paragraph
[number]-[type],[number]-[type]
where type can be token or char, and number defines the number of occurrences in left context (left of the comma) and right context (right of the comma), e.g. 3-token,3-token
count no page length Integer e.g. 25, 50, 100
offset no startindex parameter for paging Integer default: 0
page no startPage parameter for paging (if together with startIndex, startIndex will be used) Integer default: 1
cq no corpus query defining a collection of texts in which the search should be done String e.g. corpusSigle=GOE & creationDate since 1820
cutoff no true to limit search results to one page only, false otherwise Boolean default: false
fields no only the specified metadata fields names are to be included in the results String multiple fields are separated by comma e.g author,textClass
access-rewrite-disabled no determine if access rewrite should be disabled. If set true, searching within copyrighted data for unauthenticated users is allowed, but only the public metadata of the results (without text snippets) are included in the response. boolean default = false
show-tokens no determine if the match snippets should be shown as tokens in the results boolean default: false
show-snippet no determine if the match snippets should be shown boolean default: true
engine no determine which search engine should be used. See Search via Network Endpoint. Network is currently not available. String lucene (default), network

Examples

** WARNING: **

  • The rewrites format is experimental and may change without any notice.
  • The overall response format is temporary and will be changed once it has been specified in the KoralQuery documentation.

Request

http://localhost:8089/api/v1.0/search?q=Wasser&ql=poliqarp

Request with cURL and authentication token

curl -H 'Authorization: Bearer 9zJGaHfIY.aNesHjol36R4a2lsBp7KDnlaro' 
        'http://localhost:8089/api/v1.0/search?q=Wasser&ql=poliqarp'

Response

{
    "@context": "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld",
    "meta": {
        "count": 25,
        "startIndex": 0,
        "timeout": 10000,
        "context": {
            "left": [
                "token",
                6
            ],
            "right": [
                "token",
                6
            ]
        },
        "fields": [
            "textSigle",
            "author",
            "docSigle",
            "availability",
            "title",
            "pubDate",
            "UID",
            "corpusID",
            "textClass",
            "subTitle",
            "layerInfos",
            "ID",
            "pubPlace",
            "corpusSigle"
        ],
        "version": "0.58.3",
        "benchmark": "76.44206299999999 ms",
        "totalResults": 29,
        "serialQuery": "tokens:s:Wasser",
        "itemsPerPage": 25
    },
    "query": {
        "@type": "koral:token",
        "wrap": {
            "@type": "koral:term",
            "match": "match:eq",
            "layer": "orth",
            "key": "Wasser",
            "foundry": "opennlp",
            "rewrites": [{
                "@type": "koral:rewrite",
                "src": "Kustvakt",
                "operation": "operation:injection",
                "scope": "foundry"
            }]
        }
    },
    "collection": {
        "@type": "koral:doc",
        "match": "match:eq",
        "type": "type:regex",
        "value": "CC-BY.*",
        "key": "availability",
        "rewrites": [{
            "@type": "koral:rewrite",
            "src": "Kustvakt",
            "operation": "operation:insertion",
            "scope": "availability(FREE)"
        }]
    },
    "matches": [
        {
            "field": "tokens",
            "pubPlace": "München",
            "textSigle": "GOE/AGA/01784",
            "docSigle": "GOE/AGA",
            "corpusSigle": "GOE",
            "title": "Belagerung von Mainz",
            "author": "Goethe, Johann Wolfgang von",
            "availability": "CC-BY-SA",
            "layerInfos": "corenlp/c=spans corenlp/p=tokens corenlp/s=spans 
              dereko/s=spans malt/d=rels marmot/m=tokens marmot/p=tokens 
              opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens",
            "startMore": true,
            "endMore": true,
            "license": "CC-BY-SA",
            "snippet": "<span class=\"context-left\"><span class=\"more\">
              <\/span>feuerte unausgesetzt in Prellschüssen auf dem <\/span>
              <span class=\"match\"><mark>Wasser<\/mark><\/span><span class=
              \"context-right\">; für mich ein ganz neues Schauspiel<span 
              class=\"more\"><\/span><\/span>",
            "matchID": "match-GOE/AGA/01784-p3819-3820",
            "pubDate": "1982",
            "UID": 0
        },
        ... 
    ]
}

 
Clone this wiki locally