Skip to content

Commit b365a14

Browse files
committed
Text search doc updates
1 parent 968beff commit b365a14

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

website/docs/collections/text_search.md

+10-23
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The examples below show how to use Algolia as an external search provider, using
2828

2929
### Using Algolia in FireCMS Cloud
3030

31+
3132
We provide a utility method for performing searches in Algolia `performAlgoliaTextSearch`.
3233
You need to import the `algoliasearch` library and create an Algolia client.
3334
Then you can use the `performAlgoliaTextSearch` method to perform the search.
@@ -46,7 +47,8 @@ import {
4647
FirestoreTextSearchController,
4748
buildCollection,
4849
FireCMSCloudApp,
49-
EntityCollectionsBuilder
50+
EntityCollectionsBuilder,
51+
FireCMSAppConfig
5052
} from "@firecms/cloud";
5153

5254
const client: SearchClient | undefined = algoliasearch("YOUR_ALGOLIA_APP_ID", "YOUR_ALGOLIA_SEARCH_KEY");
@@ -57,33 +59,18 @@ const algoliaSearchController = buildExternalSearchController({
5759
path,
5860
searchString
5961
}) => {
60-
if (path === "products")
62+
if (path === "products") {
6163
return performAlgoliaTextSearch(client, "products", searchString);
64+
}
6265
return undefined;
6366
}
6467
});
6568

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-
});
8069

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+
// ...
8774
}
8875
```
8976

@@ -135,7 +122,7 @@ provider, such as Algolia. This is the recommended approach.
135122

136123
You can use local text search in FireCMS Cloud, or in self-hosted versions.
137124

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.
139126

140127
For self-hosted versions, you can enable it by setting the `localTextSearchEnabled` in `useFirestoreDelegate`.
141128
Then you need to mark each collection with `textSearchEnabled: true`.

0 commit comments

Comments
 (0)