Meilisearch

Usage

cat > docker-compose.yml <<-'EOF'
# https://www.meilisearch.com/docs/learn/cookbooks/docker#run-meilisearch-with-docker
# Port: 7700
version: "3"

services:
  meilisearch:
    image: getmeili/meilisearch
    environment:
      - MEILI_MASTER_KEY=<password>
    network_mode: host
    restart: always
    volumes:
      - $PWD/meilisearch/data/:/meili_data/

EOF
# <password>

Start

docker-compose up --detach

Stop

docker-compose down

Scraper

# https://www.meilisearch.com/docs/learn/cookbooks/search_bar_for_docs#run-the-scraper
docker run -it \
    --rm \
    -e MEILISEARCH_HOST_URL=<host-url> \
    -e MEILISEARCH_API_KEY=<api-key> \
    -v <path/to/config-file>:/docs-scraper/config.json \
    getmeili/docs-scraper \
    pipenv run ./docs_scraper <path/to/config-file>

docusaurus-2.json

# https://github.com/algolia/docsearch-configs/blob/master/configs/docusaurus-2.json
{
  "index_name": "docusaurus-2",
  "start_urls": [
    "https://docusaurus.io/"
  ],
  "sitemap_urls": [
    "https://docusaurus.io/sitemap.xml"
  ],
  "sitemap_alternate_links": true,
  "stop_urls": [
    "/tests"
  ],
  "selectors": {
    "lvl0": {
      "selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]",
      "type": "xpath",
      "global": true,
      "default_value": "Documentation"
    },
    "lvl1": "header h1",
    "lvl2": "article h2",
    "lvl3": "article h3",
    "lvl4": "article h4",
    "lvl5": "article h5, article td:first-child",
    "lvl6": "article h6",
    "text": "article p, article li, article td:last-child"
  },
  "strip_chars": " .,;:#",
  "custom_settings": {
    "separatorsToIndex": "_",
    "attributesForFaceting": [
      "language",
      "version",
      "type",
      "docusaurus_tag"
    ],
    "attributesToRetrieve": [
      "hierarchy",
      "content",
      "anchor",
      "url",
      "url_without_anchor",
      "type"
    ]
  },
  "conversation_id": [
    "833762294"
  ],
  "nb_hits": 46250
}
posted @ 2023-06-03 11:48  Arkx86  阅读(168)  评论(0)    收藏  举报