# This is a combination of 2 commits.
# This is the 1st commit message: # This is a combination of 3 commits. # This is the 1st commit message: # This is a combination of 3 commits. # This is the 1st commit message: chore(deps): update dependency onchange to v4.1.0 integrate previous work enhance tyle/content reformat part 1 wait for review adance start_urls enhance attributes description fix typo proofread documentation/docsearch add apiKey mention intefrate review and small fixes finished proofreading update sclient-rendering use unseen review # This is the commit message #2: update README #269 # This is the commit message #3: fix json # This is the commit message #2: enhance as algolia/docsearch-configs#387 # This is the commit message #3: updating flavicon # This is the commit message #2: Update 1-customize-configuration-file.html.md.erb
This commit is contained in:
parent
483b17e58c
commit
182ea291f0
1 changed files with 103 additions and 3 deletions
|
|
@ -99,6 +99,108 @@ The whole pattern `(?P<version>.*?)` will be replaced by the value assigned in t
|
|||
The variable name is not fixed. Please note that those variables will behave as
|
||||
[`attributesForFaceting`](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/) which may help you [restrain the scope of the search from the snippet](https://www.algolia.com/doc/guides/searching/faceting/).
|
||||
|
||||
Thus you can limit the scope of the search to the records from the pages encompassed by `http://example.com/docs/en/latest/*` thanks to the following snippet:
|
||||
```js
|
||||
<script type="text/javascript">
|
||||
docsearch({
|
||||
apiKey: ${apiKey},
|
||||
indexName: ${indexName},
|
||||
inputSelector: '#search'
|
||||
algoliaOptions: { 'facetFilters': ["lang:en", "version:latest"] },
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
In order to promote some pages, you can set the `page_rank` attribute (default: `0`, can be a positive or negative integer).
|
||||
|
||||
Finally, If your website contains differents parts and layouts, you can define specific `selectors` for each part and apply them using `selectors_key`:
|
||||
|
||||
**Example:**
|
||||
```json
|
||||
{
|
||||
"index_name": "example",
|
||||
"start_urls": [
|
||||
"http://example.com/docs/latest/",
|
||||
{
|
||||
"url": "http://example.com/docs/concepts/",
|
||||
"page_rank": 1,
|
||||
"selectors_key": "concepts"
|
||||
}
|
||||
],
|
||||
"selectors": {
|
||||
"default": {
|
||||
"lvl0": ".docSearch-content h1",
|
||||
"lvl1": ".docSearch-content h2",
|
||||
"lvl2": ".docSearch-content h3",
|
||||
"lvl3": ".docSearch-content h4",
|
||||
"lvl4": ".docSearch-content h5",
|
||||
"text": ".docSearch-content p, .docSearch-content li"
|
||||
},
|
||||
"concepts": {
|
||||
"lvl0": ".docSearch-header h2",
|
||||
"lvl1": ".docSearch-content h1",
|
||||
"lvl2": ".docSearch-content h2",
|
||||
"lvl3": ".docSearch-content h3",
|
||||
"lvl4": ".docSearch-content h5",
|
||||
"text": ".docSearch-content p"
|
||||
}
|
||||
}
|
||||
[...]
|
||||
}
|
||||
```
|
||||
|
||||
#### `start_urls.tags`
|
||||
|
||||
Tags will be apllied to every record from the matchin matched pages, i.e., its URL is matchin the `url`. These `tags` will [be processed as `attributesForFaceting`](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/) . If you want further detail, [check the original documentation](https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/).
|
||||
We do recommend to use `tags` if you want [to refine the scope of your search](https://www.algolia.com/doc/guides/searching/faceting/#faceting-overview).
|
||||
|
||||
From your search UI, you will need to use the following input:
|
||||
```js
|
||||
algoliaOptions: { 'facetFilters': ["tags:$VALUE"] },
|
||||
```
|
||||
|
||||
Default not used. Must be an array.
|
||||
|
||||
|
||||
**Example:**
|
||||
|
||||
From the config:
|
||||
```json
|
||||
"start_urls": [
|
||||
{
|
||||
"url": "http://example.com/docs/concepts/",
|
||||
"selectors_key": "concepts"
|
||||
}
|
||||
```
|
||||
|
||||
From the search UI:
|
||||
```js
|
||||
algoliaOptions: { 'facetFilters': ["tags:concepts"] },
|
||||
```
|
||||
### `scrape_start_urls`
|
||||
|
||||
**Example:**
|
||||
```json
|
||||
{
|
||||
"url": "http://example.com/docs/(?P<lang>.*?)/(?P<version>.*?)/",
|
||||
"variables": {
|
||||
"version": [
|
||||
"latest",
|
||||
"3.3",
|
||||
[...]
|
||||
],
|
||||
"lang": [
|
||||
"en",
|
||||
"fr",
|
||||
[...]
|
||||
]
|
||||
}
|
||||
```
|
||||
The whole pattern `(?P<version>.*?)` will be replaced by the value assigned in the related key `version`.
|
||||
|
||||
The variable name is not fixed. Please note that those variables will behave as
|
||||
[`attributesForFaceting`](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/) which may help you [restrain the scope of the search from the snippet](https://www.algolia.com/doc/guides/searching/faceting/).
|
||||
|
||||
Thus you can limit the scope of the search to the records from the pages encompassed by `http://example.com/docs/en/latest/*` thanks to the following snippet:
|
||||
```js
|
||||
<script type="text/javascript">
|
||||
|
|
@ -309,9 +411,7 @@ Default is `false`
|
|||
|
||||
### `allowed_domains` _Optional_
|
||||
|
||||
You can pass an array of strings. This is the whitelist of
|
||||
domains the crawler will browse. If a link targets a page that is not in the
|
||||
whitelist, the crawler will not follow it.
|
||||
### Sitemap crawling _Optional_
|
||||
|
||||
### Sitemap crawling _Optional_
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue