Skip to content

switcherapi/switcher-searchdocs

Repository files navigation


Switcher SearchDocs API
A remote document search engine that uses Skimming for Deno

Master CI Quality Gate Status Docker Hub License: MIT Slack: Switcher-HQ


About

Switcher SearchDocs API uses Skimming and Oak Middleware modules to deliver a simple and efficient search engine.

Running locally

  1. Clone the repository
  2. Run deno task run:dev or test with deno task test
  3. Happy Deno hacking with SearchDocs!

Usage

Lockup API info

Request (GET)
{{url}}/api/check

Sample response

{
    "status": "ok",
    "releaseTime": "today",
    "sslEnabled": false,
    "appSettings": {
        "url": "https://raw.githubusercontent.com/petruki/skimming/master/",
        "files": "README.md",
        "cacheExpDuration": "5",
        "cacheSize": "100"
    }
}

From local content

Request (GET)
{{url}}/?query=Usage&previewLength=-1&ignoreCase=false&trimContent=true
  • query: value to search
  • previewLength: length of the content to be returned
    • When 0: it shows only the matched word
    • When -1: it shows the entire content from the first match
  • ignoreCase: ignore case
  • trimContent: prettify the response segment, basically
  • regex: enable regular expression searching method
  • skipCache: skip cache

Sample response

{
    "message": "Success",
    "query": "Sk",
    "result": [
        {
            "file": "README.md",
            "segment": [
                "Skimming is a data fetcher for Deno. The idea is to provide a simple and efficient module to fetch content.",
                "Skimming from \"https://raw.githubusercontent.com/petruki/skimming/v1.0.0/mod.ts\";",
                "Skimming({ expireDuration: 10, size: 10 });"
            ],
            "found": 3,
            "cache": true
        }
    ]
}

From remote content

Request (GET)
{{url}}/?url=https://raw.githubusercontent.com/denoland/deno/main/&files=README.md
  • url: Endpoint to be fetched
  • files: artifacts to be fetched