(query: string)
| 39 | } |
| 40 | |
| 41 | export function parseNoteSearchQuery(query: string): ParsedNoteSearchQuery { |
| 42 | const tags: string[] = [] |
| 43 | const text: string[] = [] |
| 44 | for (const token of query.split(/\s+/)) { |
| 45 | if (!token) continue |
| 46 | if (token.startsWith('#') && token.length > 1) tags.push(token.slice(1).toLowerCase()) |
| 47 | else text.push(token) |
| 48 | } |
| 49 | return { freeText: text.join(' ').trim(), tagTokens: tags } |
| 50 | } |
| 51 | |
| 52 | function matchesTags(entry: NoteSearchEntry, tagTokens: string[]): boolean { |
| 53 | if (tagTokens.length === 0) return true |
no outgoing calls
no test coverage detected