Commit 64766110 authored by Hervé Ménager's avatar Hervé Ménager

replace text index search with a regexp based search

more expensive, but also more intuitive to the users.
parent b1d3b537
......@@ -241,9 +241,20 @@ var router = function(app) {
};
}
if (req.query.search) {
filter.$text = {
'$search': req.query.search
};
filter.$or = [
{
name: new RegExp(req.query.search,'i')
},
{
authors: new RegExp(req.query.search,'i')
},
{
'packageVersions.programs.name': new RegExp(req.query.search,'i')
},
{
'references.citation': new RegExp(req.query.search,'i')
},
];
collection.find(filter, {
'score': {
'$meta': "textScore"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment