stephenLYZ edited a comment on pull request #18662:
URL: https://github.com/apache/superset/pull/18662#issuecomment-1064859564


   @rusackas Thanks for these suggestions! I agree to put this chat label into 
the weighted calculation of Fuse, which I tried but it did not succeed. The 
reason is that fuse calculates the score based on the key 
(https://github.com/krisk/Fuse/blob/master/src/core/computeScore.js), like 
'name' or 'description', but in our scenario, it is based on the value, like 
'verified' or 'feature'.
   
   There is one approach I have in mind is to use: make this label as **key**, 
and value is the same as **name**
   ```javascript
   metadata: {
     name: t('Pie Chart'),
     verified: t('Pie Chart'),
     // or
     featured: t('Pie Chart')
   }
   ```
   So we can define the weights of keys:
   
   ```javascript
   new Fuse(chartMetadata, {
     ignoreLocation: true,
     threshold: 0.3,
     keys: [
       {
         name: 'value.verified',
         weight: 1.1
       },
       {
         name: 'value.featured',
         weight: 0.9
       },
       'value.name',
       'value.tags',
       'value.description'
     ],
   }),
    
   ```
   But this is not flexible. So there is a balance here.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to