mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-11-30 17:17:55 +08:00
chore: update meilisearch settings (#10659)
* chore: update meilisearch settings * fix: docker build
This commit is contained in:
18
.github/workflows/scrape.yml
vendored
18
.github/workflows/scrape.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
paths:
|
||||
- '.github/workflows/scrape.yml'
|
||||
- 'docs/**'
|
||||
workflow_dispatch: ~
|
||||
|
||||
jobs:
|
||||
scrape-docs:
|
||||
@@ -14,10 +15,16 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Use Node.js v16
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
cache: 'yarn'
|
||||
- name: Pull image
|
||||
run: docker pull getmeili/docs-scraper
|
||||
- name: Wait for Netlify to finish
|
||||
run: sleep 3m
|
||||
if: github.event_name == 'push'
|
||||
- name: Run docs-scraper
|
||||
env:
|
||||
HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }}
|
||||
@@ -29,3 +36,14 @@ jobs:
|
||||
-e MEILISEARCH_API_KEY=$API_KEY \
|
||||
-v $CONFIG_FILE_PATH:/docs-scraper/config.json \
|
||||
getmeili/docs-scraper pipenv run ./docs_scraper config.json
|
||||
- name: Update meilisearch settings
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }}
|
||||
API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
|
||||
with:
|
||||
script: |
|
||||
const meilisearchHost = process.env.HOST_URL
|
||||
const meilisearchApiKey = process.env.API_KEY
|
||||
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/docs-scraper/settings.js`)
|
||||
await script({ core }, meilisearchHost, meilisearchApiKey)
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
"eslint-plugin-yml": "1.1.0",
|
||||
"fs-extra": "10.1.0",
|
||||
"jest": "29.0.1",
|
||||
"meilisearch": "0.27.0",
|
||||
"mockdate": "3.0.5",
|
||||
"nock": "13.2.9",
|
||||
"nodemon": "2.0.19",
|
||||
|
||||
55
scripts/docs-scraper/settings.js
Normal file
55
scripts/docs-scraper/settings.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const { MeiliSearch } = require('meilisearch');
|
||||
|
||||
module.exports = async ({ core }, host, apiKey) => {
|
||||
const client = new MeiliSearch({
|
||||
host,
|
||||
apiKey,
|
||||
});
|
||||
core.info('Updating displayed attributes');
|
||||
core.info(
|
||||
await client
|
||||
.index('rsshub')
|
||||
.updateDisplayedAttributes([
|
||||
'hierarchy_radio_lvl1',
|
||||
'hierarchy_radio_lvl2',
|
||||
'hierarchy_radio_lvl3',
|
||||
'hierarchy_radio_lvl4',
|
||||
'hierarchy_radio_lvl5',
|
||||
'hierarchy_lvl0',
|
||||
'hierarchy_lvl1',
|
||||
'hierarchy_lvl2',
|
||||
'hierarchy_lvl3',
|
||||
'hierarchy_lvl4',
|
||||
'hierarchy_lvl5',
|
||||
'hierarchy_lvl6',
|
||||
'anchor',
|
||||
'url',
|
||||
'content',
|
||||
])
|
||||
);
|
||||
|
||||
core.info('Updating searchable attributes');
|
||||
core.info(
|
||||
await client
|
||||
.index('rsshub')
|
||||
.updateSearchableAttributes([
|
||||
'hierarchy_radio_lvl1',
|
||||
'hierarchy_radio_lvl2',
|
||||
'hierarchy_radio_lvl3',
|
||||
'hierarchy_radio_lvl4',
|
||||
'hierarchy_radio_lvl5',
|
||||
'hierarchy_lvl0',
|
||||
'hierarchy_lvl1',
|
||||
'hierarchy_lvl2',
|
||||
'hierarchy_lvl3',
|
||||
'hierarchy_lvl4',
|
||||
'hierarchy_lvl5',
|
||||
'hierarchy_lvl6',
|
||||
'anchor',
|
||||
'content',
|
||||
])
|
||||
);
|
||||
|
||||
core.info('Updating sortable attributes');
|
||||
core.info(await client.index('rsshub').updateSortableAttributes(['anchor']));
|
||||
};
|
||||
@@ -9590,7 +9590,7 @@ media-typer@0.3.0:
|
||||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
|
||||
integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==
|
||||
|
||||
meilisearch@^0.27.0:
|
||||
meilisearch@0.27.0, meilisearch@^0.27.0:
|
||||
version "0.27.0"
|
||||
resolved "https://registry.yarnpkg.com/meilisearch/-/meilisearch-0.27.0.tgz#8bd57ddb77b975f93e054cb977b951c488ece297"
|
||||
integrity sha512-kZOZFIuSO7c6xRf+Y2/9/h6A9pl0sCl/G44X4KuaSwxGbruOZPhmxbeVEgLHBv4pUFvQ56rNVTA/2d/5GCU1YA==
|
||||
|
||||
Reference in New Issue
Block a user