mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-22 12:01:15 -04:00
Modify the ZIM backend, so that findTitlesWithPrefix only returns articles.
And not other types of contents (javascript etc). Fixes #151
This commit is contained in:
parent
21ce7b14d3
commit
fb21691f5e
@ -119,7 +119,7 @@ define(['zimfile', 'zimDirEntry', 'util', 'utf8'],
|
||||
var that = this;
|
||||
util.binarySearch(0, this._file.articleCount, function(i) {
|
||||
return that._file.dirEntryByTitleIndex(i).then(function(dirEntry) {
|
||||
if (dirEntry.title == "")
|
||||
if (dirEntry.title === "")
|
||||
return -1; // ZIM sorts empty titles (assets) to the end
|
||||
else if (dirEntry.namespace < "A")
|
||||
return 1;
|
||||
@ -133,7 +133,7 @@ define(['zimfile', 'zimDirEntry', 'util', 'utf8'],
|
||||
if (index >= firstIndex + resultSize || index >= that._file.articleCount)
|
||||
return titles;
|
||||
return that._file.dirEntryByTitleIndex(index).then(function(dirEntry) {
|
||||
if (dirEntry.title.slice(0, prefix.length) == prefix)
|
||||
if (dirEntry.title.slice(0, prefix.length) === prefix && dirEntry.namespace === "A")
|
||||
titles.push(that._dirEntryToTitleObject(dirEntry));
|
||||
return addTitles(index + 1);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user