build/couchdb/linky/_design-lucene-curl.json
{
"_id": "_design/lucene",
"indexes": {
"by_all": {
"analyzer": "standard",
"index": "function (doc) {\n if(doc.type === \"link\") {\n \n var allLong = \"\";\n \n if (doc.linkUrl) {\n var linkUrl = doc.linkUrl.length < 1000 ? doc.linkUrl : doc.linkUrl.substring(0, 1000);\n if (linkUrl.indexOf('http://') === 0) {\n linkUrl = linkUrl.substring('http://'.length);\n } else if (linkUrl.indexOf('https://') === 0) {\n linkUrl = linkUrl.substring('https://'.length);\n }\n index(\"url\", linkUrl, {\"facet\": true});\n allLong = allLong + \" \" + linkUrl;\n \n const host = linkUrl.indexOf('/') > -1 ? linkUrl.substring(0, linkUrl.indexOf('/')) : linkUrl;\n var reversedHost = host.split('.');\n reversedHost.reverse();\n reversedHost = reversedHost.join('.');\n index(\"host\", host, {\"facet\": true});\n index(\"rhost\", reversedHost, {\"facet\": true});\n }\n \n if (doc.pageTitle) {\n const pageTitle = doc.pageTitle.length < 1000 ? doc.pageTitle : doc.pageTitle.substring(0, 1000);\n index(\"title\", pageTitle, {\"facet\": true});\n allLong = allLong + \" \" + pageTitle;\n }\n \n if (doc.tags) {\n const allTagsLong = doc.tags.join(' ');\n const allTags = allTagsLong.length < 1000 ? allTagsLong : allTagsLong.substring(0, 1000);\n index(\"tags\", allTags, {\"facet\": true});\n allLong = allLong + \" \" + allTags;\n }\n \n if (doc.rssUrl) {\n const rssUrl = doc.rssUrl.length < 1000 ? doc.rssUrl : doc.rssUrl.substring(0, 1000);\n index(\"rss\", rssUrl, {\"facet\": true});\n allLong = allLong + \" \" + rssUrl;\n }\n \n if (doc.notes) {\n const notes = doc.notes.length < 1000 ? doc.notes : doc.notes.substring(0, 1000);\n index(\"notes\", notes, {\"facet\": true});\n allLong = allLong + \" \" + notes;\n }\n\n const all = allLong.length < 1000 ? allLong : allLong.substring(0, 1000);\n index(\"userid\", doc.userid, {\"facet\": true});\n index(\"default\", all, {\"facet\": true});\n }\n}"
}
}
}