有没有办法在Algolia索引中显示所有数据作为html中的列表?

问题描述 投票:1回答:1

我想将我的Angolia索引中的所有数据显示为html页面中的列表。我正在使用Firestore镜像Angolia数据库,并且目前它正在运行,因此可以显示我的Firestore数据,但我想从Algolia中提取数据,然后可以过滤它。

饲料

<ais-instantsearch [config] = "searchConfig">

  <ais-search-box (change)="searchChanged($event)"></ais-search-box>

  <ais-hits *ngIf="showResults">

    <ng-template let-hits="hits">

        <div *ngFor="let hit of hits">

          <div>
            {{hit.description}}
          </div>

        </div>


    </ng-template>

  </ais-hits>

</ais-instantsearch>

这就是我在搜索Algolia数据时所做的工作。但我想在页面加载时始终显示我在html中搜索的所有数据。

firebase mobile google-cloud-firestore algolia
1个回答
2
投票

它取决于索引中的记录数。您可以使用参数hitsPerPage控制引擎返回的记录数。您可以使用ais-configure小部件提供此参数。

请注意,默认情况下,hitsPerPage不能超过1000.您可以使用paginationLimitedTo设置增加此限制。您无法从InstantSearch设置此值。它必须是对setSettings的调用或更新Algolia仪表板内的值。

此解决方案适用于InstantSearch,其限制是在索引中包含少量记录。对于某些用例,这不是一个可行的解决方案。您可以选择退出InstantSearch以使用browse方法。它允许您获取索引的完整内容,而不会对记录数量进行任何限制。你可以找到更多信息in the documentation

© www.soinside.com 2019 - 2024. All rights reserved.