app.error="ipfsearch is currently being served from a HTTPS host that is not an IPFS node. This prevents it from using a local IPFS gateway. The node operator should fix this and run an ipfs gateway.";
app.error="Loading of the index requires access to the IPFS network. We have found no running IPFS daemon on localhost. Please install IPFS from <a href='http://ipfs.io/docs/install'>ipfs.io</a> and refresh this page.";
thrownewError("Couldn't get a IPFS gateway.");
}
@ -198,11 +181,11 @@ async function checkIfIpfsGateway(gatewayURL) {
@ -345,8 +326,7 @@ function filterCandidates(candidates, tokensInQuery) {
}
candidates=undefined;
returnfilteredCandidates;
}
else{
}else{
returncandidates;
}
}
@ -366,8 +346,7 @@ function getAllCandidates(query, index) {
for(letjinresult){
if(candidates.has(result[j])){
candidates.set(result[j],candidates.get(result[j])+1);//if candidate already in set, increment the counter of how many times it appeared in the index for the query
}
else{
}else{
candidates.set(result[j],1);
}
}
@ -383,46 +362,48 @@ function getAllCandidates(query, index) {
// see also http://www.tartarus.org/~martin/PorterStemmer
// Release 1 be 'andargor', Jul 2004
// Release 2 (substantially revised) by Christopher McKenzie, Aug 2009
varstemmer=(function(){
varstemmer=(function(){
varstep2list={
"ational":"ate",
"tional":"tion",
"enci":"ence",
"anci":"ance",
"izer":"ize",
"bli":"ble",
"alli":"al",
"entli":"ent",
"eli":"e",
"ousli":"ous",
"ization":"ize",
"ation":"ate",
"ator":"ate",
"alism":"al",
"iveness":"ive",
"fulness":"ful",
"ousness":"ous",
"aliti":"al",
"iviti":"ive",
"biliti":"ble",
"logi":"log"
},step3list={
"icate":"ic",
"ative":"",
"alize":"al",
"iciti":"ic",
"ical":"ic",
"ful":"",
"ness":""
},c="[^aeiou]",// consonant
v="[aeiouy]",// vowel
C=c+"[^aeiouy]*",// consonant sequence
V=v+"[aeiou]*",// vowel sequence
mgr0="^("+C+")?"+V+C,// [C]VC... is m>0
meq1="^("+C+")?"+V+C+"("+V+")?$",// [C]VC[V] is m=1
mgr1="^("+C+")?"+V+C+V+C,// [C]VCVC... is m>1
s_v="^("+C+")?"+v;// vowel in stem
returnfunction(w){
"ational":"ate",
"tional":"tion",
"enci":"ence",
"anci":"ance",
"izer":"ize",
"bli":"ble",
"alli":"al",
"entli":"ent",
"eli":"e",
"ousli":"ous",
"ization":"ize",
"ation":"ate",
"ator":"ate",
"alism":"al",
"iveness":"ive",
"fulness":"ful",
"ousness":"ous",
"aliti":"al",
"iviti":"ive",
"biliti":"ble",
"logi":"log"
},
step3list={
"icate":"ic",
"ative":"",
"alize":"al",
"iciti":"ic",
"ical":"ic",
"ful":"",
"ness":""
},
c="[^aeiou]",// consonant
v="[aeiouy]",// vowel
C=c+"[^aeiouy]*",// consonant sequence
V=v+"[aeiou]*",// vowel sequence
mgr0="^("+C+")?"+V+C,// [C]VC... is m>0
meq1="^("+C+")?"+V+C+"("+V+")?$",// [C]VC[V] is m=1
mgr1="^("+C+")?"+V+C+V+C,// [C]VCVC... is m>1
s_v="^("+C+")?"+v;// vowel in stem
returnfunction(w){
varstem,suffix,firstch,re,re2,re3,re4,origword=w;
if(w.length<3){
returnw;
@ -436,8 +417,7 @@ var stemmer = (function () {
re2=/^(.+?)([^s])s$/;
if(re.test(w)){
w=w.replace(re,"$1$2");
}
elseif(re2.test(w)){
}elseif(re2.test(w)){
w=w.replace(re2,"$1$2");
}
// Step 1b
@ -450,8 +430,7 @@ var stemmer = (function () {
re=/.$/;
w=w.replace(re,"");
}
}
elseif(re2.test(w)){
}elseif(re2.test(w)){
varfp=re2.exec(w);
stem=fp[1];
re2=newRegExp(s_v);
@ -462,12 +441,10 @@ var stemmer = (function () {
re4=newRegExp("^"+C+v+"[^aeiouwxy]$");
if(re2.test(w)){
w=w+"e";
}
elseif(re3.test(w)){
}elseif(re3.test(w)){
re=/.$/;
w=w.replace(re,"");
}
elseif(re4.test(w)){
}elseif(re4.test(w)){
w=w+"e";
}
}
@ -514,8 +491,7 @@ var stemmer = (function () {
if(re.test(stem)){
w=stem;
}
}
elseif(re2.test(w)){
}elseif(re2.test(w)){
varfp=re2.exec(w);
stem=fp[1]+fp[2];
re2=newRegExp(mgr1);
@ -566,8 +542,7 @@ async function loadIndexFromURL(url) {
letresponsetext;
if(response.ok){
responsetext=awaitresponse.text();
}
else{
}else{
thrownewError(response.statusText);
}
letparsedResponse=JSON.parse(responsetext);
@ -579,8 +554,7 @@ async function loadIndexFromURL(url) {
for(letpropertyofObject.keys(object)){
if(property==="id"){
id=object[property];
}
else{
}else{
document[property]=object[property];
}
}
@ -606,8 +580,7 @@ function loadInvertedIndexFromURL(url) {
if(lineNumber===0){
if(parseInt(line)!=1&&parseInt(line)!=2){
throw"Error while parsing invinx: Invalid version, must be 1 or 2!";
}
else{
}else{
version=parseInt(line);
}
lineNumber++;
@ -617,7 +590,7 @@ function loadInvertedIndexFromURL(url) {