@@ -28,6 +28,7 @@ The examples below show how to use Algolia as an external search provider, using
28
28
29
29
### Using Algolia in FireCMS Cloud
30
30
31
+
31
32
We provide a utility method for performing searches in Algolia ` performAlgoliaTextSearch ` .
32
33
You need to import the ` algoliasearch ` library and create an Algolia client.
33
34
Then you can use the ` performAlgoliaTextSearch ` method to perform the search.
@@ -46,7 +47,8 @@ import {
46
47
FirestoreTextSearchController ,
47
48
buildCollection ,
48
49
FireCMSCloudApp ,
49
- EntityCollectionsBuilder
50
+ EntityCollectionsBuilder ,
51
+ FireCMSAppConfig
50
52
} from " @firecms/cloud" ;
51
53
52
54
const client: SearchClient | undefined = algoliasearch (" YOUR_ALGOLIA_APP_ID" , " YOUR_ALGOLIA_SEARCH_KEY" );
@@ -57,33 +59,18 @@ const algoliaSearchController = buildExternalSearchController({
57
59
path ,
58
60
searchString
59
61
}) => {
60
- if (path === " products" )
62
+ if (path === " products" ) {
61
63
return performAlgoliaTextSearch (client , " products" , searchString );
64
+ }
62
65
return undefined ;
63
66
}
64
67
});
65
68
66
- export default function App() {
67
-
68
- const productCollection = buildCollection ({
69
- path: " products" ,
70
- name: " Products" ,
71
- textSearchEnabled: true ,
72
- properties: {
73
- name: {
74
- dataType: " string" ,
75
- name: " Name" ,
76
- validation: { required: true }
77
- }
78
- }
79
- });
80
69
81
- return <FireCMSCloudApp
82
- name = { " My Online Shop" }
83
- collections = { [productCollection ]}
84
- textSearchController = { algoliaSearchController }
85
- firebaseConfig = { firebaseConfig }
86
- />;
70
+ const appConfig: FireCMSAppConfig = {
71
+ version: " 1" ,
72
+ textSearchControllerBuilder: algoliaSearchController ,
73
+ // ...
87
74
}
88
75
```
89
76
@@ -135,7 +122,7 @@ provider, such as Algolia. This is the recommended approach.
135
122
136
123
You can use local text search in FireCMS Cloud, or in self-hosted versions.
137
124
138
- For FireCMS Cloud, you just need to enable it with the UI.
125
+ For FireCMS Cloud, you just need to enable it in the UI.
139
126
140
127
For self-hosted versions, you can enable it by setting the ` localTextSearchEnabled ` in ` useFirestoreDelegate ` .
141
128
Then you need to mark each collection with ` textSearchEnabled: true ` .
0 commit comments