solr required field: id

2019-03-27 01:02|来源: 网路

为了和以前的程序兼容,在solr建立索引的时候,将id设为gid,结果在建立索引时候出现如下错误:

org.apache.solr.common.SolrException: Document [null] missing required field: id

....

原来solr中每个文档都必须有主键,而且默认主键名称为id。

在schema.xml的fields 后有:

<uniqueKey>id</uniqueKey>


转自:http://www.cnblogs.com/wycg1984/archive/2009/09/16/1567543

相关问答

更多
  • 出于某种原因,Solr不喜欢字段名称上的“Id”后缀。 当我将“documentId”重命名为“document”时,我没有任何错误。 它在“testId”上也失败了,但是当我改名为“test”时工作。 有谁知道为什么“ID”字段名称后缀会导致solr始终报告缺少必填字段,即使传递一个值? For some reason, Solr doesn't like the "Id" suffix on field names. When I rename "documentId" to "document", I ...
  • Solr中的int字段是A numeric field that can contain 32-bit signed two's complement integer values 。 Min Value Allowed: -2147483648 Max Value Allowed: 2147483647 使用Long是A numeric field that can contain 64-bit signed two's complement integer values 。 Min Value All ...
  • 独特的领域只需要是独一无二的。 它可以是String,int,float(虽然我不建议,因为浮点数相当不精确)或任何其他不同的值。 使用数据库中的ID是一个很好的解决方案,因为它允许您轻松地将数据库中的行与Solr中的文档进行匹配。 字段前缀在这个意义上不是真正的前缀,它们只是动态字段 - 这意味着您在索引之前不会在模式中定义字段结构,您只需假设使用以i_开头的字段名称索引的所有内容都是整数。 如果您知道要编制索引的字段,我将继续为每个字段定义字段和行为。 您也可以同时执行这两种操作,拥有一些捕获未定义字段 ...
  • 必填字段必须标记为已建立索引或已存储。 您可以删除这两个字段的必需属性,并将索引和存储为false。 由于文本字段只能搜索,因此您可以将字段类型设置为普通字符串,而不对其他字段进行任何分析。 Required Field must be marked as indexed or stored. You can remove the required attribute for both the fields and have both the indexed and stored as false. As ...
  • 我个人会给用户带来负担,因为他们很容易为每个文档添加一个字段。 否则,你必须编写几行代码。 您可以编写自己的UpdateRequestProcessorFactory ,它会根据其他现有字段的值自动将新字段添加到每个输入文档。 您可以使用分隔符并保持单值。 在UpdateRequestProcessor您应该覆盖processAdd方法,如下所示: @Override public void processAdd(AddUpdateCommand cmd) throws IOException { ...
  • 不,正如它在错误日志中明确指出的那样,com.microsoft.sqlserver.jdbc.SQLServerDriver缺少JDBC驱动程序jar文件。这是由供应商提供的,在本例中是microsfot sqlserver。 您需要使其可用于运行solr实例的容器。 如果您正在使用tomcat将其复制到tomcat_home \ lib目录中。 您将在sql server安装中找到jar文件或询问您的sql server admin。 No, as it clearly says in the erro ...
  • 您必须使用keywordTokenizerFactory定义新的字段类型。 Guide about tokenizer can be found from 这里 Guide about tokenizer can be found from 按照以下方式更新您的架构。 在schema.xml文件中
  • 我自己找到了解决方案: 我正在使用Solr(schema.xml)的默认字段配置。 此配置默认包含字段title和description : 默认情况下, title是一个mu ...
  • 我试图用schema.xml创建一个Solr核心并且工作得很好。 我已经创建了一个github项目,只是尝试克隆它 git clone https://github.com/freedev/mailstore 并从此邮件存储配置创建新核心。 bin/solr create -c mailstore -d /path/to/github/mailstore/conf I've tried to create a Solr core with your schema.xml and works pret ...
  • 理查德回答说, _group有一个_group字段。 如果您希望将其自动转换为ID对象,您可以使用: [TypeConverter(typeof (IndexFieldIDValueConverter))] [IndexField("_group")] public virtual ID ItemId { get; set; } 请记住,如果您有多个版本或语言版本, _group字段将不够,因为将有多个具有相同_group (id)的文档。 在这种情况下,您可能想要使用UniqueId - 它包含有关id ...