Show which properties matches with your Lyra search.
You can install Lyra using npm
, yarn
, pnpm
:
npm i @mateonunez/lyra-match
yarn add @mateonunez/lyra-match
pnpm add @mateonunez/lyra-match
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'
}
]
}