From 1c7214d75f2206e6c2eaabd1f01341cd10eaf755 Mon Sep 17 00:00:00 2001 From: ymarcon Date: Wed, 18 Dec 2024 16:48:14 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20use=20search=20service=20to=20retrieve?= =?UTF-8?q?=20document=20from=20=C3=A9ain=20portal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/api/views/search.py | 8 +++ frontend/.eslintrc-auto-import.json | 3 +- frontend/src/auto-imports.d.ts | 33 ++++----- frontend/src/components/MapResults.vue | 11 +-- frontend/src/components/ResultsGrid.vue | 13 ++-- frontend/src/pages/DocumentPage.vue | 71 +++++++++++++++++++ frontend/src/pages/EntityPage.vue | 72 -------------------- frontend/src/router/routes.ts | 6 +- frontend/src/stores/search.ts | 8 +++ frontend/src/stores/services.ts | 90 ------------------------- 10 files changed, 121 insertions(+), 194 deletions(-) create mode 100644 frontend/src/pages/DocumentPage.vue delete mode 100644 frontend/src/pages/EntityPage.vue delete mode 100644 frontend/src/stores/services.ts diff --git a/backend/api/views/search.py b/backend/api/views/search.py index 0615022..2b08f03 100644 --- a/backend/api/views/search.py +++ b/backend/api/views/search.py @@ -73,6 +73,14 @@ async def find( return indexService.search(query=queryDict, skip=skip, limit=limit) +@router.get("/_doc", response_model=SearchResult, response_model_exclude_none=True) +async def find(id: str = Query(None)) -> SearchResult: + """Search documents matching the Elasticsearch query""" + indexService = IndexService() + queryDict = {"query": {"term": {"_id": id}}} + return indexService.search(query=queryDict, skip=0, limit=1) + + @router.get("/", response_model=SearchResult, response_model_exclude_none=True) async def find( text: str = Query(None), diff --git a/frontend/.eslintrc-auto-import.json b/frontend/.eslintrc-auto-import.json index f2d86f1..ad43420 100644 --- a/frontend/.eslintrc-auto-import.json +++ b/frontend/.eslintrc-auto-import.json @@ -106,7 +106,6 @@ "useHome": true, "useSearch": true, "useSearchService": true, - "Service": true, - "useServices": true + "Service": true } } diff --git a/frontend/src/auto-imports.d.ts b/frontend/src/auto-imports.d.ts index 1767aec..53eba6c 100644 --- a/frontend/src/auto-imports.d.ts +++ b/frontend/src/auto-imports.d.ts @@ -13,19 +13,19 @@ declare global { const $shallowRef: typeof import('vue/macros')['$shallowRef'] const $toRef: typeof import('vue/macros')['$toRef'] const EffectScope: typeof import('vue')['EffectScope'] - const Service: typeof import('./stores/services')['Service'] + const Service: (typeof import('./stores/services'))['Service'] const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate'] const computed: typeof import('vue')['computed'] const createApp: typeof import('vue')['createApp'] const createPinia: typeof import('pinia')['createPinia'] - const createPiniaClient: typeof import('feathers-pinia')['createPiniaClient'] + const createPiniaClient: (typeof import('feathers-pinia'))['createPiniaClient'] const customRef: typeof import('vue')['customRef'] const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] const defineComponent: typeof import('vue')['defineComponent'] - const defineGetters: typeof import('feathers-pinia')['defineGetters'] - const defineSetters: typeof import('feathers-pinia')['defineSetters'] + const defineGetters: (typeof import('feathers-pinia'))['defineGetters'] + const defineSetters: (typeof import('feathers-pinia'))['defineSetters'] const defineStore: typeof import('pinia')['defineStore'] - const defineValues: typeof import('feathers-pinia')['defineValues'] + const defineValues: (typeof import('feathers-pinia'))['defineValues'] const effectScope: typeof import('vue')['effectScope'] const getActivePinia: typeof import('pinia')['getActivePinia'] const getCurrentInstance: typeof import('vue')['getCurrentInstance'] @@ -77,24 +77,23 @@ declare global { const triggerRef: typeof import('vue')['triggerRef'] const unref: typeof import('vue')['unref'] const useAttrs: typeof import('vue')['useAttrs'] - const useAuth: typeof import('feathers-pinia')['useAuth'] - const useAuthStore: typeof import('./stores/auth')['useAuthStore'] - const useCounterStore: typeof import('./stores/example-store')['useCounterStore'] + const useAuth: (typeof import('feathers-pinia'))['useAuth'] + const useAuthStore: (typeof import('./stores/auth'))['useAuthStore'] + const useCounterStore: (typeof import('./stores/example-store'))['useCounterStore'] const useCssModule: typeof import('vue')['useCssModule'] const useCssVars: typeof import('vue')['useCssVars'] - const useDataStore: typeof import('feathers-pinia')['useDataStore'] - const useFeathers: typeof import('./composables/feathers')['useFeathers'] - const useFeathersService: typeof import('./composables/feathers')['useFeathersService'] + const useDataStore: (typeof import('feathers-pinia'))['useDataStore'] + const useFeathers: (typeof import('./composables/feathers'))['useFeathers'] + const useFeathersService: (typeof import('./composables/feathers'))['useFeathersService'] const useHome: typeof import('./stores/home')['useHome'] const useI18n: typeof import('vue-i18n')['useI18n'] - const useInstanceDefaults: typeof import('feathers-pinia')['useInstanceDefaults'] + const useInstanceDefaults: (typeof import('feathers-pinia'))['useInstanceDefaults'] const useLink: typeof import('vue-router')['useLink'] const useRoute: typeof import('vue-router')['useRoute'] const useRouter: typeof import('vue-router')['useRouter'] - const useSearch: typeof import('./stores/search')['useSearch'] + const useSearch: (typeof import('./stores/search'))['useSearch'] const useSearchService: typeof import('./stores/search')['useSearchService'] - const useServiceInstance: typeof import('feathers-pinia')['useServiceInstance'] - const useServices: typeof import('./stores/services')['useServices'] + const useServiceInstance: (typeof import('feathers-pinia'))['useServiceInstance'] const useSlots: typeof import('vue')['useSlots'] const useTaxonomyStore: typeof import('./stores/taxonomies')['useTaxonomyStore'] const watch: typeof import('vue')['watch'] @@ -121,7 +120,6 @@ declare module 'vue' { readonly $shallowRef: UnwrapRef readonly $toRef: UnwrapRef readonly EffectScope: UnwrapRef - readonly Service: UnwrapRef readonly acceptHMRUpdate: UnwrapRef readonly computed: UnwrapRef readonly createApp: UnwrapRef @@ -189,7 +187,6 @@ declare module 'vue' { readonly useRoute: UnwrapRef readonly useRouter: UnwrapRef readonly useSearchService: UnwrapRef - readonly useServices: UnwrapRef readonly useSlots: UnwrapRef readonly useTaxonomyStore: UnwrapRef readonly watch: UnwrapRef @@ -209,7 +206,6 @@ declare module '@vue/runtime-core' { readonly $shallowRef: UnwrapRef readonly $toRef: UnwrapRef readonly EffectScope: UnwrapRef - readonly Service: UnwrapRef readonly acceptHMRUpdate: UnwrapRef readonly computed: UnwrapRef readonly createApp: UnwrapRef @@ -277,7 +273,6 @@ declare module '@vue/runtime-core' { readonly useRoute: UnwrapRef readonly useRouter: UnwrapRef readonly useSearchService: UnwrapRef - readonly useServices: UnwrapRef readonly useSlots: UnwrapRef readonly useTaxonomyStore: UnwrapRef readonly watch: UnwrapRef diff --git a/frontend/src/components/MapResults.vue b/frontend/src/components/MapResults.vue index 79d76e7..f96f7a1 100644 --- a/frontend/src/components/MapResults.vue +++ b/frontend/src/components/MapResults.vue @@ -6,7 +6,7 @@