Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • mdm-lab/wiki
  • hvaysset/wiki
  • jsousa/wiki
  • tclabby/wiki
4 results
Show changes
Commits on Source (3)
...@@ -7,6 +7,7 @@ import { useDisplay } from "vuetify"; ...@@ -7,6 +7,7 @@ import { useDisplay } from "vuetify";
import { useThrottleFn } from '@vueuse/core' import { useThrottleFn } from '@vueuse/core'
import type { FacetInputItem, FilterItem } from '@/components/AutocompleteMeiliFacets.vue' import type { FacetInputItem, FilterItem } from '@/components/AutocompleteMeiliFacets.vue'
import { useMeiliSearch } from "#imports" import { useMeiliSearch } from "#imports"
import type { SearchResponse } from 'meilisearch'
// import { saveAs } from "file-saver"; // import { saveAs } from "file-saver";
export interface SortItem { export interface SortItem {
key: string, key: string,
...@@ -55,9 +56,11 @@ const props = withDefaults(defineProps<Props>(), { ...@@ -55,9 +56,11 @@ const props = withDefaults(defineProps<Props>(), {
} }
}); });
const slots = useSlots() const slots = useSlots()
const client = useMeiliSearchRef()
const sortByRef = toRef(props.sortBy) const sortByRef = toRef(props.sortBy)
const emit = defineEmits(["refresh:search"]) const emit = defineEmits(["refresh:search"])
const { search: msSearch, result: msResult } = useMeiliSearch(props.autocompleteMeiliFacetsProps.db) const msResult = ref()
// const { search: msSearch, result: msResult } = useMeiliSearch(props.autocompleteMeiliFacetsProps.db)
const search: Ref<string> = ref(""); const search: Ref<string> = ref("");
const filterOrSearch: Ref<FilterItem[] | null> = ref(null) const filterOrSearch: Ref<FilterItem[] | null> = ref(null)
const hitsPerPage: Ref<number> = ref(25) const hitsPerPage: Ref<number> = ref(25)
...@@ -118,7 +121,7 @@ watch([paginationParams, msSortBy, page], ([newParams, newSort, newPage]) => { ...@@ -118,7 +121,7 @@ watch([paginationParams, msSortBy, page], ([newParams, newSort, newPage]) => {
} }
}) })
onBeforeMount(async () => { onMounted(async () => {
searchOrFilter() searchOrFilter()
emitRefreshRes() emitRefreshRes()
}) })
...@@ -214,7 +217,15 @@ async function searchOrFilter() { ...@@ -214,7 +217,15 @@ async function searchOrFilter() {
try { try {
loading.value = true loading.value = true
const q = search.value const q = search.value
await msSearch(q, { ...paginationParams.value, filter: toValue(computedFilter), sort: msSortBy.value }) const response = await client
.index(props.autocompleteMeiliFacetsProps.db)
.search(q, {
...paginationParams.value,
filter: toValue(computedFilter),
sort: msSortBy.value
})
// await msSearch(q, { ...paginationParams.value, filter: toValue(computedFilter), sort: msSortBy.value })
msResult.value = response
} catch (error: any) { } catch (error: any) {
filterError.value = error filterError.value = error
console.log(error) console.log(error)
...@@ -255,13 +266,23 @@ watch(search, () => { ...@@ -255,13 +266,23 @@ watch(search, () => {
// }) // })
async function downloadData() { async function downloadData() {
pendingDownloadData.value = true
try { try {
const { data } = await useAsyncMeiliSearch({ pendingDownloadData.value = true
index: props.autocompleteMeiliFacetsProps.db,
params: { ...toValue(notPaginatedParams), filter: toValue(computedFilter), sort: toValue(msSortBy) }, const data = await client
query: toValue(search), .index(props.autocompleteMeiliFacetsProps.db)
}) .search(
toValue(search),
{
...toValue(notPaginatedParams), filter: toValue(computedFilter), sort: toValue(msSortBy)
})
// const { data } = await useAsyncMeiliSearch({
// index: props.autocompleteMeiliFacetsProps.db,
// params: { ...toValue(notPaginatedParams), filter: toValue(computedFilter), sort: toValue(msSortBy) },
// query: toValue(search),
// })
useCsvDownload(data, props.columnsToDownload, props.title) useCsvDownload(data, props.columnsToDownload, props.title)
} finally { } finally {
......
...@@ -25,76 +25,39 @@ const cellPlotMargin = ref({ ...@@ -25,76 +25,39 @@ const cellPlotMargin = ref({
marginRight: 50 marginRight: 50
}) })
const client = useMeiliSearchRef()
onBeforeMount(async () => {
const { data } = await useAsyncMeiliSearch({
index: toValue(dbName), query: "", params: {
facets: ["*"],
filter: [],
page: 1,
hitsPerPage: 25,
}
})
await getAllHits({
index: toValue(dbName), query: "", params: {
facets: ["*"],
filter: [],
// page: 1,
// hitsPerPage: 25,
limit: 500000,
sort: ["type:asc"]
}
})
autocompleteMeiliFacetsProps.value.facetDistribution = toValue(data)?.facetDistribution
// allHitsDb.value = toValue(data)?.hits
const { data: taxo } = await useAsyncMeiliSearch({
index: toValue("refseqtaxo"), query: "", params: {
facets: ["*"],
filter: [],
page: 1,
hitsPerPage: 25,
}
})
taxonomyFacet.value = toValue(taxo)?.facetDistribution
})
onMounted(async () => { onMounted(async () => {
try {
const { data } = await useAsyncMeiliSearch({ const data = await client.index(toValue(dbName)).search("", {
index: toValue(dbName), query: "", params: {
facets: ["*"], facets: ["*"],
filter: [], filter: [],
page: 1, page: 1,
hitsPerPage: 25, hitsPerPage: 25,
// limit: 500000, })
// sort: ["type:asc"] autocompleteMeiliFacetsProps.value.facetDistribution = data?.facetDistribution
} } catch (error) {
}) }
await getAllHits({ await getAllHits({
index: toValue(dbName), query: "", params: { index: toValue(dbName), query: "", params: {
facets: ["*"], facets: ["*"],
filter: [], filter: [],
// page: 1,
// hitsPerPage: 25,
limit: 500000, limit: 500000,
sort: ["type:asc"] sort: ["type:asc"]
} }
}) })
autocompleteMeiliFacetsProps.value.facetDistribution = toValue(data)?.facetDistribution try {
// allHitsDb.value = toValue(data)?.hits const taxo = await client.index("refseqtaxo").search("", {
const { data: taxo } = await useAsyncMeiliSearch({
index: toValue("refseqtaxo"), query: "", params: {
facets: ["*"], facets: ["*"],
filter: [], filter: [],
page: 1, page: 1,
hitsPerPage: 25, hitsPerPage: 25,
} })
}) taxonomyFacet.value = taxo?.facetDistribution
taxonomyFacet.value = toValue(taxo)?.facetDistribution } catch (error) {
}
}) })
const { serialize } = useSerialize() const { serialize } = useSerialize()
...@@ -221,16 +184,14 @@ async function getAllHits(params: { index: string, params: Record<string, any>, ...@@ -221,16 +184,14 @@ async function getAllHits(params: { index: string, params: Record<string, any>,
pendingAllHits.value = true pendingAllHits.value = true
try { try {
const { data, error } = await useAsyncMeiliSearch({ const data = await client
...params, .index("refseqsanitized")
index: "refseqsanitized", .search("", {
params: {
...params.params, ...params.params,
'attributesToRetrieve': ['type', 'Assembly', ...toValue(availableTaxo)] 'attributesToRetrieve': ['type', 'Assembly', ...toValue(availableTaxo)]
} })
})
allHits.value = data.value allHits.value = data
} finally { } finally {
pendingAllHits.value = false pendingAllHits.value = false
......
...@@ -16,34 +16,29 @@ interface Item { ...@@ -16,34 +16,29 @@ interface Item {
const sortBy: Ref<SortItem[]> = ref([{ key: 'System', order: "asc" }]) const sortBy: Ref<SortItem[]> = ref([{ key: 'System', order: "asc" }])
const itemValue = ref("id"); const itemValue = ref("id");
const dbName = ref("structure") const dbName = ref("structure")
const client = useMeiliSearchRef()
onBeforeMount(async () => { onMounted(async () => {
const { data } = await useAsyncMeiliSearch({
index: toValue(dbName), query: "", params: { try {
const data = await client.index(toValue(dbName)).search("", {
facets: ["*"], facets: ["*"],
filter: [], filter: [],
page: 1, page: 1,
hitsPerPage: 25, hitsPerPage: 25,
} })
}) autocompleteMeiliFacetsProps.value.facetDistribution = data?.facetDistribution
autocompleteMeiliFacetsProps.value.facetDistribution = toValue(data)?.facetDistribution } catch (error) {
throw createError("Unable to get structures")
}) }
onMounted(async () => {
const { data } = await useAsyncMeiliSearch({
index: toValue(dbName), query: "", params: {
facets: ["*"],
filter: [],
page: 1,
hitsPerPage: 25,
}
})
autocompleteMeiliFacetsProps.value.facetDistribution = toValue(data)?.facetDistribution
}) })
const autocompleteMeiliFacetsProps = ref<AutocompleteMeiliFacetProps>({ const autocompleteMeiliFacetsProps = ref<AutocompleteMeiliFacetProps>({
db: toValue(dbName), db: toValue(dbName),
facets: [ facets: [
......
...@@ -5,31 +5,36 @@ const sortBy: Ref<SortItem[]> = ref([{ key: 'title', order: "asc" }]) ...@@ -5,31 +5,36 @@ const sortBy: Ref<SortItem[]> = ref([{ key: 'title', order: "asc" }])
const itemValue = ref("title"); const itemValue = ref("title");
const dbName = ref("systems") const dbName = ref("systems")
onBeforeMount(async () => { const client = useMeiliSearchRef()
const { data } = await useAsyncMeiliSearch({
index: toValue(dbName), query: "", params: {
facets: ["*"],
filter: [],
page: 1,
hitsPerPage: 25,
}
})
autocompleteMeiliFacetsProps.value.facetDistribution = toValue(data)?.facetDistribution
}) // onBeforeMount(async () => {
onMounted(async () => { // const { data } = await useAsyncMeiliSearch({
const { data } = await useAsyncMeiliSearch({ // index: toValue(dbName), query: "", params: {
index: toValue(dbName), query: "", params: { // facets: ["*"],
facets: ["*"], // filter: [],
filter: [], // page: 1,
page: 1, // hitsPerPage: 25,
hitsPerPage: 25, // }
} // })
})
autocompleteMeiliFacetsProps.value.facetDistribution = toValue(data)?.facetDistribution // autocompleteMeiliFacetsProps.value.facetDistribution = toValue(data)?.facetDistribution
// })
onMounted(async () => {
try {
const data = await client
.index(toValue(dbName))
.search("", {
facets: ["*"],
filter: [],
page: 1,
hitsPerPage: 25,
})
autocompleteMeiliFacetsProps.value.facetDistribution = data?.facetDistribution
} catch (error) {
throw createError("Unable to get list of systems")
}
}) })
...@@ -118,18 +123,19 @@ const columnsToDownload = ref(['title', 'doi', 'Sensor', 'Activator', 'Effector' ...@@ -118,18 +123,19 @@ const columnsToDownload = ref(['title', 'doi', 'Sensor', 'Activator', 'Effector'
<template #[`item.title`]="{ item }"> <template #[`item.title`]="{ item }">
<v-chip color="info" link :to="`/defense-systems/${item.title.toLowerCase()}`">{{ <v-chip color="info" link :to="`/defense-systems/${item.title.toLowerCase()}`">{{
item.title item.title
}}</v-chip> }}</v-chip>
</template> </template>
<template #[`item.doi`]="{ item }"> <template #[`item.doi`]="{ item }">
<ArticleDoi v-if="item?.doi" :doi="item.doi" :abstract="item?.abstract" :divider="false" :enumerate="false" /> <ArticleDoi v-if="item?.doi" :doi="item.doi" :abstract="item?.abstract" :divider="false"
:enumerate="false" />
</template> </template>
<template #[`item.PFAM`]="{ item }"> <template #[`item.PFAM`]="{ item }">
<pfam-chips v-if="item?.PFAM" :pfams="item.PFAM"></pfam-chips> <pfam-chips v-if="item?.PFAM" :pfams="item.PFAM"></pfam-chips>
</template> </template>
<template #[`item.contributors`]="{ item }"> <template #[`item.contributors`]="{ item }">
<CollapsibleChips v-if="item?.contributors" :items="item.contributors.map(it => ({ title: it }))"> <CollapsibleChips v-if="item?.contributors" :items="item.contributors.map(it => ({ title: it })) ">
</CollapsibleChips> </CollapsibleChips>
</template> </template>
</ServerDbTable> </ServerDbTable>
......
...@@ -7,7 +7,7 @@ services: ...@@ -7,7 +7,7 @@ services:
args: args:
BASE_URL: /wiki BASE_URL: /wiki
MEILI_HOST: http://localhost:7700 MEILI_HOST: http://localhost:7700
MEILI_API_KEY: f5f5f1bc48e6379fc2509f5bf0aed1fce96c1bbf86e0a194c605b258d7cfe890 MEILI_API_KEY: 3534db2924c3938bab5fc878906aaf1b83f8f39867891c6d020b05043b04b1ef
HOST_URL: http://localhost:8082 HOST_URL: http://localhost:8082
container_name: nuxt container_name: nuxt
environment: environment:
......