Skip to content
Snippets Groups Projects
Commit dc127ba8 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Remove bugs

parent 3cc7100c
No related branches found
No related tags found
2 merge requests!131Merge relevant Abstract and references,!123Resolve "Wizzard to create db filters"
Pipeline #116851 failed
This commit is part of merge request !123. Comments created here will be created in the context of that merge request.
...@@ -68,44 +68,30 @@ const msSortBy = computed(() => { ...@@ -68,44 +68,30 @@ const msSortBy = computed(() => {
}) })
const msFilter = computed(() => { const msFilter = computed(() => {
if (Array.isArray(filterOrSearch.value)) { if (isFilter.value) {
return filterOrSearch.value.map((it, index) => { return filterOrSearch.value.map((it, index) => {
console.log(index, ' ', it) console.log(index, ' ', it)
if (index >= 1 && (index + 1) % 3 === 1) { if (index >= 1 && (index + 1) % 3 === 1) {
console.log("should add AND") console.log("should add AND")
return ` AND ${it.value}` return ` AND ${it.value}`
} else { return it.value } } else if ((index + 1) % 3 === 0) {
return `"${it.value}"`
} else {
return `${it.value}`
}
}).join("") }).join("")
} }
else { return "" } else { return "" }
}) })
const isFilter = computed(() => {
return Array.isArray(filterOrSearch.value)
})
onMounted(async () => { onMounted(async () => {
console.log("on mounted")
searchOrFilter() searchOrFilter()
// const {
// hits,
// pending: p,
// totalHits,
// filterError: fe,
// facetDistribution: fd }
// = await useFetchMsDocument(
// "refseq",
// search,
// filter,
// limit,
// hitsPerPage,
// page,
// facetsRef,
// msSortBy
// )
// console.log("get the hits")
// console.log(hits)
// // console.log([...toValue(hits)])
// items.value = toValue(hits)
// itemsLength.value = toValue(totalHits)
// facetDistribution.value = toValue(fd)
// filterError.value = toValue(fe)
// pending.value = toValue(p)
}) })
// Fetch results // Fetch results
...@@ -141,14 +127,24 @@ async function searchOrFilter() { ...@@ -141,14 +127,24 @@ async function searchOrFilter() {
} }
} }
watch(filterOrSearch, (fos) => {
function clearFilterOrSearch() {
filterOrSearch.value = null
console.log("clear")
searchOrFilter()
}
watch(filterOrSearch, (fos) => {
console.log(fos)
if (Array.isArray(fos) && fos?.length % 3 === 0) { if (Array.isArray(fos) && fos?.length % 3 === 0) {
searchOrFilter() searchOrFilter()
search.value = ''
} }
else { console.log("do not search") } else { console.log("do not search") }
}) })
watch(page, () => { watch(page, () => {
console.log("page")
searchOrFilter() searchOrFilter()
}) })
...@@ -199,6 +195,17 @@ const computedItems = computed(() => { ...@@ -199,6 +195,17 @@ const computedItems = computed(() => {
function selectItem(item) { function selectItem(item) {
filterOrSearch.value = Array.isArray(filterOrSearch.value) ? [...filterOrSearch.value, item] : [item] filterOrSearch.value = Array.isArray(filterOrSearch.value) ? [...filterOrSearch.value, item] : [item]
} }
function deleteOneFilter(index) {
if (isFilter.value) {
filterOrSearch.value?.splice(index - 2, 2)
}
}
function clearSearch() {
console.log("clear search")
search.value = ""
}
const autocompleteElem = ref() const autocompleteElem = ref()
</script> </script>
<template> <template>
...@@ -207,12 +214,17 @@ const autocompleteElem = ref() ...@@ -207,12 +214,17 @@ const autocompleteElem = ref()
<!-- <v-toolbar-title> <!-- <v-toolbar-title>
{{ title }} ({{ itemsLength }}) {{ title }} ({{ itemsLength }})
</v-toolbar-title> --> </v-toolbar-title> -->
<v-autocomplete v-model:search="search" v-model:model-value="filterOrSearch" chips clearable <v-autocomplete v-model:search="search" v-model:model-value="filterOrSearch" auto-select-first chips clearable
label="Search or filter results..." :items="computedItems" item-value="value" item-title="title" multiple label="Search or filter results..." :items="computedItems" item-value="value" item-title="title" multiple
return-object append-inner-icon="md:search" @click:appendInner="searchOrFilter" return-object append-inner-icon="md:search" @click:appendInner="searchOrFilter"
@click:clear="filterOrSearch = []"> @click:clear="clearFilterOrSearch" @update:modelValue="() => clearSearch()">
<template #chip="{ props, item }"> <template #chip="{ props, item, index }">
<v-chip v-bind="props" :text="item.raw.title"></v-chip>
<v-chip v-if="(index + 1) % 3 === 0" v-bind="props" :text="item.raw.title" closable
@click:close="deleteOneFilter(index)"></v-chip>
<v-chip v-else v-bind="props" :text="item.raw.title"></v-chip>
</template> </template>
<template #item="{ props, item }"> <template #item="{ props, item }">
<!-- <pre>{{ props["v-on"] }}</pre> --> <!-- <pre>{{ props["v-on"] }}</pre> -->
......
...@@ -108,6 +108,11 @@ def update_refseq( ...@@ -108,6 +108,11 @@ def update_refseq(
"species", "species",
] ]
) )
params = {
"maxValuesPerFacet": 1000000,
"sortFacetValuesBy": {"*": "count"},
}
index.update_faceting_settings(params)
def update_structure( def update_structure(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment