Skip to content

Commit c681f3d

Browse files
committed
Fixes typo and add front end explaination
1 parent 5928461 commit c681f3d

File tree

4 files changed

+92
-23
lines changed

4 files changed

+92
-23
lines changed

README.md

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
MeiliSearch is an open-source search engine. [Discover what MeiliSearch is!](https://github.com/meilisearch/meilisearch)
2727

28-
Add your Strapi collections into a MeiliSearch instance. The plugin listens to modifications made on your collections and update MeiliSearch accordingly.
28+
Add your Strapi collections into a MeiliSearch instance. The plugin listens to modifications made on your collections and updates MeiliSearch accordingly.
2929

3030
## Table of Contents <!-- omit in toc -->
3131

@@ -61,7 +61,7 @@ To apply the plugin to Strapi, a re-build is needed:
6161
strapi build
6262
```
6363

64-
You will need both a running Strapi app and a running MeiliSearch instance. For [specific version compatibiliy see this section](#-compatibility-with-meilisearch).
64+
You will need both a running Strapi app and a running MeiliSearch instance. For [specific version compatibility see this section](#-compatibility-with-meilisearch).
6565

6666
### 🏃‍♀️ Run MeiliSearch
6767

@@ -79,17 +79,17 @@ yarn develop
7979
If you don't have a running Strapi project yet, you can either launch the [playground present in this project](#playground) or [create a Strapi Project](#create-strapi-project).
8080

8181

82-
It is recommended to add your collections in developement mode as it allows the server reloads, needed to apply hooks.
82+
We recommend adding your collections in development mode to allow the server reloads needed to apply hooks.
8383

8484
```bash
8585
strapi develop
8686
```
8787

8888
## 🎬 Getting Started
8989

90-
Now that you have installed the plugin, a running meiliSearch instance and, a running Strapi app, lets go the plugin page on your admin dashboard.
90+
Now that you have installed the plugin, a running meiliSearch instance and, a running Strapi app, let's go to the plugin page on your admin dashboard.
9191

92-
On the left-navbar `MeiliSearch` appears under the `PLUGINS` category. If it does not, ensure that you have installed the plugin and re-build Strapi (see [installation](#-installation)).
92+
On the left-navbar, `MeiliSearch` appears under the `PLUGINS` category. If it does not, ensure that you have installed the plugin and re-build Strapi (see [installation](#-installation)).
9393

9494
### 🤫 Add Credentials
9595

@@ -111,20 +111,18 @@ If you don't have any collection yet in your Strapi Plugin, please follow [Strap
111111

112112
We will use, as **example**, the collections provided by Strapi's quickstart.
113113

114-
On your plugin homepage you should have two collections appearing: `restaurant` and `category`.
114+
On your plugin homepage, you should have two collections appearing: `restaurant` and `category`.
115115

116116
<p align="center">
117117
<img src="./assets/collections_indexed.png" alt="Indexed collections need a reload" width="600"/>
118118
</p>
119119

120-
By clicking on the left checkbox, the collection will be automatically indexed in MeiliSearch. For example, if you click on the `restaurant` checkbox, all your restaurants are now available in MeiliSearch.
121-
122-
You can check it using
120+
By clicking on the left checkbox, the collection is automatically indexed in MeiliSearch. For example, if you click on the `restaurant` checkbox, all your restaurants are now available in MeiliSearch. We will see in [start searching](#-start-searching) how to try it out.
123121

124122
### 🪝 Apply Hooks
125123

126124
Hooks are listeners that update MeiliSearch each time you add/update/delete an entry in your collections.
127-
In order to activate them you will have to reload the server. This is possible by clicking on the `Reload Server` button if you are in auto-reload mode, or by manually reloading the server mode.
125+
To activate them, you will have to reload the server. If you are in develop mode, click on the red `Reload Server` button. If not, reload the server manually!
128126

129127

130128
<p align="center">
@@ -136,16 +134,23 @@ In order to activate them you will have to reload the server. This is possible b
136134

137135
Once you have a collection containing documents indexed in MeiliSearch, you can [start searching](https://docs.meilisearch.com/learn/getting_started/quick_start.html#search).
138136

139-
Using the above credentials the following code shows how to search on one of your collections:
137+
Using the above credentials, the following code shows how to search on one of your collections:
140138

141139
To search in MeiliSearch, you can use the [instant-meilisearch](https://github.com/meilisearch/instant-meilisearch) SDK that integrates a whole search interface, or our library [meilisearch-js](https://github.com/meilisearch/meilisearch-js).
142140

143141
#### ⚡️ Using Instant meiliSearch
144142

143+
You can have a front up and running in record time with [instant-meilisearch](https://github.com/meilisearch/instant-meilisearch).
144+
145+
146+
<p align="center">
147+
<img src="./assets/obrigado.gif" alt="Restaurant demo" width="600"/>
148+
</p>
149+
150+
In Instant MeiliSearch, you only have to provide your credentials and index name (`restaurant` is the index name in our example).
145151

146-
In Instant MeiliSearch you only have to provide your credentials and your index name (`restaurant` is the index name in our example).
152+
You can have a quick preview with the following code in an HTML file. Create an HTML file, copy-paste the code below and open the file in your browser (or find it in `/front_examples/restaurant.html`).
147153

148-
You can have a quick preview the following code in a HTML file
149154
```html
150155
<!DOCTYPE html>
151156
<html lang="en">
@@ -162,7 +167,7 @@ You can have a quick preview the following code in a HTML file
162167
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
163168
<script>
164169
const search = instantsearch({
165-
indexName: "movies",
170+
indexName: "restaurant",
166171
searchClient: instantMeiliSearch(
167172
"http://localhost:7700"
168173
)
@@ -179,7 +184,7 @@ You can have a quick preview the following code in a HTML file
179184
item: `
180185
<div>
181186
<div class="hit-name">
182-
{{#helpers.highlight}}{ "attribute": "title" }{{/helpers.highlight}}
187+
{{#helpers.highlight}}{ "attribute": "name" }{{/helpers.highlight}}
183188
</div>
184189
</div>
185190
`
@@ -192,7 +197,11 @@ You can have a quick preview the following code in a HTML file
192197
</html>
193198
```
194199

200+
#### 💛 Using MeiliSearch for JS
201+
202+
You can also use [meilisearch-js](https://github.com/meilisearch/meilisearch-js) to communicate with MeiliSearch.
195203

204+
The following code is a setup that will output a restaurant after a search.
196205

197206
```javascript
198207
import { MeiliSearch } from 'meilisearch'
@@ -204,7 +213,7 @@ import { MeiliSearch } from 'meilisearch'
204213
})
205214

206215
// An index is where the documents are stored.
207-
const response = client.index('movies').search('biscoute')
216+
const response = client.index('movies').search('Biscoutte')
208217
})()
209218
```
210219

@@ -243,7 +252,11 @@ npm install
243252
npm run develop
244253
```
245254

246-
Install Strapi with this **Quickstart** command to create a Strapi project instantly:
255+
This command will install the required dependencies and launch the app in development mode. You should be able to reach it on the [port 8000 of your localhost](http://localhost:8000/admin/).
256+
257+
### Create Strapi project
258+
259+
Install Strapi with this [quickstart]((https://strapi.io/documentation/developer-docs/latest/getting-started/quick-start.html)) command to create a Strapi project instantly:
247260

248261
#### Create strapi project
249262

@@ -257,9 +270,9 @@ yarn create strapi-app my-project --quickstart
257270
npx create-strapi-app my-project --quickstart
258271
```
259272

260-
_This command generates a brand new project with the default features (authentication, permissions, content management, content type builder & file upload). The **Quickstart** command installs Strapi using a **SQLite** database which is used for prototyping in development._
273+
_This command generates a brand new project with the default features (authentication, permissions, content management, content type builder & file upload). The **Quickstart** command installs Strapi using a **SQLite** database used for prototyping in development._
261274

262-
Once your Strapi project has been created, to link the plugin to this project you have to create a symbolic link inside a plugin folder at the root of the Strapi project.
275+
Once your Strapi project has been created, to link the plugin to this project you have to create a symbolic link inside a plugin folder Strapi's project root.
263276

264277
1. Create plugin folder
265278

@@ -287,22 +300,27 @@ You can now use the plugin on your Strapi project.
287300

288301
## 🤖 Compatibility with MeiliSearch and Strapi
289302

290-
Complete installation requirements are exact same as for Strapi itself and can be found in the documentation under [Installation Requirements](https://strapi.io/documentation/v3.x/installation/cli.html#step-1-make-sure-requirements-are-met).
303+
Complete installation requirements are the same as for Strapi itself and can be found in the documentation under [installation Requirements](https://strapi.io/documentation/v3.x/installation/cli.html#step-1-make-sure-requirements-are-met).
291304

292305
**Supported Strapi versions**:
293306

294307
- Strapi v3.4.x
295308

296309
(This plugin may work with the older Strapi versions, but these are not tested nor officially supported at this time.)
297310

311+
**Supported MeiliSearch versions**:
312+
313+
- MeiliSearch v0.19
314+
315+
To update MeiliSearch to a more recent version, please follow [this guide](https://docs.meilisearch.com/create/how_to/updating.html#update-to-the-latest-meilisearch-version).
316+
298317
**Node / NPM versions**:
299318

300319
- NodeJS >= 12.10 <= 14
301320
- NPM >= 6.x
302321

303322
**We recommend always using the latest version of Strapi to start your new projects**.
304323

305-
306324
## ⚙️ Development Workflow and Contributing
307325

308326
Any new contribution is more than welcome in this project!
@@ -311,5 +329,16 @@ If you want to know more about the development workflow or want to contribute, p
311329

312330
## 🌎 Community support
313331

314-
- For general help using Strapi, please refer to [the official Strapi documentation](https://strapi.io/documentation/).
315-
- Strapi Slack [channel](https://slack.strapi.io/)
332+
- MeiliSearch [community Slack](https://slack.meilisearch.com/)
333+
- For general help using **MeiliSearch**, please refer to [the official MeiliSearch documentation](https://docs.meilisearch.com).
334+
- Strapi [community Slack](https://slack.strapi.io/)
335+
- For general help using **Strapi**, please refer to [the official Strapi documentation](https://strapi.io/documentation/).
336+
337+
## 🤩 Just for the pleasure of the eyes
338+
339+
Using the [foodadvisor](https://github.com/strapi/foodadvisor) restaurant demo Strapi provided. We added a searchbar to it using [instant-meilisearch](https://github.com/meilisearch/instant-meilisearch).
340+
341+
<p align="center">
342+
<img src="./assets/restaurant.gif" alt="Fooradvisor demo" width="600"/>
343+
</p>
344+

assets/obrigado.gif

216 KB
Loading

assets/restaurant.gif

344 KB
Loading

front_example/restaurant.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<head>
3+
<meta charset="utf-8" />
4+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@meilisearch/instant-meilisearch/templates/basic_search.css" />
5+
</head>
6+
<html>
7+
<body>
8+
<div id="app" class="wrapper"></div>
9+
</body>
10+
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
11+
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
12+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/ReactInstantSearchDOM.js"></script>
13+
<script src="https://cdn.jsdelivr.net/npm/@meilisearch/instant-meilisearch/dist/instant-meilisearch.umd.min.js"></script>
14+
<script>
15+
const { InstantSearch, SearchBox, Hits, Highlight, Configure } = ReactInstantSearchDOM;
16+
const searchClient = instantMeiliSearch(
17+
"http://localhost:7700",
18+
"masterKey"
19+
);
20+
21+
const App = () => (
22+
React.createElement(InstantSearch, {
23+
indexName: "restaurant",
24+
searchClient: searchClient
25+
}, [
26+
React.createElement(SearchBox, { key: 1 }),
27+
React.createElement(Hits, { hitComponent: Hit, key: 2 }),
28+
React.createElement(Configure, { hitsPerPage: 10 })]
29+
)
30+
);
31+
function Hit(props) {
32+
return React.createElement(Highlight, {
33+
attribute: "name",
34+
hit: props.hit
35+
})
36+
}
37+
const domContainer = document.querySelector('#app');
38+
ReactDOM.render(React.createElement(App), domContainer);
39+
</script>
40+
</html>

0 commit comments

Comments
 (0)