Skip to content

Commit

Permalink
[SPARK-33479][DOC][FOLLOWUP] DocSearch: Support filtering search resu…
Browse files Browse the repository at this point in the history
…lts by version

### What changes were proposed in this pull request?

In the discussion #30292 (comment), we planned to apply a new API key for each Spark release. However, it turns that DocSearch supports crawling multiple URLs from one website and filtering by fact key: https://docsearch.algolia.com/docs/config-file/#using-regular-expressions

Thanks to the help from shortcuts, our Spark doc supports multiple version now: algolia/docsearch-configs#2868

This PR is to add the fact key in the search script and update the instruction in the comment.

### Why are the changes needed?

To support filtering Spark documentation search results by the current document version.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Manual test

Closes #30469 from gengliangwang/apiKeyFollowUp.

Authored-by: Gengliang Wang <gengliang.wang@databricks.com>
Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>
  • Loading branch information
gengliangwang authored and maropu committed Nov 24, 2020
1 parent 1bd897c commit 0592181
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,20 @@ SCALA_VERSION: "2.12.10"
MESOS_VERSION: 1.0.0
SPARK_ISSUE_TRACKER_URL: https://issues.apache.org/jira/browse/SPARK
SPARK_GITHUB_URL: https://github.com/apache/spark
# Before a new release, we should apply a new `apiKey` for the new Spark documentation
# on https://docsearch.algolia.com/. Otherwise, after release, the search results are always based
# on the latest documentation(https://spark.apache.org/docs/latest/) even when visiting the
# documentation of previous releases.
# Before a new release, we should:
# 1. update the `version` array for the new Spark documentation
# on https://github.com/algolia/docsearch-configs/blob/master/configs/apache_spark.json.
# 2. update the value of `facetFilters.version` in `algoliaOptions` on the new release branch.
# Otherwise, after release, the search results are always based on the latest documentation
# (https://spark.apache.org/docs/latest/) even when visiting the documentation of previous releases.
DOCSEARCH_SCRIPT: |
docsearch({
apiKey: 'b18ca3732c502995563043aa17bc6ecb',
indexName: 'apache_spark',
inputSelector: '#docsearch-input',
enhancedSearchInput: true,
algoliaOptions: {
'facetFilters': ["version:latest"]
},
debug: false // Set debug to true if you want to inspect the dropdown
});

0 comments on commit 0592181

Please sign in to comment.