New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hexo-algolia

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-algolia - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

60

lib/command.js

@@ -41,4 +41,16 @@ 'use strict';

if(data.published){
data.objectID = computeSha1(data.permalink);
posts.push(_.pick(data, ['title', 'slug', 'permalink', 'content', 'excerpt', 'objectID']));
data.objectID = computeSha1(data.path);
var storedPost = _.pick(data, ['title', 'date', 'slug', 'path', 'content', 'excerpt', 'objectID']);
storedPost.categories = _.map(data.categories.toArray(),
function(item){
return _.pick(item, ['name', 'path']);
});
storedPost.tags = _.map(data.tags.toArray(),
function(item){
return _.pick(item, ['name', 'path']);
});
storedPost.author = data.author || config.author;
posts.push(storedPost);
}

@@ -50,9 +62,23 @@ return data;

log.info('[Algolia] Identified ' + posts.length + ' posts to index.');
log.debug(posts);
for(var index1 = 0, l = posts.length; index1 < l; index1++){
for(var index2 = 0, l2 = posts[index1].tags.length; index2 < l2; index2++){
log.debug(posts[index1].tags[index2].name);
}
}
// Initiliaze Algolia client
var client = algoliasearch(config.algolia.applicationID, config.algolia.adminApiKey);
var index = client.initIndex(config.algolia.indexName);
index.setSettings({
'highlightPreTag': '<em class="highlight">',
'highlightPostTag' : '</em>'
}, function(err) {
if (!err) {
log.info('[Algolia] Highlight tag definition success.');
}
}
);
if(args && !args.f){
// Initiliaze Algolia client
var client = algoliasearch(config.algolia.applicationID, config.algolia.adminApiKey);
var index = client.initIndex(config.algolia.indexName);
if(args.w){

@@ -65,5 +91,5 @@ indexPosts(index, posts);

indexPosts(index, posts);
});
});
}
} else {

@@ -74,13 +100,13 @@ log.info('[Algolia] No data sent to Algolia due to the --fake option.');

function end(err) {
if (err) {
throw err;
}
log.info('[Algolia] Import done.');
function end(err) {
if (err) {
throw err;
}
function indexPosts(index, posts){
log.info('[Algolia] Starting indexation...');
log.info('[Algolia] Import done.');
}
function indexPosts(index, posts){
log.info('[Algolia] Starting indexation...');
// Split our results into chunks, to get a good indexing/insert performance

@@ -87,0 +113,0 @@ var chunkedResults = _.chunk(posts, config.algolia.chunks);

{
"name": "hexo-algolia",
"version": "0.1.0",
"version": "0.2.0",
"description": "Index your content in Algolia Search API",

@@ -5,0 +5,0 @@ "main": "index",

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