Skip to content

Commit

Permalink
doc: fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
amandesai01 committed Jan 13, 2024
1 parent 75bb188 commit cc03a73
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 30 deletions.
15 changes: 0 additions & 15 deletions CHANGELOG.md

This file was deleted.

89 changes: 74 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,90 @@
<!--
Get your module up and running quickly.
Find and replace all on all files (CMD+SHIFT+F):
- Name: Nuxt Orama
- Package name: nuxt-orama
- Description: Nuxt module for first-class integration with OramaSearch.
-->

# Nuxt Orama

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]

Nuxt module for first-class integration with OramaSearch. for doing amazing things.
Nuxt module for hassle free integration with [OramaSearch](https://oramasearch.com).

- [&nbsp;Release Notes](/CHANGELOG.md)
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/nuxt-orama?file=playground%2Fapp.vue) -->
<!-- - [📖 &nbsp;Documentation](https://example.com) -->
- [🏀 Online playground](https://stackblitz.com/github/amandesai01/nuxt-orama?file=playground%2Fapp.vue)


## Features

<!-- Highlight some of the features your module provide here -->
-&nbsp;Access a search DB everywhere
- 🚠 &nbsp;Bar
- 🌲 &nbsp;Baz
- Extremely easy to configure.
- Easily access Orama instance throughout application.
- Hooks available to populate Orama instance via plugins.
- Handy composables such as `useOramaSearch()`
- Reactive search results population, say good-bye to `watch` and `watchEffect`.

## Problems Solved
- No need to wait for instance initialisation on frontend before puting items into index.
- No need to resolve promises while searching and adding items to index.
- Fix a common issue where first query fails because search function is triggered before index built.

## Usage

Edit your `nuxt.config.ts` like this
```js
export default defineNuxtConfig({
modules: ["nuxt-orama"],
orama: {
schemas: [
{
schema: {
id: "string",
username: "string",
...
},
id: 'userIndex'
},
// other schemas here.
],
},
});

```

Now on any page, simply use like this
```html
<template>
<div>
<input
v-model="searchInput"
type="text"
>
{{ JSON.stringify(orama.searchResults.value) }}
</div>
</template>

<script setup>
const searchInput = ref("");
const orama = useOramaSearch('userIndex');
watchEffect(() => {
if (searchInput.value) {
orama.search({
term: searchInput.value,
})
}
})
</script>

```


## Roadmap
- [x] Wrap around `search` and `insertMultiple`
- [ ] Hooks for plugins to insert data during indexing
- [ ] Wrap around other functions such for `update`, `remove`
- [ ] Types generation for schemas.
- [ ] Separate `orama.config.ts` file to not populate Nuxt config.

... expect more within weeks.

## Quick Setup

Expand Down

0 comments on commit cc03a73

Please sign in to comment.