1.0.20 • Published 5 years ago

kiri-search-library v1.0.20

Weekly downloads
-
License
Apache 2.0
Repository
gitlab
Last release
5 years ago

Kiri Search Library

Getting Started

Install via npm:

npm install kiri-search-library

Install via CDN:

<script src="https://unpkg.com/kiri-search-library"></script>

How to use

  1. Initialize the Kiri agent with a provided API key.
var agent = new KiriAgent("pk_yourAPIKey");
  1. Make a search request
var results = await agent.search("Some query", num_results);
  1. Redirect the user to the results
// Redirect the user to the first search result.
agent.redirect(results[0].url, results[0].id);

API - KiriAgent class

constructor(apiKey)

Creates a KiriAgent object

  • apiKey (string): The provided public facing API key for a specified agent.

search(q, n, f, o)

Searches through the agent's articles with the query, q, and returns the most relevant n articles.

  • q (string): The query to use to search through the articles
  • n (number): The number of results to return (should be a number between 1 and 10 inclusive).
  • f (object: optional): The filters to be used when returning the search results.
  • p (number: optional): A zero-indexed value that refers to the page number of relevant results to return (e.g. page 10 has an index of 9).

redirect(url, article_id)

Redirects the browser to the specified article and logs the redirection as an analytic which can be viewed in the agent's dashboard.

  • url (string): The url of the redirected article.
  • article_id (string): The ID of the article being redirected to (necessary for logging).
1.0.19

5 years ago

1.0.20

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago