Autocomplete

Gets the available completions in rank-descending order from the prefix entered by the user. To optimize performance of requests, requests must be completed through a browser.

Endpoint URL for Autocomplete

GET http://url-is-returned-from-the-Authentication-Method
GET http://Autocomplete01.ese.epnet.com:8080/Autocomplete/rest/Autocomplete?term=te&idx=rawqueries&filters=%5B%7B%22name%22%3A%22custid%22%2C%22values%22%3A%5B%22xxxxxxx%22%5D%7D%5D&token=hello

Data Parameters

To Use the Autocomplete Endpoint:

Gather the following information for the request:

Parameter NameDescriptionRequired/OptionalParameter TypeFormatExample Values
tokenThe authentication token that is returned from the Auth method when requesting the autocomplete option.RequiredQueryhello
termThe user-entered prefix for autocompletion. It is typically found in the text input box.RequiredQueryte
idxIndicates the domain/data type to autocomplete.RequiredQueryUse holdings for title completion in PubFinder. Use rawqueries for completion of basic textual queries.rawqueries
filtersA JSON encoded key/value list indicating the filters to apply.RequiredQueryA filter with name "custid" must be specified. custid has exactly one value. custid is the actual customer ID. This value will be returned from the Auth method.[{"name":"custid","values":["xxxxxxx"]}]
formatDetermines the format of the completion fragments.OptionalQueryDefaults to html. One of html, json, or none.html

Request

To Return the Available Completions for "te":

ParameterValue
tokenhello
termte
idxrawqueries
filters[{"name":"custid","values":["xxxxxxx"]}]

📘

Please use the Autocomplete URL that is returned from your authentication call. An example request is below.

GET http://Autocomplete01.ese.epnet.com:8080/Autocomplete/rest/Autocomplete?term=te&idx=rawqueries&filters=%5B%7B%22name%22%3A%22custid%22%2C%22values%22%3A%5B%22xxxxxxx%22%5D%7D%5D&token=hello

Response

If the request can be processed successfully, the response will contain the server-side processing time ("processingTime") and an array of completions ("terms"). Each completion consists of completed term(s) ("term") and a "score" (rank).

{
   "processingTime": 15,
   "terms":    [
            {
         "term": "Technology Review (MIT)",
         "score": 276722,
         "domain": "rawqueries",
      },
            {
         "term": "Teaching exceptional children",
         "score": 268236,
         "domain": "rawqueries",
      },
            {
         "term": "Texas Monthly",
         "score": 180412,
         "domain": "rawqueries",
      }
   ]
}

Response Elements

FieldDescriptionAlways PresentType
processingTimeServer-side processing time in milliseconds.YInteger
termsCompletionsYArray
termThe completion term (e.g. a title or a query).YString
domainThe completion domain that the terms came from. The domain corresponds to the "idx" parameter of the query.YString
fragmentsThe completion domain that the terms came from. The domain corresponds to the "idx" parameter of the query.NArray
highlightedTermHighlighting information, if the requested highlighting format was "HTML". See section "Completion Fragment Markup", below.NString
isAlternateFor title-based domains only. Determines if the completion represents an alternate title.NBoolean
metadataAny metadata or completion keys associated with the completion. The details are domain-specific.NString
primaryTitleTitle-based domains only. If the completion represents an alternate title, the primary title.NString
scoreThe score or rank associated with the completion.YInteger

Response Variations

Title Completions ("holdings" domains)

Completions are formed against a set of known titles in EPKB. Only titles in the customer's holdings are completed against. Titles outside of the customer's holdings are filtered out.

Primary and Variant (Alternate) Titles:

  • The Autocomplete service generally returns the primary, preferred title for a publication. A variant (alternate) title is only returned if the user-entered prefix is not a prefix/infix of a primary title, but that of a title variant.
  • If the completion is for a title variant, the response contains a key/value "isAlternate: true". The response contains a key "primaryTitle". The value is the primary title associated with the title variant.
  • Due to data cleansing processes, there is no guarantee that the returned title is found/known in each database.
  • The KBIDs are also returned. KBIDs can be used (by some other mechanism) to map from a KBID to the literal and/or database-specific title.
  • Titles (primary or variants) are slightly “cleaned” during harvesting/indexing:
    • Special characters (\r, \n, \t) are removed.
    • If a title contains HTML markup (& ü ), the markup will be mapped to the “real” character (& ü).
    • Titles are clustered. This applies case, whitespace, diacritics, and punctuation insensitivity. The returned title is the "preferred" title. It may not be literally present in the customer's holdings. Use the annotated KBIDs in the metadata if you need to look up the DB/customer-specific title. Note that the literal titles for the KBIDs in a completion may differ (no "string equality").

Metadata:

Titles are clustered. This applies case, whitespace, diacritics, and punctuation insensitivity. The returned title is the "preferred" title. It may not be literally present in the customer's holdings. Use the annotated KBIDs in the metadata if you need to look up the DB/customer-specific title. Note that the literal titles for the KBIDs in a completion may differ (no "string equality").

{
 "processingTime": 0,
   "terms": {
   "term": "ABA Bank Directors Briefing",
   "score": 0,
   "metadata": "edp594507,edp123818"
   }
}

The completion is not necessarily the "master title", but may be a title variant or the "preferred title" of a title cluster.

Query Completions ("rawqueries" domain and other query based domains)

No metadata is returned for the "rawqueries" domain. Only the completed query and the score are returned in the response for the "rawqueries" domain.

Completion Results for "information theor":

{
    "processingTime": 4,
    "terms": [
        {
            "term": "information theory",
            "highlightedTerm": "<span class=\"userprovided\">information theor</span><span class=\"Autocompleted\">y</span>",
            "score": 47,
            "domain": "rawqueries"
        }
    ]
}

Completion Fragment Markup

The response usually contains the completion fragments. The completion fragments explicitly mark up the user entered portions and the autocompleted portions. In some cases, the service cannot compute this mark up. In these cases, no result will be returned.

The completion fragments are provided so that the client can visually differentiate the user entered portions of the submitted query from the autocompleted portions.

Response FormatReturn FieldComments
htmlhighlightedTermA string that contains the fragments marked up with HTML s. Class "userprovided" is used to indicate a user provided fragment. Class "Autocompleted" is used to indicate an autocompleted fragment.
jsonfragmentsAn array of structs that contain a text fragment and a boolean flag. The boolean flags indicates if the fragment was user provided or autocompleted.
nonenoneNo explicit mark up is computed or returned (only the plain text completion).

Response format none example:

{
   "processingTime": 4,
   "terms":    [
            {
         "term": "AAA - Abstract and Applied Analysis",
         "score": 238,
         "isAlternate": true,
         "metadata": "edp99109"
      },
            {
         "term": "AAA Employment Arbitration Awards",
         "score": 0,
         "metadata": "edp913907"
      }
   ]
}

Response format html example:

{
   "processingTime": 4,
   "terms":    [
            {
         "term": "AAA - Abstract and Applied Analysis",
         "highlightedTerm": "<span class=\"userprovided\">AAA<\/span><span class=\"Autocompleted\"> - Abstract and Applied Analysis<\/span>",
         "score": 238,
         "isAlternate": true,
         "metadata": "edp99109"
      },
            {
         "term": "AAA Employment Arbitration Awards",
         "highlightedTerm": "<span class=\"userprovided\">AAA<\/span><span class=\"Autocompleted\"> Employment Arbitration Awards<\/span>",
         "score": 0,
         "metadata": "edp913907"
      }
   ]
}

Response forma json example:

{
   "processingTime": 4,
   "terms": [
            {
              "term": "AAA - Abstract and Applied Analysis",
              "fragments": [
                      {
               "text": "AAA",
               "user": true
               },
                        {
               "text": " - Abstract and Applied Analysis",
               "user": false
            }
         ],
         "score": 238,
         "isAlternate": true,
         "metadata": "edp99109"
      },
            {
         "term": "AAA Employment Arbitration Awards",
         "fragments":          [
                        {
               "text": "AAA",
               "user": true
            },
                        {
               "text": " Employment Arbitration Awards",
               "user": false
            }
         ],
         "score": 0,
         "metadata": "edp913907"
      }
   ]
}

Error Conditions

The request parameters are checked for any invalid parameters. Invalid parameters could be out-of-range conditions, unknown domains (idx), failed authentication (token), etc.

An expired or invalid token will return an "unauthorized" value in the "error" key.

Errors will also be generated if an underlying data provider failed, required data is not available, etc.

Common Response Error Fields

FieldTypeDescription
errorStringOptional error message. If this field is present, independent of its value, the request was unsuccessful and no meaningful result is returned.
processingTimeintThis is the time elapsed (in ms) between the receipt of the request and the completion of the response message.
typeStringThe "type" of this JSON data structure. Can be used for deserialization purposes.

If an error occurs, the response only contains an error string and the server-side processing time:

{ 
   "processingTime": 47,
   "error": "..."
}

Error Types

Error Typeerror ValueLog LevelHTTP Status (default)
All other errorsInternal ErrorERROROK (200)
Authorization errorsUnauthorizedWARNOK (200)
Invalid requestsInternal ErrorWARNOK (200)

If an error occurs, the response contains a non-empty "error" field with values as specified in the following table. HTTP Status is 200 (OK) by default.