You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/03/11 07:50:09 UTC

[GitHub] [superset] stephenLYZ commented on pull request #18662: feat(viz-gallery): add 'feature' tag and fuzzy search weighting

stephenLYZ commented 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.
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org