irisjs-apachesolr
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -47,3 +47,25 @@ iris.modules.auth.globals.registerPermission("can fetch page", "Search", "Can user search records"); | ||
iris.route.get('/search', routes.query, function (req, res) { | ||
iris.modules.irisjsApachesolr.globals.generateSearch(req, res); | ||
var options = { | ||
req: req, | ||
res: res, | ||
query: req.query, | ||
}; | ||
iris.modules.irisjsApachesolr.globals.generateSearch(options, function(markup) { | ||
iris.modules.frontend.globals.parseTemplateFile(['solrsearch'], ['html'], {results: markup}, req.authPass, req) | ||
.then(function (output) { | ||
res.send(output); | ||
}, function (fail) { | ||
iris.modules.frontend.globals.displayErrorPage(500, req, res); | ||
iris.log("error", fail); | ||
}); | ||
}); | ||
}); | ||
@@ -431,8 +453,8 @@ | ||
*/ | ||
iris.modules.irisjsApachesolr.globals.generateSearch = function (req, res) { | ||
iris.modules.irisjsApachesolr.globals.generateSearch = function (options, callback) { | ||
var query = iris.modules.irisjsApachesolr.globals.generateQuery(req.query); | ||
var query = iris.modules.irisjsApachesolr.globals.generateQuery(options.query); | ||
if (query) { | ||
if (query.parameters[0] = 'q=') { | ||
if (query.parameters[0] == 'q=') { | ||
query.parameters[0] = 'q=*:*'; | ||
@@ -448,15 +470,4 @@ } | ||
iris.modules.frontend.globals.parseTemplateFile(['solrsearch'], ['html'], {results: markup}, req.authPass, req) | ||
callback(markup); | ||
.then(function (output) { | ||
res.send(output); | ||
}, function (fail) { | ||
iris.modules.frontend.globals.displayErrorPage(500, req, res); | ||
iris.log("error", fail); | ||
}); | ||
} | ||
@@ -489,7 +500,7 @@ | ||
}; | ||
iris.invokeHook("hook_entity_fetch", req.authPass, null, entityQuery) | ||
iris.invokeHook("hook_entity_fetch", options.req.authPass, null, entityQuery) | ||
.then(function (entity) { | ||
if (entity && entity[0]) { | ||
iris.modules.frontend.globals.parseTemplateFile(['solrresult', result.entityType[0]], null, entity[0], req.authPass, req) | ||
iris.modules.frontend.globals.parseTemplateFile(['solrresult', result.entityType[0]], null, entity[0], options.req.authPass, options.req) | ||
@@ -501,3 +512,3 @@ .then(function (output) { | ||
}, function (fail) { | ||
iris.modules.frontend.globals.displayErrorPage(500, req, res); | ||
iris.modules.frontend.globals.displayErrorPage(500, options.req, res); | ||
iris.log("error", fail); | ||
@@ -531,3 +542,3 @@ | ||
iris.modules.frontend.globals.parseTemplateFile(['solrsearch'], ['html'], {results: '<div class="alert alert-danger">' + req.authPass.t("Cannot connect to Apachesolr") + '</div>'}, req.authPass, req) | ||
iris.modules.frontend.globals.parseTemplateFile(['solrsearch'], ['html'], {results: '<div class="alert alert-danger">' + req.authPass.t("Cannot connect to Apachesolr") + '</div>'}, options.req.authPass, options.req) | ||
@@ -540,3 +551,3 @@ .then(function (output) { | ||
iris.modules.frontend.globals.displayErrorPage(500, req, res); | ||
iris.modules.frontend.globals.displayErrorPage(500, options.req, res); | ||
iris.log("error", fail); | ||
@@ -543,0 +554,0 @@ |
{ | ||
"name": "irisjs-apachesolr", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Apache solr search integration for the IrisJS framework", | ||
@@ -5,0 +5,0 @@ "main": "irisjs.org", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21678
583