Better sorting of note categories

fixes #1
This commit is contained in:
Max G
2020-02-18 22:52:12 +00:00
parent e56042958b
commit aded72928c
6 changed files with 128 additions and 151 deletions

View File

@@ -92,7 +92,7 @@ ProcessText.deduceNoteTitle = (inString) => {
//Empty line, may be a list open or close
if(cleanLine.length == 0 && (startTags.includes(lineStart) || endTags.includes(lineStart) )){
if(listStart == false){
charLimit = 400 //Double size for list notes
//charLimit = 400 //Double size for list notes
}
finalLines.push(lines[i])
totalLines++

View File

@@ -434,6 +434,7 @@ Note.search = (userId, searchQuery, searchTags, fastFilters) => {
let textSearchIds = []
let highlights = {}
let returnTagResults = false
let searchAllNotes = false
if(textSearchResults != null){
textSearchIds = textSearchResults['ids']
@@ -484,11 +485,13 @@ Note.search = (userId, searchQuery, searchTags, fastFilters) => {
if(textSearchIds.length > 0){
searchParams.push(textSearchIds)
noteSearchQuery += ' AND note.id IN (?)'
searchAllNotes = true
}
if(fastFilters.noteIdSet && fastFilters.noteIdSet.length > 0){
searchParams.push(fastFilters.noteIdSet)
noteSearchQuery += ' AND note.id IN (?)'
searchAllNotes = true
}
//If tags are passed, use those tags in search
@@ -498,12 +501,14 @@ Note.search = (userId, searchQuery, searchTags, fastFilters) => {
}
//Show archived notes, only if fast filter is set, default to not archived
if(fastFilters.onlyArchived == 1){
noteSearchQuery += ' AND note.archived = 1' //Show Archived
} else {
noteSearchQuery += ' AND note.archived = 0' //Exclude archived
if(searchAllNotes == false){
if(fastFilters.onlyArchived == 1){
noteSearchQuery += ' AND note.archived = 1' //Show Archived
} else {
noteSearchQuery += ' AND note.archived = 0' //Exclude archived
}
}
//Finish up note query
noteSearchQuery += ' GROUP BY note.id'