Closed AdrianAbba closed 7 years ago
i did smt like this now:
selector: function(searchObject, options, aggregation) {
var selector, tags2;
selector = {'$and': [] }; // initialzie selector
console.log(searchObject);
tags2=searchObject.tags.split(" "); // tags is now an Array
_.each(tags2, function(tag, index) {
selector.$and.push({tags: tag});
selector.$and.push({title: tag});
selector.$and.push({subtitle: tag});
selector.$and.push({jobs: tag});
});
console.log(selector);
return selector;
}
but its not working very well.
the selector returns this:
I20161104-16:58:32.297(1)? { title: 'Modern Auto',
I20161104-16:58:32.311(1)? subtitle: 'Modern Auto',
I20161104-16:58:32.312(1)? tags: 'Modern Auto',
I20161104-16:58:32.314(1)? jobs: 'Modern Auto' }
I20161104-16:58:32.320(1)? { '$and':
I20161104-16:58:32.321(1)? [ { tags: 'Modern' },
I20161104-16:58:32.322(1)? { title: 'Modern' },
I20161104-16:58:32.323(1)? { subtitle: 'Modern' },
I20161104-16:58:32.325(1)? { jobs: 'Modern' },
I20161104-16:58:32.325(1)? { tags: 'Auto' },
I20161104-16:58:32.327(1)? { title: 'Auto' },
I20161104-16:58:32.329(1)? { subtitle: 'Auto' },
I20161104-16:58:32.330(1)? { jobs: 'Auto' } ] }
the logical syntax doesnt work very well......... any ideas :D?
Closing as it's duplicate of #546
umm dude this is #546
Oh wow... haha.
Yeah I think this is a matter of constructing a good mongodb selector or using something like ElasticSearch which is optimized for searching.
Single searches are working, like searching for the title, searching in tags, jobs etc. but only one keyword works. If i wanna search for a project with many keywords, like the title, tags etc. what should i do :x?
i have to use something like an logical AND`?