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: Rewritten with components architecture. #305

Merged
merged 5 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
},
"experimental": {
"keepImportAssertions": true
},
"baseUrl": ".",
"paths": {
"@stemmer/*": ["./src/stemmer/*"]
}
},
"sourceMaps": true
Expand All @@ -41,10 +37,6 @@
},
"experimental": {
"keepImportAssertions": true
},
"baseUrl": ".",
"paths": {
"@stemmer/*": ["./src/stemmer/*"]
}
},
"sourceMaps": true
Expand Down
14 changes: 9 additions & 5 deletions benchmarks/src/typo-tolerant-search.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import cronometro from "cronometro";
import { create, insertBatch, search } from "../../dist/index.js";
import { isMainThread } from "worker_threads";
import { create, insertMultiple, search } from "../../dist/index.js";
import { createTokenizer } from "../../dist/internals.js";
import { formattedEvents } from "./utils/dataset.js";

const db = await create({
Expand All @@ -22,15 +24,17 @@ const dbNoStemming = await create({
second: "string",
},
},
tokenizer: {
enableStemming: false,
components: {
tokenizer: await createTokenizer("english", { stemming: false }),
},
});

const first30000Events = formattedEvents.slice(0, 30_000);

await insertBatch(db, first30000Events);
await insertBatch(dbNoStemming, first30000Events);
if (!isMainThread) {
await insertMultiple(db, first30000Events);
await insertMultiple(dbNoStemming, first30000Events);
}

await cronometro({
'search "beauty", default settings': () => {
Expand Down
20 changes: 10 additions & 10 deletions examples/with-react/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Lyra + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Lyra + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
134 changes: 67 additions & 67 deletions examples/with-react/src/App.css
Original file line number Diff line number Diff line change
@@ -1,113 +1,113 @@
.main {
width: 80vw;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 80vw;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.top {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin: 2rem 0;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin: 2rem 0;
}

.title,
.movieTitle {
width: 100%;
text-align: left;
font-size: 1.5rem;
margin: 0;
width: 100%;
text-align: left;
font-size: 1.5rem;
margin: 0;
}

.movieTitle {
font-size: 1.2rem;
margin-bottom: 1rem;
font-size: 1.2rem;
margin-bottom: 1rem;
}

.input {
outline: none;
border: none;
background-color: transparent;
border: 1px solid #d5b3ffaa;
border-radius: 1rem;
padding: 0.5rem 1rem;
width: 50%;
font-size: 1rem;
color: #eee;
transition: 0.15s;
outline: none;
border: none;
background-color: transparent;
border: 1px solid #d5b3ffaa;
border-radius: 1rem;
padding: 0.5rem 1rem;
width: 50%;
font-size: 1rem;
color: #eee;
transition: 0.15s;
}

.input:focus {
border-color: #d5b3ff;
border-color: #d5b3ff;
}

.button {
outline: none;
border: none;
background-color: transparent;
border: 1px solid #ef4444;
border-radius: 0.5rem;
padding: 0.5rem 1rem;
width: fit-content;
font-size: 1rem;
color: #eee;
cursor: pointer;
transition: 0.15s;
outline: none;
border: none;
background-color: transparent;
border: 1px solid #ef4444;
border-radius: 0.5rem;
padding: 0.5rem 1rem;
width: fit-content;
font-size: 1rem;
color: #eee;
cursor: pointer;
transition: 0.15s;
}

.button:hover {
color: #ef4444;
color: #ef4444;
}

.container {
width: 100%;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
column-gap: 1rem;
row-gap: 1rem;
width: 100%;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
column-gap: 1rem;
row-gap: 1rem;
}

.movie {
padding: 1rem;
border-radius: 0.5rem;
border: 2px solid #d5b3ffaa;
cursor: pointer;
transition: 0.15s;
padding: 1rem;
border-radius: 0.5rem;
border: 2px solid #d5b3ffaa;
cursor: pointer;
transition: 0.15s;
}

.movie:hover {
border-color: #d5b3ff;
border-color: #d5b3ff;
}

.favLabel {
width: 100%;
text-align: right;
margin: 0;
width: 100%;
text-align: right;
margin: 0;
}

.details {
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: center;
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: center;
}

.sub {
margin: 0;
text-align: right;
margin: 0;
text-align: right;
}

@media (max-width: 700px) {
.container {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
.container {
grid-template-columns: repeat(1, minmax(0, 1fr));
}

.input {
width: 90%;
}
.input {
width: 90%;
}
}
Loading