Search code examples
reactivesearch

ReactiveList related searches


I'm trying to figure out how I can ReactiveList to display a related searches feature on the results page. It seems that my es app on appbaseio keeps adding links EVEN after the page has sat idle for a few minutes, NO USER INTERACTION at all.

This is my code for the ReativeList component

<ReactiveList
  componentId="related-searches"
  pages={1}
  size={5}
  stream={false}
  showResultStats={false}
  react={{
    "and": ["SearchSensor"]
  }}
  onData={(res) => <a href="#" className="card-link"><li 
   className="list-inline-item">Link text</li></a>}
  />

I thought that pages, size and stream (and their settings) would stop the streaming (or whatever is causing it)?


Solution

  • You can use the defaultQuery prop on ReactiveList to make it show some default results (or related searches in your case) docs. For example:

    <ReactiveList
      ...
      defaultQuery={() => ({
        match: {
          authors: 'J.K. Rowling'
        }
      })}
    />
    

    Demo