UBERF-4324: While indexing is still in progress we see undefined (#4017)

Signed-off-by: Maxim Karmatskikh <mkarmatskih@gmail.com>
This commit is contained in:
Maksim Karmatskikh 2023-11-20 16:09:02 +01:00 committed by GitHub
parent 7621bccf22
commit dc94123e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 36 deletions

View File

@ -63,7 +63,7 @@ export class TObjectDDParticipant extends TClass implements ObjectDDParticipant
@Mixin(serverCore.mixin.SearchPresenter, core.class.Class)
export class TSearchPresenter extends TClass implements SearchPresenter {
searchConfig!: ClassSearchConfig
getSearchObjectId!: Resource<SearchPresenterFunc>
getSearchShortTitle!: Resource<SearchPresenterFunc>
getSearchTitle!: Resource<SearchPresenterFunc>
}

View File

@ -164,39 +164,43 @@
$: updateItems(query)
</script>
<form class="antiPopup mentionPoup" on:keydown={onKeyDown} use:resizeObserver={() => dispatch('changeSize')}>
<div class="ap-scroll" bind:this={scrollContainer}>
<div class="ap-box">
{#if items.length === 0 && query !== ''}
<div class="noResults"><Label label={presentation.string.NoResults} /></div>
{/if}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<ListView bind:this={list} bind:selection count={items.length}>
<svelte:fragment slot="category" let:item={num}>
{@const item = items[num]}
{#if item.num === 0}
<div class="mentonCategory">
<Label label={item.category.title} />
</div>
{/if}
</svelte:fragment>
<svelte:fragment slot="item" let:item={num}>
{@const item = items[num]}
{@const doc = item.item}
<div
class="ap-menuItem withComp"
on:click={() => {
dispatchItem(doc)
}}
>
<MentionResult value={doc} />
</div>
</svelte:fragment>
</ListView>
{#if (items.length === 0 && query !== '') || items.length > 0}
<form class="antiPopup mentionPoup" on:keydown={onKeyDown} use:resizeObserver={() => dispatch('changeSize')}>
<div class="ap-scroll" bind:this={scrollContainer}>
<div class="ap-box">
{#if items.length === 0 && query !== ''}
<div class="noResults"><Label label={presentation.string.NoResults} /></div>
{/if}
{#if items.length > 0}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<ListView bind:this={list} bind:selection count={items.length}>
<svelte:fragment slot="category" let:item={num}>
{@const item = items[num]}
{#if item.num === 0}
<div class="mentonCategory">
<Label label={item.category.title} />
</div>
{/if}
</svelte:fragment>
<svelte:fragment slot="item" let:item={num}>
{@const item = items[num]}
{@const doc = item.item}
<div
class="ap-menuItem withComp"
on:click={() => {
dispatchItem(doc)
}}
>
<MentionResult value={doc} />
</div>
</svelte:fragment>
</ListView>
{/if}
</div>
</div>
</div>
<div class="ap-space x2" />
</form>
<div class="ap-space x2" />
</form>
{/if}
<style lang="scss">
.noResults {

View File

@ -85,7 +85,7 @@ export async function updateDocWithPresenter (hierarchy: Hierarchy, doc: Indexed
props.push({
name: 'searchShortTitle',
config: searchPresenter.searchConfig.shortTitle,
provider: searchPresenter.getSearchObjectId
provider: searchPresenter.getSearchShortTitle
})
}

View File

@ -365,6 +365,6 @@ export interface ClassSearchConfig {
*/
export interface SearchPresenter extends Class<Doc> {
searchConfig: ClassSearchConfig
getSearchObjectId?: Resource<SearchPresenterFunc>
getSearchShortTitle?: Resource<SearchPresenterFunc>
getSearchTitle?: Resource<SearchPresenterFunc>
}

View File

@ -128,7 +128,12 @@ class ElasticAdapter implements FullTextAdapter {
size: options.limit ?? DEFAULT_LIMIT
}
const filter = []
const filter: any = [
{
exists: { field: 'searchTitle' }
}
]
if (query.spaces !== undefined) {
filter.push({
terms: { 'space.keyword': query.spaces }