Solr edismax查询语法错误 "Query Field '_text _' is not a valid field name"

标签 solr solr8

我最初在 solr 架构中创建了 3 个复制字段:

curl -X POST -H 'Content-type:application/json' --data-binary '{"add-copy-field": {"source":"company_name","dest":"_text_"}}' http://my-instance/solr/listing/schema
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-copy-field": {"source":"address","dest":"_text_"}}' http://my-instance/solr/listing/schema
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-copy-field": {"source":"city","dest":"_text_"}}' http://my-instance/solr/listing/schema

但是,我最近从架构中删除了它们,现在以稍微不同的格式编写查询。更高级的查询我们需要edismax。

但是,即使打开 edismax,我也会收到来自 solr 查询解析器的错误,如下所示。我删除复制字段是否破坏了某些内容?

/solr/listing/select?debugQuery=on&defType=edismax&q=%3A&stopwords=true

{
"responseHeader": {
"zkConnected": true,
"status": 400,
"QTime": 1,
"params": {
"q": "*:*",
"defType": "edismax",
"debugQuery": "on",
"stopwords": "true"
}
},
"error": {
"metadata": [
"error-class",
"org.apache.solr.common.SolrException",
"root-error-class",
"org.apache.solr.common.SolrException"
],
"msg": "org.apache.solr.search.SyntaxError: Query Field '_text_' is not a valid field name",
"code": 400
}
}

根据评论,“文本”字段保留在配置中的 3 个位置:

"/update/extract":{
    "startup":"lazy",
    "name":"/update/extract",
    "class":"solr.extraction.ExtractingRequestHandler",
    "defaults":{
      "lowernames":"true",
      "fmap.content":"_text_"}}


"spellchecker":{
      "name":"default",
      "field":"_text_",


"initParams":[{
    "path":"/update/**,/query,/select,/tvrh,/elevate,/spell,/browse",
    "defaults":{"df":"_text_"}}]

最佳答案

根据对我的问题的评论(我仍在 solr 的学习道路上):

Although they have been deprecated for quite some time, Solr still has support for Schema based configuration of a <defaultSearchField/> (which is superseded by the df parameter) and <solrQueryParser defaultOperator="OR"/> (which is superseded by the q.op parameter.

If you have these options specified in your Schema, you are strongly encouraged to replace them with request parameters (or request parameter defaults) as support for them may be removed from future Solr release.

出于我们的目的,当我们使用 edismax 查询解析器时,我们需要指定我们想要使用的查询字段。

关于Solr edismax查询语法错误 "Query Field '_text _' is not a valid field name",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59044345/

相关文章:

solr - 加载到 solr 时出现 Nutch 消息 "No IndexWriters activated"

solr - 本地参数在 solr 8 中不起作用,但在 solr 5 中起作用

docker - Docker Hub私有(private)存储库:无法在私有(private)存储库中推送Solr Core文件

Solr 嵌套文档未正确设置

apache - Solr 4 - 缺少必填字段 : uuid

java - Solr 8.1启动错误-maxBooleanClauses

solr - 是否可以在不从原始源重新索引的情况下更改 Solr 中模式中指定的分析器?

java - 如何在 Lucene 文本字段上进行精确匹配和部分匹配?