nodebb-plugin-solr
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -169,5 +169,6 @@ 'use strict'; | ||
} | ||
var isTopic = data.index === 'topic'; | ||
var field = isTopic ? 'tid_i' : 'pid_id'; | ||
// Determine which cache to use | ||
var cache = data.index === 'topic' ? titleCache : postCache; | ||
var cache = isTopic ? titleCache : postCache; | ||
@@ -181,3 +182,3 @@ if (cache.has(data.query)) { | ||
// Populate Fields | ||
if (data.index === 'topic') { fields[Solr.config.titleField || 'title_t'] = 1; } | ||
if (isTopic) { fields[Solr.config.titleField || 'title_t'] = 1; } | ||
else { fields[Solr.config.contentField || 'description_t'] = 1; } | ||
@@ -192,3 +193,3 @@ | ||
var payload = obj.response.docs.map(function(result) { | ||
return result[data.index === 'topic' ? 'tid_i' : 'pid_i']; | ||
return result[field]; | ||
}).filter(Boolean); | ||
@@ -195,0 +196,0 @@ |
{ | ||
"name": "nodebb-plugin-solr", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Full-text searching for NodeBB using Apache Solr", | ||
@@ -5,0 +5,0 @@ "main": "library.js", |
25977
461