【问题标题】:Is there a way to display all data in Algolia index as list in html?有没有办法将 Algolia 索引中的所有数据显示为 html 中的列表?
【发布时间】:2019-04-22 18:13:05
【问题描述】:

我想将我的 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】:

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

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

此解决方案适用于 InstantSearch,但限制为索引中的记录数量很少。对于某些用例,这不是一个可行的解决方案。您可以选择退出 InstantSearch 以使用 browse 方法。它允许您获取索引的全部内容,而对记录数没有任何限制。您可以找到更多信息in the documentation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-12
    相关资源
    最近更新 更多