fergiemcdowall / search-index

A persistent, network resilient, full text search library for the browser and Node.js
MIT License
1.38k stars 149 forks source link

Avoid result with 0 count on FACET #581

Closed camillo777 closed 2 years ago

camillo777 commented 2 years ago

Hello, is it possible to avoid search-index to return FACETS with count = 0 (array "_id" is empty)? It seems a waste of resources to me.

For example:

{
    FIELD: 'from',
    VALUE: '0x06a20913e78e0263f20b2591684546d50aa21a48',
    _id: []
  },
  {
    FIELD: 'from',
    VALUE: '0x126438c3a64da4ef5a8dde07366270367310f855',
    _id: []
  },
  {
    FIELD: 'from',
    VALUE: '0x1427a7e266087a3675ed54db8029eaf23eecd962',
    _id: [
      '0x6a640d0ec9e08573f44e5ffda67068cc4cd7ce3fa2c13bc30d702617bf02767c_456',
      '0x6a640d0ec9e08573f44e5ffda67068cc4cd7ce3fa2c13bc30d702617bf02767c_459',
      '0xcf2caa2f30735bfb8657ae48bacf087d6c98ff8dd3e877cabe62e269b9d77f88_25',
      '0xcf2caa2f30735bfb8657ae48bacf087d6c98ff8dd3e877cabe62e269b9d77f88_28'
    ]
  },

Thank you Camillo

fergiemcdowall commented 2 years ago

No, thats not possible. I made a concious decision to include 0-hit facets. You can of course filter them out if required 🙂