diff --git a/LICENSE b/LICENSE index 86f501b92..d76864579 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (C) 2016-2021 ExplosionAI GmbH, 2016 spaCy GmbH, 2015 Matthew Honnibal +Copyright (C) 2016-2022 ExplosionAI GmbH, 2016 spaCy GmbH, 2015 Matthew Honnibal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/spacy/cli/project/assets.py b/spacy/cli/project/assets.py index b5057e401..5e0cdfdf2 100644 --- a/spacy/cli/project/assets.py +++ b/spacy/cli/project/assets.py @@ -1,6 +1,7 @@ from typing import Any, Dict, Optional from pathlib import Path from wasabi import msg +import os import re import shutil import requests @@ -129,10 +130,17 @@ def fetch_asset( the asset failed. """ dest_path = (project_path / dest).resolve() - if dest_path.exists() and checksum: + if dest_path.exists(): # If there's already a file, check for checksum - if checksum == get_checksum(dest_path): - msg.good(f"Skipping download with matching checksum: {dest}") + if checksum: + if checksum == get_checksum(dest_path): + msg.good(f"Skipping download with matching checksum: {dest}") + return + else: + # If there's not a checksum, make sure the file is a possibly valid size + if os.path.getsize(dest_path) == 0: + msg.warn(f"Asset exists but with size of 0 bytes, deleting: {dest}") + os.remove(dest_path) # We might as well support the user here and create parent directories in # case the asset dir isn't listed as a dir to create in the project.yml if not dest_path.parent.exists(): diff --git a/website/meta/site.json b/website/meta/site.json index b8f1a58ef..169680f86 100644 --- a/website/meta/site.json +++ b/website/meta/site.json @@ -22,7 +22,8 @@ "list": "89ad33e698" }, "docSearch": { - "apiKey": "371e26ed49d29a27bd36273dfdaf89af", + "appId": "Y1LB128RON", + "apiKey": "bb601a1daab73e2dc66faf2b79564807", "indexName": "spacy" }, "binderUrl": "explosion/spacy-io-binder", diff --git a/website/src/components/search.js b/website/src/components/search.js index eeab9ef40..65d6f235a 100644 --- a/website/src/components/search.js +++ b/website/src/components/search.js @@ -6,13 +6,14 @@ import Icon from './icon' import classes from '../styles/search.module.sass' export default function Search({ id = 'docsearch', placeholder = 'Search docs', settings = {} }) { - const { apiKey, indexName } = settings + const { apiKey, indexName, appId } = settings if (!apiKey && !indexName) return null const [initialized, setInitialized] = useState(false) useEffect(() => { if (!initialized) { setInitialized(true) window.docsearch({ + appId, apiKey, indexName, inputSelector: `#${id}`, diff --git a/website/src/pages/404.js b/website/src/pages/404.js index 4bdd43af6..53baebab9 100644 --- a/website/src/pages/404.js +++ b/website/src/pages/404.js @@ -41,6 +41,7 @@ export const pageQuery = graphql` docSearch { apiKey indexName + appId } } } diff --git a/website/src/templates/index.js b/website/src/templates/index.js index 353ff6067..dfd59e424 100644 --- a/website/src/templates/index.js +++ b/website/src/templates/index.js @@ -235,6 +235,7 @@ export const pageQuery = graphql` docSearch { apiKey indexName + appId } } }