代碼使用elasticlunr我建立了一個指標如下:爲什麼Elasticlunr版本0.9.5不使用Safari 10.3.3工作(14F89)使用以下
elasticlunr.clearStopWords();
elasticlunr.tokenizer.seperator = /[\s\-\/@]+/;
function indexStops(document) {
var index = elasticlunr();
index.pipeline.remove(elasticlunr.stemmer);
index.setRef('stop_id');
index.addField('stop_code');
index.addField('stop_name');
index.addField('stop_desc');
index.saveDocument(false);
var i = 0;
for (var doc in document) {
index.addDoc(document[doc]);
i++;
}
return index;
}
我再使用它,如下所示:
var results = index.search(searchText, {
bool: "AND",
expand: true
});
在Safari以外的任何現代瀏覽器上都可以使用。在Safari IOS 8.4.1和9.3.5上有效。在Safari 10.3.3和現代版本的MAC OS X上,它不起作用。它返回搜索文本的偶然值的結果,但大多數不返回任何內容。兩個問題
這個代碼片段中是否有任何非標準的內容,並影響對現代版本Safari的搜索?
是否存在elasticlunr和某些瀏覽器版本的已知問題?
一般來說,我不能訪問蘋果平臺上的JavaScript調試工具。然而,有一次我做的結果時,沒有匹配並且應該已經可以在調試器中看到的形式爲:
results: [{ref: "0", score Nan}, {ref: "1", score Nan},{ref: "2", score Nan} .....etc... ]