mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-08-30 09:10:42 +02:00
release 0.8.1
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<body style="white-space: pre">
|
||||
<script type="module">
|
||||
|
||||
import { Index, IndexedDB } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.bundle.module.min.js";
|
||||
import { Index, IndexedDB } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.bundle.module.min.js";
|
||||
|
||||
// create DB instance with namespace
|
||||
const db = new IndexedDB("my-store");
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<body style="white-space: pre">
|
||||
<script type="module">
|
||||
|
||||
import { Index, Resolver } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.bundle.module.min.js";
|
||||
import { Index, Resolver } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.bundle.module.min.js";
|
||||
|
||||
// create a simple index which can store id-content-pairs
|
||||
const index = new Index({
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<body style="white-space: pre">
|
||||
<script type="module">
|
||||
|
||||
import { Index } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.light.module.min.js";
|
||||
import { Index } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.light.module.min.js";
|
||||
|
||||
// create a simple index which can store id-content-pairs
|
||||
const index = new Index({
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Encoder } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.bundle.module.min.js";
|
||||
import { Encoder } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.bundle.module.min.js";
|
||||
|
||||
export default {
|
||||
tokenize: "forward",
|
||||
|
@@ -8,7 +8,10 @@
|
||||
<body style="white-space: pre">
|
||||
<script type="module">
|
||||
|
||||
import { Index } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.light.module.min.js";
|
||||
//import { Index } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.light.module.min.js";
|
||||
import Index from "../../../src/index.js";
|
||||
import Resolver from "../../../src/resolver.js";
|
||||
import Encoder from "../../../src/encoder.js";
|
||||
|
||||
// create a simple index which can store id-content-pairs
|
||||
const index = new Index({
|
||||
@@ -19,8 +22,9 @@
|
||||
|
||||
// some test data
|
||||
const data = [
|
||||
'rats',
|
||||
'cats abcd efgh ijkl mnop qrst uvwx cute',
|
||||
'cats abcd efgh ijkl mnop qrst cute',
|
||||
'cats abcd efgh ijkl mnop dogs cute',
|
||||
'cats abcd efgh ijkl mnop cute',
|
||||
'cats abcd efgh ijkl cute',
|
||||
'cats abcd efgh cute',
|
||||
@@ -33,12 +37,51 @@
|
||||
index.add(id, item);
|
||||
});
|
||||
|
||||
// perform query
|
||||
index.search("cute cat").forEach(i => {
|
||||
// console.log(index.encoder)
|
||||
// console.log(index.encoder.encode("cute"))
|
||||
|
||||
// let test = Encoder({}, {}, {});
|
||||
// console.log(test)
|
||||
|
||||
new Resolver({
|
||||
index: index,
|
||||
query: "dog"
|
||||
})
|
||||
.boost(2)
|
||||
.or({
|
||||
index: index,
|
||||
query: "cut",
|
||||
suggest: true,
|
||||
limit: 10,
|
||||
offset: 0,
|
||||
resolve: true
|
||||
})
|
||||
|
||||
// .not({
|
||||
// index: index,
|
||||
// query: "mnop",
|
||||
//
|
||||
// })
|
||||
// .xor({
|
||||
// index: index,
|
||||
// query: "rats",
|
||||
// limit: 10,
|
||||
// offset: 0,
|
||||
// enrich: true,
|
||||
// resolve: true
|
||||
// })
|
||||
|
||||
.forEach(i => {
|
||||
const result = data[i];
|
||||
log(result);
|
||||
});
|
||||
|
||||
// // perform query
|
||||
// index.search("cute dog", { suggest: true }).forEach(i => {
|
||||
// const result = data[i];
|
||||
// log(result);
|
||||
// });
|
||||
|
||||
function log(str){
|
||||
document.body.appendChild(
|
||||
document.createTextNode(str + "\n")
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<body style="white-space: pre">
|
||||
<script type="module">
|
||||
|
||||
import { Document, Charset } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.compact.module.min.js";
|
||||
import { Document, Charset } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.compact.module.min.js";
|
||||
|
||||
// some test data
|
||||
const data = [{
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<body style="white-space: pre">
|
||||
<script type="module">
|
||||
|
||||
import { Document, Charset, IndexedDB } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.bundle.module.min.js";
|
||||
import { Document, Charset, IndexedDB } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.bundle.module.min.js";
|
||||
|
||||
// some test data
|
||||
const data = [{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Encoder, Charset } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.bundle.module.min.js";
|
||||
import EnglishPreset from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/module/lang/en.js";
|
||||
import { Encoder, Charset } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.bundle.module.min.js";
|
||||
import EnglishPreset from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/module/lang/en.js";
|
||||
|
||||
export default {
|
||||
tokenize: "forward",
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Encoder, Charset } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.bundle.module.min.js";
|
||||
import EnglishPreset from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/module/lang/en.js";
|
||||
import { Encoder, Charset } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.bundle.module.min.js";
|
||||
import EnglishPreset from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/module/lang/en.js";
|
||||
|
||||
export default {
|
||||
tokenize: "forward",
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<body style="white-space: pre">
|
||||
<script type="module">
|
||||
|
||||
import { Document, Charset } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.compact.module.min.js";
|
||||
import { Document, Charset } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.compact.module.min.js";
|
||||
|
||||
// some test data
|
||||
const data = [{
|
||||
|
@@ -8,8 +8,8 @@
|
||||
<body style="white-space: pre">
|
||||
<script type="module">
|
||||
|
||||
import { Index, Encoder, Charset } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/flexsearch.compact.module.min.js";
|
||||
import EnglishPreset from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.0/dist/module/lang/en.js";
|
||||
import { Index, Encoder, Charset } from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/flexsearch.compact.module.min.js";
|
||||
import EnglishPreset from "https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.8.1/dist/module/lang/en.js";
|
||||
|
||||
const encoder = new Encoder(
|
||||
Charset.LatinSimple,
|
||||
|
Reference in New Issue
Block a user