@mateonunez/lyra-match
v0.1.2
Published
Show which properties matches with your Lyra search
Downloads
12
Maintainers
Readme
✏️ Match
Show which properties matches with your Lyra search.
Installation
You can install Lyra using npm
, yarn
, pnpm
:
npm i @mateonunez/lyra-match
yarn add @mateonunez/lyra-match
pnpm add @mateonunez/lyra-match
Usage
import { create, insert, search } from "@lyrasearch/lyra"
import { match } from "@mateonunez/lyra-match"
(() => {
const lyra = create({
schema: {
author: "string",
website: "string",
contributors: "number",
stars: "number",
forks: "number",
language: "string"
}
})
insert(lyra, {
author: "Lyra",
website: "https://github.com/LyraSearch",
contributors: 21,
stars: 3350,
forks: 62,
language: "TypeScript"
})
const properties = { term: "Lyra" }
const { hits } = search(lyra, properties)
const matches = match(hits, properties)
console.log({ matches })
})();
Results
{
matches: [
{
id: '57941602-6',
author: 'Lyra',
website: 'https://github.com/LyraSearch'
}
]
}