Skip to content

Commit

Permalink
search algo fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
hjyssg committed Oct 5, 2020
1 parent b84570d commit fc661ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/server/models/searchUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,15 @@ function searchByTagAndAuthor(tag, author, text, onlyNeedFew) {
}

const text2 = tag || author || text;
const text2InLowerCase = text2.toLowerCase();
const reg2 = escapeRegExp(text2);
const img_files_results = getFileCollection()
.chain()
.find({'filePath': { '$regex' : reg2 }, isDisplayableInOnebook: true })
.where(obj =>{
const fp = path.dirname(obj.filePath);
return fp.toLowerCase().includes(text2InLowerCase);
})
.data();

img_files_results.forEach(obj => {
Expand Down

0 comments on commit fc661ae

Please sign in to comment.