Skip to content

Commit d4bb434

Browse files
committed
[website,stroybook] add documentation on how node & edge attributes are
indexed in minisearch Fix #80
1 parent 1e3e228 commit d4bb434

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

‎packages/storybook/stories/GraphSearch.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,15 @@ export const GraphSearchDemo: FC<{ style?: CSSProperties }> = ({ style }) => {
6060
<LayoutForceAtlas2Control />
6161
</ControlsContainer>
6262
<ControlsContainer position={'top-right'}>
63+
{/* In this example we set minisearch options to allow searching on the node's attribute named `tag`.
64+
Node & edge attributes are indexed with the prefix `prop_` to avoid name collision. */}
6365
<GraphSearch
6466
type="nodes"
6567
value={selectedNode ? { type: 'nodes', id: selectedNode } : null}
6668
onFocus={onFocus}
6769
onChange={onChange}
6870
postSearchResult={postSearchResult}
71+
minisearchOptions={{ fields: ['prop_tag'] }}
6972
/>
7073
</ControlsContainer>
7174
</SigmaContainer>

‎packages/website/docs/example/07_graph-search.mdx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ If you need it, you can use this index in your own component. To do this, you ne
4141
- Use the hook [useGraphSearch](/docs/api/graph-search/functions/useGraphSearch) which return a
4242
[search function](/docs/api/graph-search/functions/useGraphSearch#search).
4343

44+
:::warning
45+
46+
Node & edge attributes are indexed with the prefix `prop_` to avoid name collision. So if you want to use the index by
47+
yourself, or to customize the `minisearchOptions` in the `GraphSearch` component, be ware of that.
48+
49+
:::
50+
4451
## Node & Edge display
4552

4653
This package also exposes components to display `Node` and `Edge` like they are displayed in the graph :

0 commit comments

Comments
 (0)