同一请求中的多个排序需求

发布于 2024-10-08 15:04:14 字数 224 浏览 0 评论 0原文

我对 solr 的可能性有疑问。我需要提出一个有特殊问题的请求:

我首先需要:包含用户输入的所有术语的升级记录(随机排序)。 第二:使用用户输入的任何术语提升记录(随机排序)。 第三:词干搜索找到的升级记录(随机排序)。 第四:通过拼音搜索找到的提升记录(随机)。 第五:按字母顺序排序的免费记录(具有用户输入的所有或任何术语)。

这些结果需要分页。

是否可以在同一个请求中执行此操作?

i have a doubt about solr possibilities. i need to do a request with special issues:

i need first: promoted records with all the terms typed by the user (ordered randomly).
second: promoted records with any term typed by the user (ordered randomly).
third: promoted records found by the stemming search (ordered randomly).
fourth: promoted records found by the phonetic search (randomly).
fifth: free records ordered alphabeticly (having all or any term typed by the user).

these results need to be paginated.

is it possible to do it in the same request?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

阪姬 2024-10-15 15:04:15

在发现 solr 通过以下方式支持随机排序之后:

<fieldType name="random" class="solr.RandomSortField" />
<field name="random" type="random" indexed="true" stored="false"/>

这些查询将是可能的,但不能在一个查询中

虽然可以使用facet和facet.query功能,但这仅返回计数...而不返回文档。

我会设置一个单独的广告索引,而不是使用 海拔组件 实现“广告”的正常方式

包含用户输入的所有术语的升级记录(随机排序)

针对广告索引的简单 AND 查询

包含用户输入的任何术语的升级记录(随机排序)

针对广告索引的简单 OR 查询

通过词干搜索找到的升级记录(随机排序)。

广告索引中的正常搜索(带词干)。

通过拼音搜索找到的升级记录(随机)。

您需要通过自己的语音转换来转换查询和术语才能做到这一点。所以你将有一个特殊的字段phonetic_text,你需要通过

q=phonetic_text:"UR G8" 查询它(这意味着:你很棒;-))

免费记录按字母顺序排序(包含用户输入的所有或任何术语)。

再次通过“AND”或“OR”与排序参数进行正常搜索

After finding out that random ordering is support in solr via:

<fieldType name="random" class="solr.RandomSortField" />
<field name="random" type="random" indexed="true" stored="false"/>

those queries will be possible but NOT in one query

Although one could use the facet and facet.query feature, but this only returns the count ... not the docs.

I would setup a separate advertising index instead of the normal way to implement 'advertising' with the elevation component

promoted records with all the terms typed by the user (ordered randomly)

a simple AND query against the advertising index

promoted records with any term typed by the user (ordered randomly)

a simple OR query against the advertising index

promoted records found by the stemming search (ordered randomly).

normal search (with stemming) in the advertisment index.

promoted records found by the phonetic search (randomly).

you'll need to transform the query and the terms via your own phonetic transformation to do that. so you'll have a special field phonetic_text and you'll need to query this via

q=phonetic_text:"U R G8" (which means: you are great ;-))

free records ordered alphabeticly (having all or any term typed by the user).

again normal search via "AND" or "OR" with the sort parameter

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文