Commit f9178d0c authored by Ian Dennis Miller's avatar Ian Dennis Miller

search is AND by default

parent 286879f3
......@@ -58,16 +58,26 @@ var do_search = function(terms) {
// TODO: grab title and authors for search, too
if (terms.length > 0) {
for (var t_id in terms) {
var re = new RegExp(terms[t_id], 'i');
for (var id in cards_content) {
var content = cards_content[id];
// one card at a time
for (var id in cards_content) {
var content = cards_content[id];
var num_terms = terms.length;
var num_found = 0;
// check one term at a time
for (var t_id in terms) {
var re = new RegExp(terms[t_id], 'i');
if (content.match(re)) {
matches[id] = content;
num_found += 1;
}
}
// if all terms are present
if (num_found == num_terms) {
matches[id] = true;
}
}
}
......@@ -80,7 +90,6 @@ var show_results = function(terms, matches) {
show_card(id);
for (t_id in terms) {
var term = terms[t_id];
console.log(term);
highlight_keyword(id, term);
}
}
......
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