feat: Tag search will now only show the direct tag results instead of also showing the parent and siblings (#2906)
This commit is contained in:
@@ -38,8 +38,11 @@ export function itemMatchesQuery(
|
||||
searchQuery: SearchQuery,
|
||||
collection: ReferenceLookupCollection,
|
||||
): boolean {
|
||||
const shouldCheckForSomeTagMatches = searchQuery.shouldCheckForSomeTagMatches ?? true
|
||||
const itemTags = collection.elementsReferencingElement(itemToMatch, ContentType.TYPES.Tag) as SNTag[]
|
||||
const someTagsMatches = itemTags.some((tag) => matchResultForStringQuery(tag, searchQuery.query) !== MatchResult.None)
|
||||
const someTagsMatches =
|
||||
shouldCheckForSomeTagMatches &&
|
||||
itemTags.some((tag) => matchResultForStringQuery(tag, searchQuery.query) !== MatchResult.None)
|
||||
|
||||
if (itemToMatch.protected && !searchQuery.includeProtectedNoteText) {
|
||||
const match = matchResultForStringQuery(itemToMatch, searchQuery.query)
|
||||
|
||||
@@ -5,6 +5,7 @@ import { SearchableItem } from './SearchableItem'
|
||||
export type SearchQuery = {
|
||||
query: string
|
||||
includeProtectedNoteText: boolean
|
||||
shouldCheckForSomeTagMatches?: boolean
|
||||
}
|
||||
|
||||
export interface ReferenceLookupCollection {
|
||||
|
||||
Reference in New Issue
Block a user