Default to title-content search

This commit is contained in:
shamoon 2024-05-22 06:23:34 -07:00
parent 1c986ae14e
commit 8e64ab1408
4 changed files with 13 additions and 22 deletions

View File

@ -1030,11 +1030,18 @@
<context context-type="linenumber">212</context> <context context-type="linenumber">212</context>
</context-group> </context-group>
</trans-unit> </trans-unit>
<trans-unit id="6631288852577115923" datatype="html">
<source>Title and content search</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/settings/settings.component.html</context>
<context context-type="linenumber">216</context>
</context-group>
</trans-unit>
<trans-unit id="1010505078885609376" datatype="html"> <trans-unit id="1010505078885609376" datatype="html">
<source>Advanced search</source> <source>Advanced search</source>
<context-group purpose="location"> <context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/settings/settings.component.html</context> <context context-type="sourcefile">src/app/components/admin/settings/settings.component.html</context>
<context context-type="linenumber">216</context> <context context-type="linenumber">217</context>
</context-group> </context-group>
<context-group purpose="location"> <context-group purpose="location">
<context context-type="sourcefile">src/app/components/app-frame/global-search/global-search.component.html</context> <context context-type="sourcefile">src/app/components/app-frame/global-search/global-search.component.html</context>
@ -1045,13 +1052,6 @@
<context context-type="linenumber">143</context> <context context-type="linenumber">143</context>
</context-group> </context-group>
</trans-unit> </trans-unit>
<trans-unit id="6631288852577115923" datatype="html">
<source>Title and content search</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/settings/settings.component.html</context>
<context context-type="linenumber">217</context>
</context-group>
</trans-unit>
<trans-unit id="8104421162933956065" datatype="html"> <trans-unit id="8104421162933956065" datatype="html">
<source>Notes</source> <source>Notes</source>
<context-group purpose="location"> <context-group purpose="location">

View File

@ -213,8 +213,8 @@
</div> </div>
<div class="col"> <div class="col">
<select class="form-select" formControlName="searchLink"> <select class="form-select" formControlName="searchLink">
<option [ngValue]="GlobalSearchType.ADVANCED" i18n>Advanced search</option>
<option [ngValue]="GlobalSearchType.TITLE_CONTENT" i18n>Title and content search</option> <option [ngValue]="GlobalSearchType.TITLE_CONTENT" i18n>Title and content search</option>
<option [ngValue]="GlobalSearchType.ADVANCED" i18n>Advanced search</option>
</select> </select>
</div> </div>
</div> </div>

View File

@ -504,15 +504,6 @@ describe('GlobalSearchComponent', () => {
expect(focusSpy).toHaveBeenCalled() expect(focusSpy).toHaveBeenCalled()
}) })
it('should support explicit advanced search', () => {
const qfSpy = jest.spyOn(documentListViewService, 'quickFilter')
component.query = 'test'
component.runFullSearch()
expect(qfSpy).toHaveBeenCalledWith([
{ rule_type: FILTER_FULLTEXT_QUERY, value: 'test' },
])
})
it('should support open in new window', () => { it('should support open in new window', () => {
const openSpy = jest.spyOn(window, 'open') const openSpy = jest.spyOn(window, 'open')
const event = new Event('click') const event = new Event('click')
@ -539,17 +530,17 @@ describe('GlobalSearchComponent', () => {
component.query = 'test' component.query = 'test'
component.runFullSearch() component.runFullSearch()
expect(qfSpy).toHaveBeenCalledWith([ expect(qfSpy).toHaveBeenCalledWith([
{ rule_type: FILTER_FULLTEXT_QUERY, value: 'test' }, { rule_type: FILTER_TITLE_CONTENT, value: 'test' },
]) ])
settingsService.set( settingsService.set(
SETTINGS_KEYS.SEARCH_FULL_TYPE, SETTINGS_KEYS.SEARCH_FULL_TYPE,
GlobalSearchType.TITLE_CONTENT GlobalSearchType.ADVANCED
) )
component.query = 'test' component.query = 'test'
component.runFullSearch() component.runFullSearch()
expect(qfSpy).toHaveBeenCalledWith([ expect(qfSpy).toHaveBeenCalledWith([
{ rule_type: FILTER_TITLE_CONTENT, value: 'test' }, { rule_type: FILTER_FULLTEXT_QUERY, value: 'test' },
]) ])
}) })
}) })

View File

@ -234,6 +234,6 @@ export const SETTINGS: UiSetting[] = [
{ {
key: SETTINGS_KEYS.SEARCH_FULL_TYPE, key: SETTINGS_KEYS.SEARCH_FULL_TYPE,
type: 'string', type: 'string',
default: GlobalSearchType.ADVANCED, default: GlobalSearchType.TITLE_CONTENT,
}, },
] ]