mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-08-29 16:50:13 +02:00
usinst Sqlite within examples
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
const { Document, Charset } = require("flexsearch");
|
||||
const fs = require("fs");
|
||||
|
||||
// loading test data
|
||||
const data = JSON.parse(fs.readFileSync(__dirname + "/../data.json", "utf8"));
|
||||
const data = require(__dirname + "/../data.json");
|
||||
|
||||
// create the document index
|
||||
const document = new Document({
|
||||
|
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "nodejs-document",
|
||||
"dependencies": {
|
||||
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"
|
||||
}
|
||||
}
|
@@ -1,14 +1,17 @@
|
||||
const { Document, Charset } = require("flexsearch");
|
||||
const Postgres = require("flexsearch/db/postgres");
|
||||
const fs = require("fs");
|
||||
const Sqlite = require("flexsearch/db/sqlite");
|
||||
// const Postgres = require("flexsearch/db/postgres");
|
||||
// const MongoDB = require("flexsearch/db/mongodb");
|
||||
// const Redis = require("flexsearch/db/redis");
|
||||
// const Clickhouse = require("flexsearch/db/clickhouse");
|
||||
|
||||
// loading test data
|
||||
const data = JSON.parse(fs.readFileSync(__dirname + "/../data.json", "utf8"));
|
||||
const data = require(__dirname + "/../data.json");
|
||||
|
||||
(async function(){
|
||||
|
||||
// create DB instance with namespace
|
||||
const db = new Postgres("my-store");
|
||||
const db = new Sqlite("my-store");
|
||||
|
||||
// create the document index
|
||||
const document = new Document({
|
||||
@@ -33,8 +36,8 @@ const data = JSON.parse(fs.readFileSync(__dirname + "/../data.json", "utf8"));
|
||||
});
|
||||
|
||||
await document.mount(db);
|
||||
await document.destroy();
|
||||
await document.mount(db);
|
||||
// await document.destroy();
|
||||
// await document.mount(db);
|
||||
|
||||
// add test data
|
||||
for(let i = 0; i < data.length; i++){
|
||||
@@ -46,7 +49,7 @@ const data = JSON.parse(fs.readFileSync(__dirname + "/../data.json", "utf8"));
|
||||
|
||||
// perform a query
|
||||
const result = await document.search({
|
||||
query: "carmencita",
|
||||
query: "carmen",
|
||||
tag: {
|
||||
"startYear": "1894",
|
||||
"genres": [
|
||||
|
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
@@ -1,5 +1,9 @@
|
||||
import { Document, Charset } from "flexsearch/esm";
|
||||
import Postgres from "flexsearch/esm/db/postgres";
|
||||
import Sqlite from "flexsearch/db/sqlite";
|
||||
// import Postgres from "flexsearch/db/postgres";
|
||||
// import MongoDB from "flexsearch/db/mongodb";
|
||||
// import Redis from "flexsearch/db/redis";
|
||||
// import Clickhouse from "flexsearch/db/clickhouse";
|
||||
import fs from "fs";
|
||||
|
||||
const dirname = import.meta.dirname;
|
||||
@@ -9,7 +13,7 @@ const data = JSON.parse(fs.readFileSync(dirname + "/../data.json", "utf8"));
|
||||
(async function(){
|
||||
|
||||
// create DB instance with namespace
|
||||
const db = new Postgres("my-store");
|
||||
const db = new Sqlite("my-store");
|
||||
|
||||
// create the document index
|
||||
const document = new Document({
|
||||
@@ -47,7 +51,7 @@ const data = JSON.parse(fs.readFileSync(dirname + "/../data.json", "utf8"));
|
||||
|
||||
// perform a query
|
||||
const result = await document.search({
|
||||
query: "carmencita",
|
||||
query: "carmen",
|
||||
tag: {
|
||||
"startYear": "1894",
|
||||
"genres": [
|
||||
|
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
240
example/nodejs-persistent/package-lock.json
generated
240
example/nodejs-persistent/package-lock.json
generated
@@ -1,240 +0,0 @@
|
||||
{
|
||||
"name": "nodejs-worker-persistent",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "nodejs-worker-persistent",
|
||||
"dependencies": {
|
||||
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview",
|
||||
"pg-promise": "^11.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/assert-options": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/assert-options/-/assert-options-0.8.2.tgz",
|
||||
"integrity": "sha512-XaXoMxY0zuwAb0YuZjxIm8FeWvNq0aWNIbrzHhFjme8Smxw4JlPoyrAKQ6808k5UvQdhvnWqHZCphq5mXd4TDA==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/flexsearch": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "git+ssh://git@github.com/nextapps-de/flexsearch.git#a253897675cdb1361554abdc7f57305a6d52de25",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/pg": {
|
||||
"version": "8.14.0",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-8.14.0.tgz",
|
||||
"integrity": "sha512-nXbVpyoaXVmdqlKEzToFf37qzyeeh7mbiXsnoWvstSqohj88yaa/I/Rq/HEVn2QPSZEuLIJa/jSpRDyzjEx4FQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"pg-connection-string": "^2.7.0",
|
||||
"pg-pool": "^3.8.0",
|
||||
"pg-protocol": "^1.8.0",
|
||||
"pg-types": "^2.1.0",
|
||||
"pgpass": "1.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"pg-cloudflare": "^1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"pg-native": ">=3.0.1"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"pg-native": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/pg-cloudflare": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz",
|
||||
"integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/pg-connection-string": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.7.0.tgz",
|
||||
"integrity": "sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA=="
|
||||
},
|
||||
"node_modules/pg-cursor": {
|
||||
"version": "2.13.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-cursor/-/pg-cursor-2.13.0.tgz",
|
||||
"integrity": "sha512-13jHi54EawM9aQhmf0+xRtvaL/g4kBjnx/tEXWAIPNKm4bxUofPfc5navrgt47z85AsxUDx4f40IzF1y9tUyeA==",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"pg": "^8"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-int8": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
|
||||
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-minify": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-minify/-/pg-minify-1.7.0.tgz",
|
||||
"integrity": "sha512-kFPxAWAhPMvOqnY7klP3scdU5R7bxpAYOm8vGExuIkcSIwuFkZYl4C4XIPQ8DtXY2NzVmAX1aFHpvFSXQ/qQmA==",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-pool": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.8.0.tgz",
|
||||
"integrity": "sha512-VBw3jiVm6ZOdLBTIcXLNdSotb6Iy3uOCwDGFAksZCXmi10nyRvnP2v3jl4d+IsLYRyXf6o9hIm/ZtUzlByNUdw==",
|
||||
"peerDependencies": {
|
||||
"pg": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-promise": {
|
||||
"version": "11.11.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-11.11.0.tgz",
|
||||
"integrity": "sha512-nqtNHp9dvE1aMug2spLJBy6AazT9arorTlRqreHXu50pCArwQDpbu/R0tDUcyNYY4XP5HczwknkUzYi+ivyozQ==",
|
||||
"dependencies": {
|
||||
"assert-options": "0.8.2",
|
||||
"pg": "8.13.3",
|
||||
"pg-minify": "1.7.0",
|
||||
"spex": "3.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"pg-query-stream": "4.7.3"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-promise/node_modules/pg": {
|
||||
"version": "8.13.3",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-8.13.3.tgz",
|
||||
"integrity": "sha512-P6tPt9jXbL9HVu/SSRERNYaYG++MjnscnegFh9pPHihfoBSujsrka0hyuymMzeJKFWrcG8wvCKy8rCe8e5nDUQ==",
|
||||
"dependencies": {
|
||||
"pg-connection-string": "^2.7.0",
|
||||
"pg-pool": "^3.7.1",
|
||||
"pg-protocol": "^1.7.1",
|
||||
"pg-types": "^2.1.0",
|
||||
"pgpass": "1.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"pg-cloudflare": "^1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"pg-native": ">=3.0.1"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"pg-native": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/pg-protocol": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.8.0.tgz",
|
||||
"integrity": "sha512-jvuYlEkL03NRvOoyoRktBK7+qU5kOvlAwvmrH8sr3wbLrOdVWsRxQfz8mMy9sZFsqJ1hEWNfdWKI4SAmoL+j7g=="
|
||||
},
|
||||
"node_modules/pg-query-stream": {
|
||||
"version": "4.7.3",
|
||||
"resolved": "https://registry.npmjs.org/pg-query-stream/-/pg-query-stream-4.7.3.tgz",
|
||||
"integrity": "sha512-WvsdwYXrvIXNZJflX/2MEQLjKs5TopZWeiyam1zcaFfhwQtL19ENOvGdzVsihGsbsNGdVRU5yiqg2G5p06UAbg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"pg-cursor": "^2.12.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"pg": "^8"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-types": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
|
||||
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
|
||||
"dependencies": {
|
||||
"pg-int8": "1.0.1",
|
||||
"postgres-array": "~2.0.0",
|
||||
"postgres-bytea": "~1.0.0",
|
||||
"postgres-date": "~1.0.4",
|
||||
"postgres-interval": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/pgpass": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
|
||||
"integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
|
||||
"dependencies": {
|
||||
"split2": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-array": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
||||
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-bytea": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
|
||||
"integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-date": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
|
||||
"integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-interval": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
|
||||
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
|
||||
"dependencies": {
|
||||
"xtend": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/spex": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/spex/-/spex-3.4.0.tgz",
|
||||
"integrity": "sha512-8JeZJ7QlEBnSj1W1fKXgbB2KUPA8k4BxFMf6lZX/c1ZagU/1b9uZWZK0yD6yjfzqAIuTNG4YlRmtMpQiXuohsg==",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/split2": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
|
||||
"integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
|
||||
"engines": {
|
||||
"node": ">= 10.x"
|
||||
}
|
||||
},
|
||||
"node_modules/xtend": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
|
||||
"engines": {
|
||||
"node": ">=0.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,6 +2,6 @@
|
||||
"name": "nodejs-persistent",
|
||||
"dependencies": {
|
||||
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview",
|
||||
"pg-promise": "^11.11.0"
|
||||
"sqlite3": "^5.1.7"
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,11 @@
|
||||
const Postgres = require("flexsearch/db/postgres");
|
||||
const Sqlite = require("flexsearch/db/sqlite");
|
||||
// const Postgres = require("flexsearch/db/postgres");
|
||||
// const MongoDB = require("flexsearch/db/mongodb");
|
||||
// const Redis = require("flexsearch/db/redis");
|
||||
// const Clickhouse = require("flexsearch/db/clickhouse");
|
||||
|
||||
module.exports = {
|
||||
db: new Postgres("my-store", {
|
||||
db: new Sqlite("my-store", {
|
||||
field: "genres"
|
||||
})
|
||||
};
|
@@ -1,10 +1,14 @@
|
||||
const Postgres = require("flexsearch/db/postgres");
|
||||
const Sqlite = require("flexsearch/db/sqlite");
|
||||
// const Postgres = require("flexsearch/db/postgres");
|
||||
// const MongoDB = require("flexsearch/db/mongodb");
|
||||
// const Redis = require("flexsearch/db/redis");
|
||||
// const Clickhouse = require("flexsearch/db/clickhouse");
|
||||
const { Charset } = require("flexsearch");
|
||||
|
||||
module.exports = {
|
||||
tokenize: "forward",
|
||||
encoder: Charset.LatinSimple,
|
||||
db: new Postgres("my-store", {
|
||||
db: new Sqlite("my-store", {
|
||||
field: "originalTitle"
|
||||
})
|
||||
};
|
@@ -1,10 +1,14 @@
|
||||
const Postgres = require("flexsearch/db/postgres");
|
||||
const Sqlite = require("flexsearch/db/sqlite");
|
||||
// const Postgres = require("flexsearch/db/postgres");
|
||||
// const MongoDB = require("flexsearch/db/mongodb");
|
||||
// const Redis = require("flexsearch/db/redis");
|
||||
// const Clickhouse = require("flexsearch/db/clickhouse");
|
||||
const { Charset } = require("flexsearch");
|
||||
|
||||
module.exports = {
|
||||
tokenize: "forward",
|
||||
encoder: Charset.LatinSimple,
|
||||
db: new Postgres("my-store", {
|
||||
db: new Sqlite("my-store", {
|
||||
field: "primaryTitle"
|
||||
})
|
||||
};
|
@@ -1,7 +1,11 @@
|
||||
const Postgres = require("flexsearch/db/postgres");
|
||||
const Sqlite = require("flexsearch/db/sqlite");
|
||||
// const Postgres = require("flexsearch/db/postgres");
|
||||
// const MongoDB = require("flexsearch/db/mongodb");
|
||||
// const Redis = require("flexsearch/db/redis");
|
||||
// const Clickhouse = require("flexsearch/db/clickhouse");
|
||||
|
||||
module.exports = {
|
||||
db: new Postgres("my-store", {
|
||||
db: new Sqlite("my-store", {
|
||||
field: "startYear"
|
||||
})
|
||||
};
|
@@ -1,14 +1,17 @@
|
||||
const { Document } = require("flexsearch");
|
||||
const Postgres = require("flexsearch/db/postgres");
|
||||
const fs = require("fs");
|
||||
const Sqlite = require("flexsearch/db/sqlite");
|
||||
// const Postgres = require("flexsearch/db/postgres");
|
||||
// const MongoDB = require("flexsearch/db/mongodb");
|
||||
// const Redis = require("flexsearch/db/redis");
|
||||
// const Clickhouse = require("flexsearch/db/clickhouse");
|
||||
|
||||
// loading test data
|
||||
const data = JSON.parse(fs.readFileSync(__dirname + "/../data.json", "utf8"));
|
||||
const data = require(__dirname + "/../data.json");
|
||||
|
||||
(async function(){
|
||||
|
||||
// create DB instance with namespace
|
||||
const db = new Postgres("my-store");
|
||||
const db = new Sqlite("my-store");
|
||||
|
||||
// create the document index
|
||||
const document = new Document({
|
||||
@@ -18,9 +21,11 @@ const data = JSON.parse(fs.readFileSync(__dirname + "/../data.json", "utf8"));
|
||||
store: true,
|
||||
index: [{
|
||||
field: "primaryTitle",
|
||||
tokenize: "forward",
|
||||
config: __dirname + "/config.primaryTitle.js"
|
||||
},{
|
||||
field: "originalTitle",
|
||||
tokenize: "forward",
|
||||
config: __dirname + "/config.originalTitle.js"
|
||||
}],
|
||||
tag: [{
|
||||
|
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
@@ -1,7 +1,11 @@
|
||||
import Postgres from "flexsearch/db/postgres";
|
||||
import Sqlite from "flexsearch/db/sqlite";
|
||||
// import Postgres from "flexsearch/db/postgres";
|
||||
// import MongoDB from "flexsearch/db/mongodb";
|
||||
// import Redis from "flexsearch/db/redis";
|
||||
// import Clickhouse from "flexsearch/db/clickhouse";
|
||||
|
||||
export default {
|
||||
db: new Postgres("my-store", {
|
||||
db: new Sqlite("my-store", {
|
||||
field: "genres"
|
||||
})
|
||||
};
|
@@ -1,10 +1,14 @@
|
||||
import Postgres from "flexsearch/esm/db/postgres";
|
||||
import Sqlite from "flexsearch/db/sqlite";
|
||||
// import Postgres from "flexsearch/db/postgres";
|
||||
// import MongoDB from "flexsearch/db/mongodb";
|
||||
// import Redis from "flexsearch/db/redis";
|
||||
// import Clickhouse from "flexsearch/db/clickhouse";
|
||||
import { Charset } from "flexsearch/esm";
|
||||
|
||||
export default {
|
||||
tokenize: "forward",
|
||||
encoder: Charset.LatinSimple,
|
||||
db: new Postgres("my-store", {
|
||||
db: new Sqlite("my-store", {
|
||||
field: "originalTitle"
|
||||
})
|
||||
};
|
@@ -1,10 +1,14 @@
|
||||
import Postgres from "flexsearch/esm/db/postgres";
|
||||
import Sqlite from "flexsearch/db/sqlite";
|
||||
// import Postgres from "flexsearch/db/postgres";
|
||||
// import MongoDB from "flexsearch/db/mongodb";
|
||||
// import Redis from "flexsearch/db/redis";
|
||||
// import Clickhouse from "flexsearch/db/clickhouse";
|
||||
import { Charset } from "flexsearch/esm";
|
||||
|
||||
export default {
|
||||
tokenize: "forward",
|
||||
encoder: Charset.LatinSimple,
|
||||
db: new Postgres("my-store", {
|
||||
db: new Sqlite("my-store", {
|
||||
field: "primaryTitle"
|
||||
})
|
||||
};
|
@@ -1,7 +1,11 @@
|
||||
import Postgres from "flexsearch/db/postgres";
|
||||
import Sqlite from "flexsearch/db/sqlite";
|
||||
// import Postgres from "flexsearch/db/postgres";
|
||||
// import MongoDB from "flexsearch/db/mongodb";
|
||||
// import Redis from "flexsearch/db/redis";
|
||||
// import Clickhouse from "flexsearch/db/clickhouse";
|
||||
|
||||
export default {
|
||||
db: new Postgres("my-store", {
|
||||
db: new Sqlite("my-store", {
|
||||
field: "startYear"
|
||||
})
|
||||
};
|
@@ -1,5 +1,9 @@
|
||||
import { Document } from "flexsearch/esm";
|
||||
import Postgres from "flexsearch/esm/db/postgres";
|
||||
import Sqlite from "flexsearch/esm/db/sqlite";
|
||||
// import Postgres from "flexsearch/db/postgres";
|
||||
// import MongoDB from "flexsearch/db/mongodb";
|
||||
// import Redis from "flexsearch/db/redis";
|
||||
// import Clickhouse from "flexsearch/db/clickhouse";
|
||||
import fs from "fs";
|
||||
|
||||
const dirname = import.meta.dirname;
|
||||
@@ -9,7 +13,7 @@ const data = JSON.parse(fs.readFileSync(dirname + "/../data.json", "utf8"));
|
||||
(async function(){
|
||||
|
||||
// create DB instance with namespace
|
||||
const db = new Postgres("my-store");
|
||||
const db = new Sqlite("my-store");
|
||||
|
||||
// create the document index
|
||||
const document = new Document({
|
||||
@@ -19,9 +23,11 @@ const data = JSON.parse(fs.readFileSync(dirname + "/../data.json", "utf8"));
|
||||
store: true,
|
||||
index: [{
|
||||
field: "primaryTitle",
|
||||
tokenize: "forward",
|
||||
config: dirname + "/config.primaryTitle.js"
|
||||
},{
|
||||
field: "originalTitle",
|
||||
tokenize: "forward",
|
||||
config: dirname + "/config.originalTitle.js"
|
||||
}],
|
||||
tag: [{
|
||||
|
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
240
example/nodejs-worker-persistent/package-lock.json
generated
240
example/nodejs-worker-persistent/package-lock.json
generated
@@ -1,240 +0,0 @@
|
||||
{
|
||||
"name": "nodejs-worker-persistent",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "nodejs-worker-persistent",
|
||||
"dependencies": {
|
||||
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview",
|
||||
"pg-promise": "^11.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/assert-options": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/assert-options/-/assert-options-0.8.2.tgz",
|
||||
"integrity": "sha512-XaXoMxY0zuwAb0YuZjxIm8FeWvNq0aWNIbrzHhFjme8Smxw4JlPoyrAKQ6808k5UvQdhvnWqHZCphq5mXd4TDA==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/flexsearch": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "git+ssh://git@github.com/nextapps-de/flexsearch.git#a253897675cdb1361554abdc7f57305a6d52de25",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/pg": {
|
||||
"version": "8.14.0",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-8.14.0.tgz",
|
||||
"integrity": "sha512-nXbVpyoaXVmdqlKEzToFf37qzyeeh7mbiXsnoWvstSqohj88yaa/I/Rq/HEVn2QPSZEuLIJa/jSpRDyzjEx4FQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"pg-connection-string": "^2.7.0",
|
||||
"pg-pool": "^3.8.0",
|
||||
"pg-protocol": "^1.8.0",
|
||||
"pg-types": "^2.1.0",
|
||||
"pgpass": "1.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"pg-cloudflare": "^1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"pg-native": ">=3.0.1"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"pg-native": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/pg-cloudflare": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz",
|
||||
"integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/pg-connection-string": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.7.0.tgz",
|
||||
"integrity": "sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA=="
|
||||
},
|
||||
"node_modules/pg-cursor": {
|
||||
"version": "2.13.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-cursor/-/pg-cursor-2.13.0.tgz",
|
||||
"integrity": "sha512-13jHi54EawM9aQhmf0+xRtvaL/g4kBjnx/tEXWAIPNKm4bxUofPfc5navrgt47z85AsxUDx4f40IzF1y9tUyeA==",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"pg": "^8"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-int8": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
|
||||
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-minify": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-minify/-/pg-minify-1.7.0.tgz",
|
||||
"integrity": "sha512-kFPxAWAhPMvOqnY7klP3scdU5R7bxpAYOm8vGExuIkcSIwuFkZYl4C4XIPQ8DtXY2NzVmAX1aFHpvFSXQ/qQmA==",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-pool": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.8.0.tgz",
|
||||
"integrity": "sha512-VBw3jiVm6ZOdLBTIcXLNdSotb6Iy3uOCwDGFAksZCXmi10nyRvnP2v3jl4d+IsLYRyXf6o9hIm/ZtUzlByNUdw==",
|
||||
"peerDependencies": {
|
||||
"pg": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-promise": {
|
||||
"version": "11.11.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-11.11.0.tgz",
|
||||
"integrity": "sha512-nqtNHp9dvE1aMug2spLJBy6AazT9arorTlRqreHXu50pCArwQDpbu/R0tDUcyNYY4XP5HczwknkUzYi+ivyozQ==",
|
||||
"dependencies": {
|
||||
"assert-options": "0.8.2",
|
||||
"pg": "8.13.3",
|
||||
"pg-minify": "1.7.0",
|
||||
"spex": "3.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"pg-query-stream": "4.7.3"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-promise/node_modules/pg": {
|
||||
"version": "8.13.3",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-8.13.3.tgz",
|
||||
"integrity": "sha512-P6tPt9jXbL9HVu/SSRERNYaYG++MjnscnegFh9pPHihfoBSujsrka0hyuymMzeJKFWrcG8wvCKy8rCe8e5nDUQ==",
|
||||
"dependencies": {
|
||||
"pg-connection-string": "^2.7.0",
|
||||
"pg-pool": "^3.7.1",
|
||||
"pg-protocol": "^1.7.1",
|
||||
"pg-types": "^2.1.0",
|
||||
"pgpass": "1.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"pg-cloudflare": "^1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"pg-native": ">=3.0.1"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"pg-native": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/pg-protocol": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.8.0.tgz",
|
||||
"integrity": "sha512-jvuYlEkL03NRvOoyoRktBK7+qU5kOvlAwvmrH8sr3wbLrOdVWsRxQfz8mMy9sZFsqJ1hEWNfdWKI4SAmoL+j7g=="
|
||||
},
|
||||
"node_modules/pg-query-stream": {
|
||||
"version": "4.7.3",
|
||||
"resolved": "https://registry.npmjs.org/pg-query-stream/-/pg-query-stream-4.7.3.tgz",
|
||||
"integrity": "sha512-WvsdwYXrvIXNZJflX/2MEQLjKs5TopZWeiyam1zcaFfhwQtL19ENOvGdzVsihGsbsNGdVRU5yiqg2G5p06UAbg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"pg-cursor": "^2.12.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"pg": "^8"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-types": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
|
||||
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
|
||||
"dependencies": {
|
||||
"pg-int8": "1.0.1",
|
||||
"postgres-array": "~2.0.0",
|
||||
"postgres-bytea": "~1.0.0",
|
||||
"postgres-date": "~1.0.4",
|
||||
"postgres-interval": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/pgpass": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
|
||||
"integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
|
||||
"dependencies": {
|
||||
"split2": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-array": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
||||
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-bytea": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
|
||||
"integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-date": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
|
||||
"integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-interval": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
|
||||
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
|
||||
"dependencies": {
|
||||
"xtend": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/spex": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/spex/-/spex-3.4.0.tgz",
|
||||
"integrity": "sha512-8JeZJ7QlEBnSj1W1fKXgbB2KUPA8k4BxFMf6lZX/c1ZagU/1b9uZWZK0yD6yjfzqAIuTNG4YlRmtMpQiXuohsg==",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/split2": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
|
||||
"integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
|
||||
"engines": {
|
||||
"node": ">= 10.x"
|
||||
}
|
||||
},
|
||||
"node_modules/xtend": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
|
||||
"engines": {
|
||||
"node": ">=0.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,6 +2,6 @@
|
||||
"name": "nodejs-worker-persistent",
|
||||
"dependencies": {
|
||||
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview",
|
||||
"pg-promise": "^11.11.0"
|
||||
"sqlite3": "^5.1.7"
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,7 @@
|
||||
const { Document } = require("flexsearch");
|
||||
const fs = require("fs");
|
||||
|
||||
// loading test data
|
||||
const data = JSON.parse(fs.readFileSync(__dirname + "/../data.json", "utf8"));
|
||||
const data = require(__dirname + "/../data.json");
|
||||
|
||||
(async function(){
|
||||
|
||||
@@ -14,9 +13,11 @@ const data = JSON.parse(fs.readFileSync(__dirname + "/../data.json", "utf8"));
|
||||
store: true,
|
||||
index: [{
|
||||
field: "primaryTitle",
|
||||
tokenize: "forward",
|
||||
config: __dirname + "/config.primaryTitle.js"
|
||||
},{
|
||||
field: "originalTitle",
|
||||
tokenize: "forward",
|
||||
config: __dirname + "/config.originalTitle.js"
|
||||
}],
|
||||
tag: [{
|
||||
|
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
@@ -15,9 +15,11 @@ const data = JSON.parse(fs.readFileSync(dirname + "/../data.json", "utf8"));
|
||||
store: true,
|
||||
index: [{
|
||||
field: "primaryTitle",
|
||||
tokenize: "forward",
|
||||
config: dirname + "/config.primaryTitle.js"
|
||||
},{
|
||||
field: "originalTitle",
|
||||
tokenize: "forward",
|
||||
config: dirname + "/config.originalTitle.js"
|
||||
}],
|
||||
tag: [{
|
||||
|
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
18
example/nodejs-worker/package-lock.json
generated
18
example/nodejs-worker/package-lock.json
generated
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "nodejs-worker-persistent",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "nodejs-worker-persistent",
|
||||
"dependencies": {
|
||||
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"
|
||||
}
|
||||
},
|
||||
"node_modules/flexsearch": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "git+ssh://git@github.com/nextapps-de/flexsearch.git#a253897675cdb1361554abdc7f57305a6d52de25",
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user