Keyword Search API

Keyword Search API makes it possible for the content search based on search option.

Keyword Search API

POST https://backend.alli.ai/webapi/keyword_search

Keyword Search API makes it possible for the content search based on search option.

Getting the API KEY

Please provide your API key in the request header API-KEY. Your API key can be found in your dashboard Settings menu, under the General tab. Provide your API KEY in the request header API-KEY.

Headers

NameTypeDescription

API-KEY*

string

Your cognitive search API key can be found in your dashboard Settings menu, under the General tab.

Request Body

NameTypeDescription

topN

int

How many result want to get (default: 5, up to: 5)

node*

SearchNode

Search Type Data Model

SearchNode

NameTypeDescription

WildCardNode

Search for pages where containing input keyword with wildcard. Return the start page if phrase spans across multiple pages

ExactlyPhraseNode

Search for pages where containing input phrase exactly. Return the start page if phrase spans across multiple pages

WithinXWordsNode

Search for pages where input1 keyword and input2 keyword are separated by a maximum distance. Return pages containing input1.

ExcludeKeywordNode

Search for pages where not containing input keyword. This SearchNode utilizes AND and OR nodes to combine with other SearchNodes.

AndNode

Search for pages where Include both left result pages and right result pages

OrNode

Search for pages where Include either left result pages or right result pages

Request Example

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section.

curl https://backend.alli.ai/webapi/keyword_search \
-d '{"topN": 2, "node": { "nodeType": "WILDCARD", "input": "hello*" }}' \
-H "Content-Type: application/json" \
-H "API-KEY: YOUR_API_KEY"

Response Example

{
  "results": [
    {
      "projectId": "PROJECT_ID",
      "knowledgeBaseId": "KNOWLEDGE_BASE_ID",
      "title": "Allganize Document",
      "pageNo": 3,
    },
    {
      "projectId": "PROJECT_ID",
      "knowledgeBaseId": "KNOWLEDGE_BASE_ID",
      "title": "What is the AI",
      "pageNo": 1,
    }
  ]
}

Limitation

Search Request

  • Exclude Search must be used in combination with Include Search.

  • Wildcard Search is supported for word.

    • Wildcards attached to phrases like "hello world*" are not supported

Search Result

  • TopN: Up to 5 (sorted according to the BM25 algorithm in Elasticsearch).

    • Pagination support: Not available.

    • Exactly Phrase and With X queries supported for data belonging to consecutive 2 pages.

Search Quality

  • Presence of Header and Footer may affect proper search results.

  • Unrecognized control characters in documents may cause search issues.

  • Documents with no word wrap between pages may not be properly searchable.

  • We manage the index in Elasticsearch by adding commonly recommended analyzers for English sentences. e.g.) Normalization of verb tenses (past tense, present tense). Due to the related analyzer, some indexed searches may not be clear, and in such cases, searches should be conducted using exactly_phrase.

Last updated