DocSearch: ranking lvl0 higher, eliminating lvl1 duplicates, and always showing content snippet

Product: DocSearch v3

Issue #1: Can’t change result rank with optionalFilters

I’m trying to rank results from a specific lvl0 higher than others. I tried using optionalFilter as mentioned here, but it doesn’t seem to do anything.

In DocSearch JavaScript it looks like this:

docsearch({
...
  searchParameters: {
    optionalFilters: [
      'hierarchy.lvl0:PROMOTED-LEVEL-HERE',
    ]
  },

I tried testing this in the Algolia index explorer and couldn’t get it to work. It looks like this:

index.search("install", {
...
 "optionalFilters": [
  "hierarchy.lvl0:PROMOTED-LEVEL-HERE"
 ],
});

Assuming I can get this to work, my next question what is the syntax to promote multiple lvl1 values?

Issue #2: How do I group multiple lvl2 results from the same lvl1?

When a search query matches a lvl1 value (page topic for example), then all lvl2 children records (page sub-topics) are returned as separate results, even if their values don’t match. If a search query matches a lvl1 value exactly, then I only want 1 result for the lvl1 match.

Using a generic example, if I search for “Topic1”, this is the result I’m getting (10 results):

Section1
  - Topic1
    - Sub1
    - Sub2
    - Sub3
    - Sub4

Section2
  - Topic1
    - Sub1
    - Sub2
    - Sub3
    - Sub4

I want the result to look like this. The query should match at all levels, but only the relevant level should appear in the results, not all child levels (5 results).

Section1
  - Topic1

Section2
  - Topic1

Section3
  - Diff1
    -  Sub Topic1

Issue #3: How do you force the results to always show the content snippet?