solr - 奇怪的 Solr 弹簧行为
问题描述
当我使用 Spring 数据构建查询时,它会生成以下查询:
http://localhost:8983/solr/pride_projects/select?q=accession:*PXD*+OR+accession:*PRD*+AND+publication_date:[2012\-12\-31T00\:00\:00.000Z+TO+2012\-12\-31T00\:00\:00.000Z]
这没有给我任何结果。我已手动将 Solr 中的查询更改为:
http://localhost:8983/solr/pride_projects/select?q=accession:*PXD*+OR+accession:*PRD*+publication_date:[2012\-12\-31T00\:00\:00.000Z+TO+2012\-12\-31T00\:00\:00.000Z]
这里的输出:
{
accession: "PXD000002",
project_title: "The human spermatozoa proteome",
project_description: "The human spermatozoa proteome was in depth
characterized using shotgun iterative GeLC-MS/MS method with peptide
exclusion lists.",
project_sample_protocol: "This LC-MS/MS analysis was repeated twice
by digested band using an identified peptide exclusion list,
generated by Proteome Discoverer, from the previous LC-MS/MS runs of
the same sample.",
submission_date: "2012-01-02T00:00:00Z",
删除最后一个AND
,现在查询有效。我希望这两个查询都有类似的行为,但不是。
有任何想法吗?
解决方案
当您删除 AND 要求时,没有理由结果应该相同 - 您的设置的默认行为可能是所有子句都是可选的,除非您明确要求它(通过AND
)。
由于您的publication_date
时间间隔仅匹配一毫秒,因此它不匹配任何文档 - 因此在您的最后一个查询中它被忽略(如果文档匹配,则会影响分数)。
2012-12-31T00:00:00.000Z TO 2012-12-31T00:00:00.000Z
..间隔的开始与间隔的结束相同,但是由于您使用了[
and ]
(这意味着包含该值本身),您将获得与以该毫秒为索引的文档的匹配项。
您可能打算过滤更广泛的范围。
推荐阅读
- matlab - 为 fmincon 算法生成 n 维随机起点 - 空间的均匀分布
- c# - 在 Docker 上运行 .NET 框架控制台应用服务
- javascript - setTimeout 中的词法作用域
- javascript - 在 CKEditor 中使用辅助功能检查器插件时出现错误消息(通过 Firefox)
- docusignapi - IN_PERSON_SIGNING_HOST_MUST_BE_VALID_USER
- python - 带有 `pipenv lock` 和 `pipenv install` 的`TooManyRedirects`
- sql - 如何用在行中间但不在行的倒数第二个位置找到的空格替换字符
- qt - Firebase 日历(多用户)
- python - Tkinter Checkbutton 变量
- android - 溢出菜单布局滞后