Compare commits

..

8 Commits

Author SHA1 Message Date
75f99025d9 add exif dateTime, allow some special characters in text meta 2020-02-09 08:47:13 -05:00
ebe852bd5a Fix rewrite-url arg 2020-02-09 08:23:17 -05:00
402b103c49 Fix total count for ES 7.5 2020-02-08 09:25:00 -05:00
e9b6e1cdc2 Turn off auto optimisation in libtesseract build 2020-02-08 08:32:04 -05:00
ed1ce8ab5e Handle XML errors #18 2020-02-07 10:08:01 -05:00
d1fa4febc4 Improve scroll feature, UI fix 2020-02-07 10:08:01 -05:00
048c55df7b Update README.md 2020-02-06 19:56:29 -05:00
f77bc6a025 Update README.md 2020-02-06 19:55:32 -05:00
18 changed files with 151 additions and 130 deletions

View File

@@ -95,7 +95,7 @@ File type | Library | Content | Thumbnail | Metadata
pdf,xps,cbz,fb2,epub | MuPDF | text+ocr | yes, `png` | title | pdf,xps,cbz,fb2,epub | MuPDF | text+ocr | yes, `png` | title |
`audio/*` | ffmpeg | - | yes, `jpeg` | ID3 tags | `audio/*` | ffmpeg | - | yes, `jpeg` | ID3 tags |
`video/*` | ffmpeg | - | yes, `jpeg` | title, comment, artist | `video/*` | ffmpeg | - | yes, `jpeg` | title, comment, artist |
`image/*` | ffmpeg | - | yes, `jpeg` | `EXIF:Artist`, `EXIF:ImageDescription` | `image/*` | ffmpeg | - | yes, `jpeg` | [Common EXIF tags](https://github.com/simon987/sist2/blob/efdde2734eca9b14a54f84568863b7ffd59bdba3/src/parsing/media.c#L190) |
ttf,ttc,cff,woff,fnt,otf | Freetype2 | - | yes, `bmp` | Name & style | ttf,ttc,cff,woff,fnt,otf | Freetype2 | - | yes, `bmp` | Name & style |
`text/plain` | *(none)* | yes | no | - | `text/plain` | *(none)* | yes | no | - |
tar, zip, rar, 7z, ar ... | Libarchive | yes\* | - | no | tar, zip, rar, 7z, ar ... | Libarchive | yes\* | - | no |

View File

@@ -1,5 +1,9 @@
{ {
"properties": { "properties": {
"_tie": {
"type": "keyword",
"doc_values": true
},
"path": { "path": {
"type": "text", "type": "text",
"analyzer": "path_analyzer", "analyzer": "path_analyzer",
@@ -105,6 +109,30 @@
}, },
"tag": { "tag": {
"type": "keyword" "type": "keyword"
},
"exif_make": {
"type": "text"
},
"exif_model": {
"type": "text"
},
"exif:software": {
"type": "text"
},
"exif_exposure_time": {
"type": "keyword"
},
"exif_fnumber": {
"type": "keyword"
},
"exif_iso_speed_ratings": {
"type": "keyword"
},
"exif_focal_length": {
"type": "keyword"
},
"exif_user_comment": {
"type": "text"
} }
} }
} }

10
schema/pipeline.json Normal file
View File

@@ -0,0 +1,10 @@
{
"description": "Copy _id to _tie",
"processors": [
{
"script": {
"source": "ctx._tie = ctx._id;"
}
}
]
}

View File

@@ -75,7 +75,7 @@ cd tesseract
mkdir build mkdir build
cd build cd build
cmake -DSTATIC=on -DBUILD_TRAINING_TOOLS=off -DBUILD_TESTS=off -DCMAKE_BUILD_TYPE=Release \ cmake -DSTATIC=on -DBUILD_TRAINING_TOOLS=off -DBUILD_TESTS=off -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-fPIC" .. -DCMAKE_CXX_FLAGS="-fPIC" -DAUTO_OPTIMIZE=off ..
make -j $THREADS make -j $THREADS
cd ../.. cd ../..
mv tesseract/build/libtesseract.a . mv tesseract/build/libtesseract.a .

View File

@@ -1,6 +1,9 @@
import json
files = [ files = [
"schema/mappings.json", "schema/mappings.json",
"schema/settings.json", "schema/settings.json",
"schema/pipeline.json",
] ]
@@ -9,6 +12,6 @@ def clean(filepath):
for file in files: for file in files:
with open(file, "rb") as f: with open(file, "r") as f:
data = f.read() data = json.dumps(json.load(f), separators=(",", ":")).encode()
print("char %s[%d] = {%s};" % (clean(file), len(data), ",".join(str(int(b)) for b in data))) print("char %s[%d] = {%s};" % (clean(file), len(data), ",".join(str(int(b)) for b in data)))

View File

@@ -129,7 +129,7 @@ void elastic_flush() {
Indexer->queued = 0; Indexer->queued = 0;
char bulk_url[4096]; char bulk_url[4096];
snprintf(bulk_url, 4096, "%s/sist2/_bulk", Indexer->es_url); snprintf(bulk_url, 4096, "%s/sist2/_bulk?pipeline=tie", Indexer->es_url);
response_t *r = web_post(bulk_url, buf, "Content-Type: application/x-ndjson"); response_t *r = web_post(bulk_url, buf, "Content-Type: application/x-ndjson");
if (r->status_code == 0) { if (r->status_code == 0) {
@@ -245,6 +245,11 @@ void elastic_init(int force_reset) {
LOG_INFOF("elastic.c", "Close index <%d>", r->status_code); LOG_INFOF("elastic.c", "Close index <%d>", r->status_code);
free_response(r); free_response(r);
snprintf(url, 4096, "%s/_ingest/pipeline/tie", IndexCtx.es_url);
r = web_put(url, pipeline_json, "Content-Type: application/json");
LOG_INFOF("elastic.c", "Create pipeline <%d>", r->status_code);
free_response(r);
snprintf(url, 4096, "%s/sist2/_settings", IndexCtx.es_url); snprintf(url, 4096, "%s/sist2/_settings", IndexCtx.es_url);
r = web_put(url, settings_json, "Content-Type: application/json"); r = web_put(url, settings_json, "Content-Type: application/json");
LOG_INFOF("elastic.c", "Update settings <%d>", r->status_code); LOG_INFOF("elastic.c", "Update settings <%d>", r->status_code);

File diff suppressed because one or more lines are too long

View File

@@ -134,6 +134,8 @@ char *get_meta_key_text(enum metakey meta_key) {
return "exif_iso_speed_ratings"; return "exif_iso_speed_ratings";
case MetaExifModel: case MetaExifModel:
return "exif_model"; return "exif_model";
case MetaExifDateTime:
return "exif_datetime";
default: default:
return NULL; return NULL;
} }
@@ -278,6 +280,7 @@ void read_index_bin(const char *path, const char *index_id, index_func func) {
case MetaExifFocalLength: case MetaExifFocalLength:
case MetaExifUserComment: case MetaExifUserComment:
case MetaExifIsoSpeedRatings: case MetaExifIsoSpeedRatings:
case MetaExifDateTime:
case MetaExifModel: case MetaExifModel:
case MetaTitle: { case MetaTitle: {
buf.cur = 0; buf.cur = 0;

View File

@@ -6,7 +6,7 @@
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0" #define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
static const char *const Version = "1.2.5"; static const char *const Version = "1.2.9";
static const char *const usage[] = { static const char *const usage[] = {
"sist2 scan [OPTION]... PATH", "sist2 scan [OPTION]... PATH",
"sist2 index [OPTION]... INDEX", "sist2 index [OPTION]... INDEX",
@@ -49,6 +49,7 @@ void sist2_scan(scan_args_t *args) {
strncpy(ScanCtx.index.path, args->output, sizeof(ScanCtx.index.path)); strncpy(ScanCtx.index.path, args->output, sizeof(ScanCtx.index.path));
strncpy(ScanCtx.index.desc.name, args->name, sizeof(ScanCtx.index.desc.name)); strncpy(ScanCtx.index.desc.name, args->name, sizeof(ScanCtx.index.desc.name));
strncpy(ScanCtx.index.desc.root, args->path, sizeof(ScanCtx.index.desc.root)); strncpy(ScanCtx.index.desc.root, args->path, sizeof(ScanCtx.index.desc.root));
strncpy(ScanCtx.index.desc.rewrite_url, args->rewrite_url, sizeof(ScanCtx.index.desc.rewrite_url));
ScanCtx.index.desc.root_len = (short) strlen(ScanCtx.index.desc.root); ScanCtx.index.desc.root_len = (short) strlen(ScanCtx.index.desc.root);
ScanCtx.tesseract_lang = args->tesseract_lang; ScanCtx.tesseract_lang = args->tesseract_lang;
ScanCtx.tesseract_path = args->tesseract_path; ScanCtx.tesseract_path = args->tesseract_path;

View File

@@ -1,10 +1,20 @@
#include "doc.h" #include "doc.h"
#include "src/ctx.h" #include "src/ctx.h"
void dump_text(mceTextReader_t *reader, dyn_buffer_t *buf) { int dump_text(mceTextReader_t *reader, dyn_buffer_t *buf) {
mce_skip_attributes(reader); mce_skip_attributes(reader);
xmlErrorPtr err = xmlGetLastError();
if (err != NULL) {
if (err->level == XML_ERR_FATAL) {
LOG_ERRORF("doc.c", "Got fatal XML error while parsing document: %s", err->message)
return -1;
} else {
LOG_ERRORF("doc.c", "Got recoverable XML error while parsing document: %s", err->message)
}
}
mce_start_children(reader) { mce_start_children(reader) {
mce_start_element(reader, NULL, _X("t")) { mce_start_element(reader, NULL, _X("t")) {
mce_skip_attributes(reader); mce_skip_attributes(reader);
@@ -18,10 +28,14 @@ void dump_text(mceTextReader_t *reader, dyn_buffer_t *buf) {
} mce_end_element(reader); } mce_end_element(reader);
mce_start_element(reader, NULL, NULL) { mce_start_element(reader, NULL, NULL) {
dump_text(reader, buf); int ret = dump_text(reader, buf);
if (ret != 0) {
return ret;
}
} mce_end_element(reader); } mce_end_element(reader);
} mce_end_children(reader) } mce_end_children(reader)
return 0;
} }
__always_inline __always_inline
@@ -52,30 +66,28 @@ int should_read_part(opcPart part) {
} }
__always_inline __always_inline
void read_part(opcContainer *c, dyn_buffer_t *buf, opcPart part, document_t *doc) { int read_part(opcContainer *c, dyn_buffer_t *buf, opcPart part, document_t *doc) {
mceTextReader_t reader; mceTextReader_t reader;
int options; int ret = opcXmlReaderOpen(c, &reader, part, NULL, "UTF-8", XML_PARSE_NOWARNING | XML_PARSE_NOERROR | XML_PARSE_NONET);
if (LogCtx.very_verbose) {
options = XML_PARSE_NONET;
} else {
options = XML_PARSE_NOWARNING | XML_PARSE_NOERROR | XML_PARSE_NONET;
}
int ret = opcXmlReaderOpen(c, &reader, part, NULL, "UTF-8", options);
if (ret != OPC_ERROR_NONE) { if (ret != OPC_ERROR_NONE) {
LOG_ERRORF(doc->filepath, "(doc.c) opcXmlReaderOpen() returned error code %d", ret); LOG_ERRORF(doc->filepath, "(doc.c) opcXmlReaderOpen() returned error code %d", ret);
return; return -1;
} }
mce_start_document(&reader) { mce_start_document(&reader) {
mce_start_element(&reader, NULL, NULL) { mce_start_element(&reader, NULL, NULL) {
dump_text(&reader, buf); ret = dump_text(&reader, buf);
if (ret != 0) {
mceTextReaderCleanup(&reader);
return -1;
}
} mce_end_element(&reader); } mce_end_element(&reader);
} mce_end_document(&reader); } mce_end_document(&reader);
mceTextReaderCleanup(&reader); mceTextReaderCleanup(&reader);
return 0;
} }
void parse_doc(void *mem, size_t mem_len, document_t *doc) { void parse_doc(void *mem, size_t mem_len, document_t *doc) {
@@ -95,7 +107,10 @@ void parse_doc(void *mem, size_t mem_len, document_t *doc) {
opcPart part = opcPartGetFirst(c); opcPart part = opcPartGetFirst(c);
do { do {
if (should_read_part(part)) { if (should_read_part(part)) {
read_part(c, &buf, part, doc); int ret = read_part(c, &buf, part, doc);
if (ret != 0) {
break;
}
} }
} while ((part = opcPartGetNext(c, part))); } while ((part = opcPartGetNext(c, part)));

View File

@@ -209,6 +209,8 @@ append_video_meta(AVFormatContext *pFormatCtx, AVFrame *frame, document_t *doc,
APPEND_TAG_META(doc, tag, MetaExifIsoSpeedRatings) APPEND_TAG_META(doc, tag, MetaExifIsoSpeedRatings)
} else if (strcmp(tag->key, "ExposureTime") == 0) { } else if (strcmp(tag->key, "ExposureTime") == 0) {
APPEND_TAG_META(doc, tag, MetaExifExposureTime) APPEND_TAG_META(doc, tag, MetaExifExposureTime)
} else if (strcmp(tag->key, "DateTime") == 0) {
APPEND_TAG_META(doc, tag, MetaExifDateTime)
} }
} }
} }

View File

@@ -39,6 +39,7 @@ enum metakey {
MetaExifUserComment = 20 | META_STR_MASK, MetaExifUserComment = 20 | META_STR_MASK,
MetaExifModel = 21 | META_STR_MASK, MetaExifModel = 21 | META_STR_MASK,
MetaExifIsoSpeedRatings = 22 | META_STR_MASK, MetaExifIsoSpeedRatings = 22 | META_STR_MASK,
MetaExifDateTime = 23 | META_STR_MASK,
//Note to self: this will break after 31 entries //Note to self: this will break after 31 entries
}; };

View File

@@ -7,7 +7,7 @@
#define INITIAL_BUF_SIZE 1024 * 16 #define INITIAL_BUF_SIZE 1024 * 16
#define SHOULD_IGNORE_CHAR(c) !(SHOULD_KEEP_CHAR(c)) #define SHOULD_IGNORE_CHAR(c) !(SHOULD_KEEP_CHAR(c))
#define SHOULD_KEEP_CHAR(c) ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'z') || (c > 127)) #define SHOULD_KEEP_CHAR(c) ((c >= '\'' && c <= ';') || (c >= 'A' && c <= 'z') || (c > 127))
typedef struct dyn_buffer { typedef struct dyn_buffer {

View File

@@ -221,14 +221,6 @@ int search(UNUSED(void *p), onion_request *req, onion_response *res) {
return OCS_NOT_PROCESSED; return OCS_NOT_PROCESSED;
} }
char *scroll_param;
const char *scroll = onion_request_get_query(req, "scroll");
if (scroll != NULL) {
scroll_param = "?scroll=3m";
} else {
scroll_param = "";
}
const struct onion_block_t *block = onion_request_get_data(req); const struct onion_block_t *block = onion_request_get_data(req);
if (block == NULL) { if (block == NULL) {
@@ -236,7 +228,7 @@ int search(UNUSED(void *p), onion_request *req, onion_response *res) {
} }
char url[4096]; char url[4096];
snprintf(url, 4096, "%s/sist2/_search%s", WebCtx.es_url, scroll_param); snprintf(url, 4096, "%s/sist2/_search", WebCtx.es_url);
response_t *r = web_post(url, onion_block_data(block), "Content-Type: application/json"); response_t *r = web_post(url, onion_block_data(block), "Content-Type: application/json");
set_default_headers(res); set_default_headers(res);
@@ -254,43 +246,6 @@ int search(UNUSED(void *p), onion_request *req, onion_response *res) {
return OCS_PROCESSED; return OCS_PROCESSED;
} }
int scroll(UNUSED(void *p), onion_request *req, onion_response *res) {
int flags = onion_request_get_flags(req);
if ((flags & OR_METHODS) != OR_GET) {
return OCS_NOT_PROCESSED;
}
char url[4096];
snprintf(url, 4096, "%s/_search/scroll", WebCtx.es_url);
const char *scroll_id = onion_request_get_query(req, "scroll_id");
cJSON *json = cJSON_CreateObject();
cJSON_AddStringToObject(json, "scroll_id", scroll_id);
cJSON_AddStringToObject(json, "scroll", "3m");
char *json_str = cJSON_PrintUnformatted(json);
response_t *r = web_post(url, json_str, "Content-Type: application/json");
cJSON_Delete(json);
cJSON_free(json_str);
if (r->status_code != 200) {
free_response(r);
return OCS_NOT_PROCESSED;
}
set_default_headers(res);
onion_response_set_header(res, "Content-Type", "application/json");
onion_response_set_header(res, "Content-Disposition", "application/json");
onion_response_set_length(res, r->size);
onion_response_write(res, r->body, r->size);
free_response(r);
return OCS_PROCESSED;
}
int serve_file_from_url(cJSON *json, index_t *idx, onion_request *req, onion_response *res) { int serve_file_from_url(cJSON *json, index_t *idx, onion_request *req, onion_response *res) {
const char *path = cJSON_GetObjectItem(json, "path")->valuestring; const char *path = cJSON_GetObjectItem(json, "path")->valuestring;
@@ -466,7 +421,6 @@ void serve(const char *hostname, const char *port) {
onion_url_add(urls, "img/sprite-skin-flat.png", img_sprite_skin_flag); onion_url_add(urls, "img/sprite-skin-flat.png", img_sprite_skin_flag);
onion_url_add(urls, "es", search); onion_url_add(urls, "es", search);
onion_url_add(urls, "scroll", scroll);
onion_url_add(urls, "status", status); onion_url_add(urls, "status", status);
onion_url_add( onion_url_add(
urls, urls,

File diff suppressed because one or more lines are too long

View File

@@ -113,7 +113,7 @@ function getTags(hit, mimeCategory) {
switch (mimeCategory) { switch (mimeCategory) {
case "video": case "video":
case "image": case "image":
if (hit["_source"].hasOwnProperty("videoc")) { if (hit["_source"].hasOwnProperty("videoc") && hit["_source"]["videoc"]) {
const formatTag = document.createElement("span"); const formatTag = document.createElement("span");
formatTag.setAttribute("class", "badge badge-pill badge-video"); formatTag.setAttribute("class", "badge badge-pill badge-video");
formatTag.appendChild(document.createTextNode(hit["_source"]["videoc"].replace(" ", ""))); formatTag.appendChild(document.createTextNode(hit["_source"]["videoc"].replace(" ", "")));
@@ -121,7 +121,7 @@ function getTags(hit, mimeCategory) {
} }
break; break;
case "audio": { case "audio": {
if (hit["_source"].hasOwnProperty("audioc")) { if (hit["_source"].hasOwnProperty("audioc") && hit["_source"]["audioc"]) {
let formatTag = document.createElement("span"); let formatTag = document.createElement("span");
formatTag.setAttribute("class", "badge badge-pill badge-audio"); formatTag.setAttribute("class", "badge badge-pill badge-audio");
formatTag.appendChild(document.createTextNode(hit["_source"]["audioc"])); formatTag.appendChild(document.createTextNode(hit["_source"]["audioc"]));
@@ -499,8 +499,7 @@ function makePreloader() {
function makePageIndicator(searchResult) { function makePageIndicator(searchResult) {
let pageIndicator = document.createElement("div"); let pageIndicator = document.createElement("div");
pageIndicator.setAttribute("class", "page-indicator font-weight-light"); pageIndicator.setAttribute("class", "page-indicator font-weight-light");
const totalHits = searchResult["hits"]["total"].hasOwnProperty("value") const totalHits = searchResult["aggregations"]["total_count"]["value"];
? searchResult["hits"]["total"]["value"] : searchResult["hits"]["total"];
pageIndicator.appendChild(document.createTextNode(docCount + " / " + totalHits)); pageIndicator.appendChild(document.createTextNode(docCount + " / " + totalHits));
return pageIndicator; return pageIndicator;
} }
@@ -547,8 +546,7 @@ function makeStatsCard(searchResult) {
}); });
let stat = document.createElement("span"); let stat = document.createElement("span");
const totalHits = searchResult["hits"]["total"].hasOwnProperty("value") const totalHits = searchResult["aggregations"]["total_count"]["value"];
? searchResult["hits"]["total"]["value"] : searchResult["hits"]["total"];
stat.appendChild(document.createTextNode(totalHits + " results in " + searchResult["took"] + "ms")); stat.appendChild(document.createTextNode(totalHits + " results in " + searchResult["took"] + "ms"));
statsCardBody.appendChild(stat); statsCardBody.appendChild(stat);

View File

@@ -6,7 +6,8 @@ let tagTree;
let searchBar = document.getElementById("searchBar"); let searchBar = document.getElementById("searchBar");
let pathBar = document.getElementById("pathBar"); let pathBar = document.getElementById("pathBar");
let scroll_id = null; let lastDoc = null;
let reachedEnd = false;
let docCount = 0; let docCount = 0;
let coolingDown = false; let coolingDown = false;
let searchBusy = true; let searchBusy = true;
@@ -259,41 +260,18 @@ function insertHits(resultContainer, hits) {
} }
window.addEventListener("scroll", function () { window.addEventListener("scroll", function () {
if (!coolingDown && !searchBusy) { if (!searchBusy) {
let threshold = 400; let threshold = 400;
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - threshold) { if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - threshold) {
coolingDown = true; if (!reachedEnd) {
doScroll(); coolingDown = true;
search(lastDoc);
}
} }
} }
}); });
function doScroll() {
$.get("scroll", {scroll_id: scroll_id})
.then(searchResult => {
let searchResults = document.getElementById("searchResults");
let hits = searchResult["hits"]["hits"];
//Page indicator
let pageIndicator = makePageIndicator(searchResult);
searchResults.appendChild(pageIndicator);
//Result container
let resultContainer = makeResultContainer();
searchResults.appendChild(resultContainer);
insertHits(resultContainer, hits);
if (hits.length === SIZE) {
coolingDown = false;
}
})
.fail(() => {
window.location.reload();
})
}
function getSelectedNodes(tree) { function getSelectedNodes(tree) {
let selectedNodes = []; let selectedNodes = [];
@@ -314,21 +292,25 @@ function getSelectedNodes(tree) {
return selectedNodes return selectedNodes
} }
function search() { function search(after = null) {
lastDoc = null;
if (searchBusy) { if (searchBusy) {
return; return;
} }
searchBusy = true; searchBusy = true;
//Clear old search results
let searchResults = document.getElementById("searchResults"); let searchResults = document.getElementById("searchResults");
while (searchResults.firstChild) { //Clear old search results
searchResults.removeChild(searchResults.firstChild); let preload;
if (!after) {
while (searchResults.firstChild) {
searchResults.removeChild(searchResults.firstChild);
}
preload = makePreloader();
searchResults.appendChild(preload);
} }
const preload = makePreloader();
searchResults.appendChild(preload);
let query = searchBar.value; let query = searchBar.value;
let empty = query === ""; let empty = query === "";
let condition = empty ? "should" : "must"; let condition = empty ? "should" : "must";
@@ -362,9 +344,9 @@ function search() {
filters.push([{terms: {"tag": tags}}]); filters.push([{terms: {"tag": tags}}]);
} }
$.jsonPost("es?scroll=1", { let q = {
"_source": { "_source": {
excludes: ["content"] excludes: ["content", "_tie"]
}, },
query: { query: {
bool: { bool: {
@@ -379,8 +361,9 @@ function search() {
filter: filters filter: filters
} }
}, },
sort: [ "sort": [
"_score" {"_score": {"order": "desc"}},
{"_tie": {"order": "asc"}}
], ],
highlight: { highlight: {
pre_tags: ["<mark>"], pre_tags: ["<mark>"],
@@ -393,24 +376,41 @@ function search() {
font_name: {}, font_name: {},
} }
}, },
aggs: { aggs:
total_size: {"sum": {"field": "size"}} {
}, total_size: {"sum": {"field": "size"}},
total_count: {"value_count": {"field": "size"}}
},
size: SIZE, size: SIZE,
}).then(searchResult => { };
scroll_id = searchResult["_scroll_id"];
preload.remove(); if (after) {
//Search stats q.search_after = [after["_score"], after["_id"]];
searchResults.appendChild(makeStatsCard(searchResult)); }
$.jsonPost("es", q).then(searchResult => {
let hits = searchResult["hits"]["hits"];
if (hits) {
lastDoc = hits[hits.length - 1];
}
if (!after) {
preload.remove();
searchResults.appendChild(makeStatsCard(searchResult));
} else {
let pageIndicator = makePageIndicator(searchResult);
searchResults.appendChild(pageIndicator);
}
//Setup page //Setup page
let resultContainer = makeResultContainer(); let resultContainer = makeResultContainer();
searchResults.appendChild(resultContainer); searchResults.appendChild(resultContainer);
docCount = 0; if (!after) {
insertHits(resultContainer, searchResult["hits"]["hits"]); docCount = 0;
}
reachedEnd = hits.length !== SIZE;
insertHits(resultContainer, hits);
searchBusy = false; searchBusy = false;
}); });
} }

View File

@@ -11,7 +11,7 @@
<nav class="navbar navbar-expand-lg"> <nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="/">sist2</a> <a class="navbar-brand" href="/">sist2</a>
<span class="badge badge-pill version">v1.2.5</span> <span class="badge badge-pill version">v1.2.9</span>
<span class="tagline">Lightning-fast file system indexer and search tool </span> <span class="tagline">Lightning-fast file system indexer and search tool </span>
<a style="margin-left: auto" id="theme" class="btn" title="Toggle theme" href="/">Theme</a> <a style="margin-left: auto" id="theme" class="btn" title="Toggle theme" href="/">Theme</a>
</nav> </nav>