askorama / orama

🌌 Fast, dependency-free, full-text and vector search engine with typo tolerance, filters, facets, stemming, and more. Works with any JavaScript runtime, browser, server, service!
https://docs.askorama.ai
Other
8.27k stars 273 forks source link

Cannot import from @orama/orama/components #657

Open came opened 3 months ago

came commented 3 months ago

Describe the bug

I try to create my own custom Index component as described here: https://docs.oramasearch.com/open-source/internals/components#index. Therefore, I need BM25, index and some other internal types / function. However, I cannot import them as described with

import { index as defaultIndex } from '@orama/orama/components'

Look like it is just not exported anymore :/

BR, Carsten

To Reproduce

Just try to import an you will get the ts error:

Cannot find module '@orama/orama/components' or its corresponding type declarations.ts(2307) ⚠ Error (TS2307) | Cannot find module or its corresponding type declarations.

Expected behavior

I would expect to import from '@orama/orama/components'

Environment Info

OS: MacOS Version 14.1.1 (23B81)
Node: v20.0.0
Orama: ^2.0.9

Affected areas

Initialization

Additional context

I can import the defaultIndex like the following, but I cannot get types like this. e.g. Index

import { components } from '@orama/orama'
const { getDocumentIndexId, index: defaultIndex, internalDocumentIDStore, documentsStore} = components

I looked into the source code, but I could not see an error.

micheleriva commented 3 months ago

@came we're on it

micheleriva commented 3 months ago

quick question, are you using Orama in TypeScript via ESM or via CJS?

came commented 3 months ago

Thank you 👍 I'm importing Orama as ESM