You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-2Lines changed: 30 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
The **TNTSearch** Plugin is for [Grav CMS](http://github.com/getgrav/grav). Powerful indexed-based full text search engine powered by the [TNTSearch library](https://github.com/teamtnt/tntsearch) that provides fast Ajax-based Grav content searches. This plugin is highly flexible allowing indexes of arbitrary content data as well as custom Twig templates to provide the opportunity to index modular and other dynamic page types. TNTSearch provides CLI as well as Admin based administration and re-indexing, as well as a built-in Ajax-powered front-end search tool.
4
4
5
+
> NOTE: TNTSearch version 3.0.0 now requires Grav 1.6.0 or newer to function as it makes use of new functionality not available in previous versions.
@@ -88,11 +97,13 @@ The configuration options are as follows:
88
97
* `built_in_css` - enable or disable the built-in css styling
89
98
* `built_in_js` - enable or disable the built-in javascript
90
99
* `built_in_search_page` - enable or disable the built-in search page
100
+
* `enable_admin_page_events` - enable or disable the page events which occur `on-save` to add/update/remove page in index
91
101
* `search_type` - can be one of these types:
92
102
* `basic` - standard string matching
93
103
* `boolean` - supports `or` or `minus`. e.g. `foo -bar`
94
104
* `auto` - automatically detects whether to use `basic` or `boolean`
95
105
* `fuzzy` - matches if the words are 'close' but not necessarily exact matches
106
+
* `phrases` - automatically handle phrases support
96
107
* `stemmer` - can be one of these types:
97
108
* `default` - no stemmer
98
109
* `arabic` - Arabic language
@@ -109,7 +120,10 @@ The configuration options are as follows:
109
120
* `min` - mininum amount of characters typed before performing search
110
121
* `snippet` - amount of characters for previewing a result item
111
122
* `index_page_by_default` - should all pages be indexed by default unless frontmatter overrides
123
+
* `scheduled_index` - New scheduled index job. Disabled by default, when enabled defaulted to run every 3 hours, and output results to `logs/tntsearch-index.out`
112
124
* `filter` - a [Page Collections filter](https://learn.getgrav.org/content/collections#summary-of-collection-options) that lets you pick specific pages to index via a collection query
125
+
* `powered_by` - Display the **powered-by TNTSearch** text
126
+
* `search_object_type` - Allows custom classes to override the default **Grav Page** support. This allows completely custom searching capabilities for any data type.
113
127
114
128
## Usage
115
129
@@ -168,6 +182,20 @@ tntsearch:
168
182
index: false
169
183
```
170
184
185
+
#### Multi-Language Support
186
+
187
+
With the new 3.0 version of TNTSearch, support has been added for multiple languages (Grav 1.6 required). Internally, this means that rather that store the index as `user:://data/tntsearch/grav.index`, multiple indexes are created per language configured in Grav. For example if you have set the supported languages to `['en', 'fr', 'de']`, then when you perform an index, you will get three files: `en.index`, `fr.index`, and `de.index`. When querying the appropriate **active language** determines which index is queried. For example, performing the search on a page called `/fr/search` will result in the `fr.index` database to be used, and French results to be returned.
188
+
189
+
Note Indexing will take longer depending on the number of languages you support as TNTSearch has to index each page in each language.
190
+
191
+
> NOTE: While accented characters is supported in this release, there is currently no support in the underlying TNTSearch library to match non-accented characters to accented ones, so exact matches are required.
192
+
193
+
#### Scheduler Support
194
+
195
+
One of the great new features of Grav 1.6 is the built in **Scheduler** that allows plugin-provided functionality to be run periodically. TNTSearch is a great use-case for this capability as it allows an indexing job to be scheduled to be run every few hours without the need to manually keep things in sync. There are a few options that allow you to configure this capability.
196
+
197
+
First note, that this scheduler functionality is disable by default, so you first have to enable the scheduler functionality in the TNTSearch plugin settings. After that you can configure how often the indexing job should run. The default is every 3 hours. Lastly, you can configure where any indexing output is logged to.
198
+
171
199
#### Admin Page CrUD Events
172
200
173
201
Once you have an index, TNTSearch makes use of admin events to **C**reate, **U**pdate, and **D**elete index entries when you edit pages. If your index ever looks like it's out of sync, you can simply reindex your whole site.
help: Disable this if you are having problems with timeouts during page saving
40
46
highlight: 1
41
47
default: 1
42
48
options:
@@ -45,9 +51,39 @@ form:
45
51
validate:
46
52
type: bool
47
53
48
-
built_in_js:
54
+
scheduled_index.enabled:
49
55
type: toggle
50
-
label: Built-in Javascript
56
+
label: Enable Index Scheduled Job
57
+
help: Use the Grav Scheduler to kick off a background index job
58
+
highlight: 0
59
+
default: 0
60
+
options:
61
+
1: Enabled
62
+
0: Disabled
63
+
validate:
64
+
type: bool
65
+
66
+
scheduled_index.at:
67
+
type: cron
68
+
label: Scheduled Job Frequency
69
+
size: medium
70
+
help: Use 'cron' format
71
+
default: '0 */3 * * *'
72
+
placeholder: '0 */3 * * *'
73
+
74
+
scheduled_index.logs:
75
+
type: text
76
+
label: Scheduled Job Log File
77
+
placeholder: 'logs/tntsearch-index.out'
78
+
size: medium
79
+
80
+
ui_title:
81
+
type: spacer
82
+
title: UI Settings
83
+
84
+
built_in_css:
85
+
type: toggle
86
+
label: Built-in CSS
51
87
highlight: 1
52
88
default: 1
53
89
options:
@@ -56,9 +92,9 @@ form:
56
92
validate:
57
93
type: bool
58
94
59
-
built_in_search_page:
95
+
built_in_js:
60
96
type: toggle
61
-
label: Built-in Search Page
97
+
label: Built-in Javascript
62
98
highlight: 1
63
99
default: 1
64
100
options:
@@ -67,10 +103,13 @@ form:
67
103
validate:
68
104
type: bool
69
105
70
-
enable_admin_page_events:
106
+
search_title:
107
+
type: spacer
108
+
title: Search Settings
109
+
110
+
built_in_search_page:
71
111
type: toggle
72
-
label: Enable Admin Page Events
73
-
help: Disable this if you are having problems with timeouts during page saving
112
+
label: Built-in Search Page
74
113
highlight: 1
75
114
default: 1
76
115
options:
@@ -79,6 +118,8 @@ form:
79
118
validate:
80
119
type: bool
81
120
121
+
122
+
82
123
search_route:
83
124
type: text
84
125
size: medium
@@ -202,7 +243,7 @@ form:
202
243
index_page_by_default:
203
244
type: toggle
204
245
label: Index Every Page
205
-
help: Index every page by default unless a page specifically declares `tntsearch: process: false`. Disabling this requires a `process: true` declartion to be added to each page that should be indexed.
246
+
help: 'Index every page by default unless a page specifically declares `tntsearch: process: false`. Disabling this requires a `process: true` declartion to be added to each page that should be indexed.'
0 commit comments