Skip to content

Add support to mutiple result maps (to handle multiple datasources)#99

Merged
rjborba merged 8 commits into
mainfrom
feature/orm-2535
May 23, 2025
Merged

Add support to mutiple result maps (to handle multiple datasources)#99
rjborba merged 8 commits into
mainfrom
feature/orm-2535

Conversation

@rjborba

@rjborba rjborba commented May 14, 2025

Copy link
Copy Markdown
Contributor

Add support for multiple data source.

Check examples below

 // Multiple result maps can be set like this
searchBox.resultMap = [
  {
    title: 'name',
    description: item => {
      return `${item.sex} - ${item.country}`;
    },
    datasourceId: 'dyaqkvxo36199sn6yd7saegdf',
  },
  {
    title: item => {
      return item.Title;
    },
    description: item => {
      return item.Description;
    },
    path: 'ip_address',
    datasourceId: 'jrmilfazf47z8xq2v4n8xs6ww',
  },
];

// Or like this
searchBox.resultMap = {
  title: (item, datasourceId) => {
    if (datasourceId === 'dyaqkvxo36199sn6yd7saegdf') {
      return item.name;
        return item.Title;
  },
  description: (item, datasourceId) => {
    if (datasourceId === 'dyaqkvxo36199sn6yd7saegdf') {
      return `${item.sex} - ${item.country}`;
        return item.Description;
  },
  datasourceId: 'dyaqkvxo36199sn6yd7saegdf',
}

@vercel

vercel Bot commented May 14, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
orama-ui-components-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 1:03am

Comment thread apps/demo-react/src/App.tsx Outdated
<div className="component-row">
<OramaChatBox
sourcesMap={{description: "content"}}
sourcesMap={{ description: 'content' }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sourcesMap reminded me that we should also handle documents coming from different sources even in this case. 👁️

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Another task or in this one? what do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do it in this task so we're sure the layout does not break even for sources list

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed your last message. Sorry! Gonna check it out today!

@aileenvl aileenvl self-requested a review May 15, 2025 07:04
@aileenvl

Copy link
Copy Markdown
Contributor

looks good! should we also add an example with searchbox?

@g-francesca

Copy link
Copy Markdown
Contributor

@rjborba can you please also update the version of @orama/core to 0.1.8

@rjborba rjborba force-pushed the feature/orm-2535 branch from 96bcd9a to affb4f7 Compare May 22, 2025 17:31
@rjborba rjborba merged commit e50be3d into main May 23, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants