1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-02 10:23:50 +02:00

v0.6.30 Customize Field Storage

This commit is contained in:
Thomas Wilkerling
2019-07-24 02:08:25 +02:00
parent 658d5f48f9
commit 60cbab3f87
10 changed files with 672 additions and 453 deletions

83
test/export_import.html Normal file
View File

@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test: Export / Import</title>
<script src="../flexsearch.js"></script>
</head>
<body>
<script>
var config = {
encode: "icase",
tokenize: "strict",
threshold: 1,
resolution: 3,
depth: 1,
doc: {
id: "id",
field: "title",
store: "body:content"
}
};
var index = new FlexSearch(config);
var docs = [{
id: 1,
title: "Title 2",
body: {content: "foobar"}
},{
id: 0,
title: "Title 1",
body: {content: "foo"}
},{
id: 2,
title: "Title 3",
body: {content: "bar"}
}];
index.add(docs);
console.log(index.search("title"));
var idx = index.export({
doc: false,
index: true,
serialize: false
});
var doc = index.export({
doc: true,
index: false,
serialize: false
});
index = new FlexSearch(config);
index.import(idx, {
doc: false,
index: true,
serialize: false
});
index.import(doc, {
doc: true,
index: false,
serialize: false
});
console.log(index.search("title"));
index = new FlexSearch(config);
index.import(idx, {
doc: docs,
index: true,
serialize: false
});
console.log(index.search("title"));
</script>
</body>
</html>