Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from jquery:main #3

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/typesense.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: typesense
on:
# Or after a deployment
push:
branches:
- main
# Or manually
workflow_dispatch:

jobs:
typesense:
name: Update Typesense
if: ${{ github.repository_owner == 'jquery' }} # skip on forks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docsearch Scraper
shell: bash
run: |
docker run \
-e TYPESENSE_API_KEY=${{ secrets.TYPESENSE_ADMIN_KEY }} \
-e TYPESENSE_HOST="${{ secrets.TYPESENSE_HOST }}" \
-e TYPESENSE_PORT="443" \
-e TYPESENSE_PROTOCOL="https" \
-e CONFIG="$(cat docsearch.config.json | jq -r tostring)" \
typesense/docsearch-scraper:0.8.0
6 changes: 3 additions & 3 deletions config-sample.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"url": "vagrant.jquerymobile.com",
"username": "admin",
"password": "secret"
"url": "http://local.jquerymobile.com",
"username": "dev",
"password": "dev"
}
63 changes: 63 additions & 0 deletions docsearch.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"index_name": "jquerymobile_com",
"start_urls": [
{ "url": "https://api.jquerymobile.com", "selectors_key": "api", "page_rank": 20 },
{ "url": "https://jquerymobile.com", "page_rank": 10 }
],
"sitemap_urls": [
"https://api.jquerymobile.com/wp-sitemap.xml"
],
"// stop_urls": [
"// Exclude URLs containing '?' such as /themeroller/?...",
"// Avoid excluding https://jquerymobile.com/resources/ itself"
],
"stop_urls": [
"\\?",
".com/category/",
".com/resources/.+",
".com\\/\\d\\."
],
"selectors": {
"default": {
"lvl0": {
"selector": "#menu-top .menu-item.current > a",
"global": true,
"default_value": "Documentation"
},
"lvl1": "#content h1",
"lvl2": "#content h2",
"lvl3": "#content h3",
"lvl4": "#content h4",
"lvl5": "#content h5",
"text": "#content p, #content li, #content tr"
},
"api": {
"lvl0": {
"selector": "#categories .cat-item.current-cat > a",
"global": true,
"default_value": "API"
},
"lvl1": "#content h1",
"lvl2": "#content h2, #content h4.name",
"lvl3": "#content h3, #content h4:not(.name)",
"lvl4": "#content h5, #content strong:first-child",
"text": ".entry-content p, .entry-content li"
}
},
"custom_settings": {
"token_separators": ["_", "-", "."]
},
"selectors_exclude": [
"header ~ article",
".returns",
".version-details",
".section-title",
".icon-link.toc-link",
"[class^=toclevel]",
"#toctitle",
".desc strong:first-child",
"#quick-nav header h2"
],
"min_indexed_level": 2,
"scrape_start_urls": false
}
Loading