From 1e20c1816b383d1c22db69c16830e42ff20c30cc Mon Sep 17 00:00:00 2001
From: HongKee Moon <moon@mpi-cbg.de>
Date: Tue, 3 May 2022 20:44:34 +0200
Subject: [PATCH] Improved search suggestions

---
 web/src/components/LandingPage.vue | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/web/src/components/LandingPage.vue b/web/src/components/LandingPage.vue
index 82b6985..0a87541 100644
--- a/web/src/components/LandingPage.vue
+++ b/web/src/components/LandingPage.vue
@@ -106,7 +106,7 @@
             <div slot="suggestion-item" slot-scope="{ suggestion }">
               <span v-if="suggestion.type === 'protein'">{{suggestion.gene_name}} ({{suggestion.id}}): {{suggestion.species_name}}</span>
               <span v-else-if="suggestion.type === 'condensate'">{{suggestion.id}}</span>
-              <span v-else-if="suggestion.type === 'search'">Search for <b>{{suggestion.id}}</b></span>
+              <span v-else-if="suggestion.type === 'search'">Search for <b>{{suggestion.id.replace(/\#/g, '')}}</b></span>
             </div>
           </vue-simple-suggest>
         </div>
@@ -265,6 +265,8 @@ export default {
     onSelect(item) {
       if (item.type === 'protein') {
         this.keyword = '(' + item.id + ')';
+      } else if (item.type === 'search') {
+        this.keyword = item.id.replace(/\#/g, '');
       } else {
         this.keyword = item.id;
       }
@@ -330,7 +332,12 @@ export default {
             }
           }), 'id');
 
-          ret.push({id: query, type: 'search'})
+          if (ret.length > 9) {
+            ret.splice(9, 0, {id: '#' + query, type: 'search'})
+          } else {
+            ret.push({id: '#' + query, type: 'search'})
+          }
+
           // console.log(ret);
 
           return ret;
-- 
GitLab