Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add identity (ORM-1261) #24

Merged
merged 9 commits into from
Aug 1, 2024
Merged

Feat: add identity (ORM-1261) #24

merged 9 commits into from
Aug 1, 2024

Conversation

niltonheck
Copy link
Contributor

@niltonheck niltonheck commented Jul 2, 2024

@micheleriva I would appreciate if you could double-check this implementation.

I tried to follow the current design but could eventually fail.

Task: ORM-1261 : [Client] Option to specify a custom unique ID

@niltonheck niltonheck requested a review from allevo July 2, 2024 17:09
@niltonheck niltonheck changed the title Feat: add identity Feat: add identity (ORM-1261) Jul 2, 2024
Copy link

linear bot commented Jul 2, 2024

ORM-1261 [Client] Option to specify a custom unique ID

As an Orama user, I want to integrate Orama on my website and define a custom unique ID, so that Orama can track data and connect multiple search sessions to the same known user.

(The provided id will be called alias_id and is provided to the Search client. It will be then saved in telemetry and answer engine data on Clickhouse, to later cross-reference and connect search/ai interaction sessions to a specific known user on the client's website)

Possible approaches (one, both, more?):

Option 1: call a dedicated method to identify a user as soon as their ID is known

import client from 'oramacloud/client'

// as soon as we have the unique user ID...
window.addEventListener('login-performed', e => {
  client.identify(e.my_user_id)
})

window.addEventListener('logout-performed', e => {
  client.clearSession()
})

Option 2: pass an option to Orama Client initialization

import { OramaClient } from 'oramacloud/client'

const client = new OramaClient({ 
  endpoint: 'https://cloud.orama.run/v1/indexes/videogames-ctw5x4', 
  api_key: '0YKaIrKohopObY7anjvFcR3XjEADNIyj',
  identify: () => `${session.user_id}`
}) 

@niltonheck niltonheck requested review from faustoq and micheleriva and removed request for allevo, faustoq and micheleriva July 15, 2024 14:13
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@niltonheck niltonheck merged commit 679362d into main Aug 1, 2024
1 check 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