datastax 4.7 在自动分页关闭的情况下,C# 驱动程序中不允许使用“start”参数

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

我正在使用 datastax 4.7,cassandra c# 驱动程序 2.5

我需要进行分页查询。

在 cqlsh 中,当我运行时

paging off;
then:
select * from tbl where solr_query='{"q":"*:*","start":0,"sort":"id asc"}' ;

查询已成功执行。

但是当使用 C# 驱动程序在代码中运行相同的查询时。引发以下异常:

You have driver paging active which also activates Solr deep pagination. The 'start' parameter is not allowed. Please either deactivate paging or read about Solr deep paging restrictions and fix accordingly

我用来运行查询的代码:

        ILoadBalancingPolicy ploicy = new DCAwareRoundRobinPolicy(_dc);
            RowSet ret = null;
            Statement st = new SimpleStatement(cql);
            try
            {
                ret = _currentSession.Execute(st.SetAutoPage(false).SetPageSize(pageSize));
            }
            catch
            {
            }
pagination datastax cqlsh
1个回答
0
投票

在 solr 中,有两种类型的搜索: 1-搜索分页,这种类型会导致性能和服务器负载问题“深度分页问题”。在这种类型的搜索中,您要求 solr 返回从特定索引开始并具有特定页面大小的结果集。 Solr 扫描从索引为 0 的文档到您提供的起始索引中的文档的所有结果文档。因此,如果您提供了一个大的起始索引,内存可能会崩溃。

2- 搜索光标,在这种类型中,您应该提供 solr 中的“cursorMark”或 Datastax 中的“pageState”和页面大小。 Solr 从第一页开始按顺序逐页返回页面。在每个页面请求中,Solr 提供下一页的光标标记或页面状态。您应该在您处理的页面请求中提供光标标记。

  • st.SetAutoPage(false) 禁用分页搜索并启用光标搜索。因此,您不能在 solr_query 中提供“start”参数。
© www.soinside.com 2019 - 2024. All rights reserved.