Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nodebb-plugin-search-elasticsearch

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodebb-plugin-search-elasticsearch - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

62

library.js

@@ -217,2 +217,4 @@ "use strict";

var query = {
index: Elasticsearch.config.index_name,
type: Elasticsearch.config.post_type,
body: {

@@ -245,3 +247,3 @@ query: {

var payload = obj.hits.hits.map(function(result) {
return result._id;
return parseInt(result._id, 10);
});

@@ -263,2 +265,6 @@

if (!term || !term.length) {
return callback(null, []);
}
async.parallel({

@@ -380,20 +386,28 @@ mainPid: async.apply(topics.getTopicField, tid, 'mainPid'),

// Make sure id is an integer
if (_.isString(item.id)) {
item.id = parseInt(item.id, 10);
}
if (item && item.id) {
// Make sure id is an integer
var itemId = parseInt(item.id, 10);
item.id = itemId;
// Action
body.push({
index: {
/*_index: Elasticsearch.config.index_name, */ // We'll set it in bulk()
/*_type: Elasticsearch.config.post_type, */ // We'll set it in bulk()
_id: item.id
}
});
// Action
body.push({
index: {
/*_index: Elasticsearch.config.index_name, */ // We'll set it in bulk()
/*_type: Elasticsearch.config.post_type, */ // We'll set it in bulk()
_id: itemId
}
});
// Document
body.push(item);
// Document
body.push(item);
}
});
if (0 === body.length) {
if (callback) {
return callback(null);
}
return;
}
Elasticsearch.client.bulk({

@@ -530,2 +544,9 @@ body: body,

], function(err, payload) {
if (err) {
return winston.error(err.message);
}
if (!payload) {
return winston.warn('[plugins/elasticsearch] no payload for pid ' + topicObj.mainPid);
}
payload.title = topicObj.title;

@@ -563,4 +584,6 @@ Elasticsearch.add(payload);

for(var x=0,numPids=payload.length;x<numPids;x++) {
if (payload[x].id === topicObj.mainPid) {
payload[x].title = topicObj.title;
if (payload[x]) {
if (payload[x].id === topicObj.mainPid) {
payload[x].title = topicObj.title;
}
}

@@ -672,3 +695,6 @@ }

}, []).filter(function(entry) {
return entry.hasOwnProperty('id');
if (entry) {
return entry.hasOwnProperty('id');
}
return false;
});

@@ -675,0 +701,0 @@

{
"name": "nodebb-plugin-search-elasticsearch",
"version": "0.1.1",
"version": "0.1.2",
"description": "Full-text searching using Elasticsearch",

@@ -5,0 +5,0 @@ "main": "library.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc