algolia / npm-search

🗿 npm ↔️ Algolia replication tool :skier: :snail: :artificial_satellite:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add filterable library-specific subsets in a future-proof way

Haroenv opened this issue · comments

const packageDetail = {
  ...otherKeys,
  subset: {
    babel: "6",
    "angular-cli": "/path-to/scaffold"
    "gatsby": "component"
  }
}

Now I should still check how we can easily make it facetable, I'm not sure if putting it like this will allow that. An idea I had to solve that was this:

const packageDetail = {
  ...otherKeys,
  subset: {
    "keys": ["babel", "angular-cli", "gatsby"],
    babel: "6",
    "angular-cli": "/path-to/scaffold"
    "gatsby": "component"
  }
}

In this case only the subset.keys would be facetable, but it would mean that we can't use the name keys for any of the subsets (seems fine for me).

To be clear, this is to prevent the status quo of overloading keywords with this info.

For example: babel wants to have all packages with a specific type of name, angular wants those with package.json#scaffold, Gatsby wants specific keywords/names.

This will allow the extra information they want, be it a string or an object, to be in line with what the data is used for.

  const packageDetail = {
    ...otherKeys,
-   keywords: [...originalKeywords, ?babelKeyword, ?gatsbyKeyword ...],
+   subset: {
+     "keys": ["babel", "angular-cli", "gatsby"],
+     babel: "6",
+     "angular-cli": "/path-to/scaffold"
+     "gatsby": "component",
+   },
}