From 38c328781320d15eb35f8ab6d1d3bae8301fade0 Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Fri, 8 Dec 2023 15:29:42 +0100
Subject: [PATCH] fix issue with - in filter + update ms indexes

---
 components/CollapsibleChips.vue                  |  5 +++--
 components/ServerDbTable.vue                     |  2 +-
 components/content/RefseqDb.vue                  |  5 ++++-
 .../df_wiki_cli/meilisearch/__init__.py          | 16 +++++++++++++++-
 4 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/components/CollapsibleChips.vue b/components/CollapsibleChips.vue
index 1ea5ef64..2f7a08ea 100644
--- a/components/CollapsibleChips.vue
+++ b/components/CollapsibleChips.vue
@@ -17,6 +17,7 @@ const props = withDefaults(defineProps<Props>(), {
 
 });
 
+
 const show = ref(false);
 
 
@@ -37,12 +38,12 @@ const show = ref(false);
     </span>
     <span v-else class="d-flex flex-wrap align-center justify-start">
         <template v-for="(item, index) in items" :key="item.title">
-            <v-chip v-if="index < itemsToDisplay || itemsToDisplay < 0" :href="item?.href"
+            <v-chip v-if="index < itemsToDisplay || itemsToDisplay < 0 || items.length - itemsToDisplay === 1"  :href="item?.href"
                 :target="item?.href === undefined ? item?.href : '_blank'" color="info" class="mr-1 my-1 align-self-center"
                 size="small">
                 {{ item.title }}
             </v-chip>
-            <template v-if="index === itemsToDisplay">
+            <template v-if="index === itemsToDisplay && items.length - itemsToDisplay > 1">
                 <v-chip v-if="!show" variant="text" class="text-grey text-caption align-self-center px-1"
                     @click="show = !show">
                     (+{{ items.length - itemsToDisplay }} others)
diff --git a/components/ServerDbTable.vue b/components/ServerDbTable.vue
index 99fa7081..cab71091 100644
--- a/components/ServerDbTable.vue
+++ b/components/ServerDbTable.vue
@@ -173,7 +173,7 @@ watch(filterInputValues, (newSoF) => {
     if (isFilter.value && filterInputValues.value !== null && filterInputValues.value?.length % 3 === 0) {
         msFilter.value = filterInputValues.value.map((it, index) => {
 
-            const sanitizedValue = it.value.split("-")[0]
+            const sanitizedValue = it.value.split("-").slice(0, -1).join("-")
             if (index >= 1 && (index + 1) % 3 === 1) {
                 return ` AND ${sanitizedValue}`
             } else if ((index + 1) % 3 === 0) {
diff --git a/components/content/RefseqDb.vue b/components/content/RefseqDb.vue
index 0d922344..fcf345d0 100644
--- a/components/content/RefseqDb.vue
+++ b/components/content/RefseqDb.vue
@@ -13,7 +13,9 @@ const { width } = useDisplay();
 const distriTool: Ref<string[]> = ref([])
 
 const facets = ref([
+    "replicon",
     "type",
+    "subtype",
     "Superkingdom",
     "phylum",
     "order",
@@ -43,7 +45,8 @@ const headers = ref([
     },
     {
         title: "Accessions",
-        key: "accession_in_sys"
+        key: "accession_in_sys",
+        sortable: false
     }
 ])
 const logTransform = computed(() => {
diff --git a/packages/df-wiki-cli/df_wiki_cli/meilisearch/__init__.py b/packages/df-wiki-cli/df_wiki_cli/meilisearch/__init__.py
index 563be0c4..875a1e6a 100644
--- a/packages/df-wiki-cli/df_wiki_cli/meilisearch/__init__.py
+++ b/packages/df-wiki-cli/df_wiki_cli/meilisearch/__init__.py
@@ -86,6 +86,7 @@ def update_refseq(
     index.update_pagination_settings({"maxTotalHits": 1000000})
     index.update_filterable_attributes(
         body=[
+            "replicon",
             "type",
             "subtype",
             "Superkingdom",
@@ -98,6 +99,7 @@ def update_refseq(
     )
     index.update_sortable_attributes(
         [
+            "replicon",
             "type",
             "subtype",
             "Superkingdom",
@@ -113,7 +115,6 @@ def update_refseq(
         "sortFacetValuesBy": {"*": "count"},
     }
     index.update_faceting_settings(params)
-    print("typo toler")
     index.update_typo_tolerance(
         {
             "enabled": False
@@ -154,12 +155,25 @@ def update_structure(
             "plddts",
         ]
     )
+    params = {
+        "maxValuesPerFacet": 1000000,
+        "sortFacetValuesBy": {"*": "count"},
+    }
+    index.update_faceting_settings(params)
+
     print(attr_task)
     index.update_sortable_attributes(
         [
             "system",
             "completed",
             "plddts",
+            "nb_sys",
+            "completed",
+            "prediction_type",
+            "system_number_of_genes",
+            "iptm+ptm",
+            "pDockQ",
+            "type",
         ]
     )
     index.update_typo_tolerance({"enabled": False})
-- 
GitLab