mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-08-13 17:44:01 +02:00
update examples
This commit is contained in:
@@ -8,6 +8,7 @@ npm install git+https://github.com/nextapps-de/flexsearch/tree/v0.8-preview
|
|||||||
|
|
||||||
- Persistent indexes support for: `IndexedDB` (Browser), `Redis`, `SQLite`, `Postgres`, `MongoDB`, `Clickhouse`
|
- Persistent indexes support for: `IndexedDB` (Browser), `Redis`, `SQLite`, `Postgres`, `MongoDB`, `Clickhouse`
|
||||||
- Enhanced language customization via the new `Encoder` class
|
- Enhanced language customization via the new `Encoder` class
|
||||||
|
- Result Highlighting
|
||||||
- Query performance achieve results up to 4.5 times faster compared to the previous generation v0.7.x by also improving the quality of results
|
- Query performance achieve results up to 4.5 times faster compared to the previous generation v0.7.x by also improving the quality of results
|
||||||
- Enhanced support for larger indexes or larger result sets
|
- Enhanced support for larger indexes or larger result sets
|
||||||
- Improved offset and limit processing achieve up to 100 times faster traversal performance through large datasets
|
- Improved offset and limit processing achieve up to 100 times faster traversal performance through large datasets
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<title>Example: browser-legacy-basic-persistent</title>
|
<title>Example: browser-legacy-basic-persistent</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
(async function(){
|
(async function(){
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<title>Example: browser-legacy-basic-resolver</title>
|
<title>Example: browser-legacy-basic-resolver</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// create a simple index which can store id-content-pairs
|
// create a simple index which can store id-content-pairs
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<title>Example: browser-legacy-basic-suggestion</title>
|
<title>Example: browser-legacy-basic-suggestion</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.light.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.light.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// create a simple index which can store id-content-pairs
|
// create a simple index which can store id-content-pairs
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<title>Example: browser-legacy-basic-worker</title>
|
<title>Example: browser-legacy-basic-worker</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
(async function(){
|
(async function(){
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<title>Example: browser-legacy-basic</title>
|
<title>Example: browser-legacy-basic</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.light.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.light.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// create a simple index which can store id-content-pairs
|
// create a simple index which can store id-content-pairs
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<title>Example: browser-legacy-document-highlighting</title>
|
<title>Example: browser-legacy-document-highlighting</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.compact.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.compact.min.js"></script>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
// some test data
|
// some test data
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
// create the document index
|
// create the document index
|
||||||
const index = new FlexSearch.Document({
|
const index = new FlexSearch.Document({
|
||||||
document: {
|
document: {
|
||||||
id: "tconst",
|
|
||||||
store: true,
|
store: true,
|
||||||
index: [{
|
index: [{
|
||||||
field: "title",
|
field: "title",
|
||||||
@@ -48,8 +47,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// display results
|
// display results
|
||||||
console.log(suggestions);
|
console.log(result);
|
||||||
log(JSON.stringify(suggestions, null, 2));
|
log(JSON.stringify(result, null, 2));
|
||||||
|
|
||||||
function log(str){
|
function log(str){
|
||||||
document.body.appendChild(
|
document.body.appendChild(
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<title>Example: browser-legacy-document-persistent</title>
|
<title>Example: browser-legacy-document-persistent</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
(async function(){
|
(async function(){
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<title>Example: browser-legacy-document-worker</title>
|
<title>Example: browser-legacy-document-worker</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
(async function(){
|
(async function(){
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<title>Example: browser-legacy-document</title>
|
<title>Example: browser-legacy-document</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.compact.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.compact.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// some test data
|
// some test data
|
||||||
|
@@ -6,9 +6,9 @@
|
|||||||
<title>Example: browser-legacy-language-packs</title>
|
<title>Example: browser-legacy-language-packs</title>
|
||||||
</head>
|
</head>
|
||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.compact.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.compact.min.js"></script>
|
||||||
<!-- Load language pack after loading the library -->
|
<!-- Load language pack after loading the library -->
|
||||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/lang/en.min.js"></script>
|
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/lang/en.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
const encoder = new FlexSearch.Encoder(
|
const encoder = new FlexSearch.Encoder(
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import { Index, IndexedDB } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.module.min.js";
|
import { Index, IndexedDB } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.module.min.js";
|
||||||
|
|
||||||
// create DB instance with namespace
|
// create DB instance with namespace
|
||||||
const db = new IndexedDB("my-store");
|
const db = new IndexedDB("my-store");
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import { Index, Resolver } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.module.min.js";
|
import { Index, Resolver } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.module.min.js";
|
||||||
|
|
||||||
// create a simple index which can store id-content-pairs
|
// create a simple index which can store id-content-pairs
|
||||||
const index = new Index({
|
const index = new Index({
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import { Index } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.light.module.min.js";
|
import { Index } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.light.module.min.js";
|
||||||
|
|
||||||
// create a simple index which can store id-content-pairs
|
// create a simple index which can store id-content-pairs
|
||||||
const index = new Index({
|
const index = new Index({
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Encoder } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.module.min.js";
|
import { Encoder } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.module.min.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
tokenize: "forward",
|
tokenize: "forward",
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import { Index } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.light.module.min.js";
|
import { Index } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.light.module.min.js";
|
||||||
|
|
||||||
// create a simple index which can store id-content-pairs
|
// create a simple index which can store id-content-pairs
|
||||||
const index = new Index({
|
const index = new Index({
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import { Document, Charset } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.compact.module.min.js";
|
import { Document, Charset } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.compact.module.min.js";
|
||||||
|
|
||||||
// some test data
|
// some test data
|
||||||
const data = [{
|
const data = [{
|
||||||
@@ -22,7 +22,6 @@
|
|||||||
// create the document index
|
// create the document index
|
||||||
const index = new Document({
|
const index = new Document({
|
||||||
document: {
|
document: {
|
||||||
id: "tconst",
|
|
||||||
store: true,
|
store: true,
|
||||||
index: [{
|
index: [{
|
||||||
field: "title",
|
field: "title",
|
||||||
@@ -49,8 +48,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// display results
|
// display results
|
||||||
console.log(suggestions);
|
console.log(result);
|
||||||
log(JSON.stringify(suggestions, null, 2));
|
log(JSON.stringify(result, null, 2));
|
||||||
|
|
||||||
function log(str){
|
function log(str){
|
||||||
document.body.appendChild(
|
document.body.appendChild(
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import { Document, Charset, IndexedDB } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.module.min.js";
|
import { Document, Charset, IndexedDB } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.module.min.js";
|
||||||
|
|
||||||
// some test data
|
// some test data
|
||||||
const data = [{
|
const data = [{
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Encoder, Charset } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.module.min.js";
|
import { Encoder, Charset } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.module.min.js";
|
||||||
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/module/lang/en.js";
|
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/module/lang/en.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
tokenize: "forward",
|
tokenize: "forward",
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Encoder, Charset } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.bundle.module.min.js";
|
import { Encoder, Charset } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.bundle.module.min.js";
|
||||||
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/module/lang/en.js";
|
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/module/lang/en.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
tokenize: "forward",
|
tokenize: "forward",
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import { Document, Charset } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.compact.module.min.js";
|
import { Document, Charset } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.compact.module.min.js";
|
||||||
|
|
||||||
// some test data
|
// some test data
|
||||||
const data = [{
|
const data = [{
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
<body style="white-space: pre">
|
<body style="white-space: pre">
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import { Index, Encoder, Charset } from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.compact.module.min.js";
|
import { Index, Encoder, Charset } from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/flexsearch.compact.module.min.js";
|
||||||
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/module/lang/en.js";
|
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/9e1b24a124c3d0065b4ddf5cea9d109aca2fb7d2/dist/module/lang/en.js";
|
||||||
|
|
||||||
const encoder = new Encoder(
|
const encoder = new Encoder(
|
||||||
Charset.LatinSimple,
|
Charset.LatinSimple,
|
||||||
|
Reference in New Issue
Block a user