知识点
相关文章
更多最近更新
更多solr4.0 id 自动生成
2019-03-27 01:20|来源: 网路
一、配置schema.xml文件
1、添加fieldType
<types> <!-- other field types --> <fieldType name="uuid" class="solr.UUIDField" indexed="true" /></types>
2、添加主键id字段配置(注释或者删除原来的id字段配置,切记)
<field name="id" type="uuid" indexed="true" stored="true" required="true" multiValued="false" />
二、配置solrconfig.xml文件
1、注释掉以下的配置,原因及可能产出的异常参考:https://issues.apache.org/jira/browse/SOLR-3398
<searchComponent name="elevator" class="solr.QueryElevationComponent" > <str name="queryFieldType">string</str> <str name="config-file">elevate.xml</str> </searchComponent>
2、添加一个updateRequestProcessorChain配置
<updateRequestProcessorChain name="uuid"> <processor class="solr.UUIDUpdateProcessorFactory"> <str name="fieldName">id</str> </processor> <processor class="solr.RunUpdateProcessorFactory" /></updateRequestProcessorChain>
3、修改其中一个requestHandler配置,注意:上一步是添加,而这里是修改,如果直接添加的话,那么就会重复配置,这样后面的配置会覆盖前面的配置,本人就是很不幸的被默认的配置覆盖了我添加的配置,当时够郁闷的!
<requestHandler name="/update" class="solr.UpdateRequestHandler"> <!-- See below for information>
转自:http://my.oschina.net/u/175660/blog/111081
相关问答
更多-
INSERT INTO MyTable (MyTableId) VALUES (Null)隐式地尝试在标识列中插入一个空值,所以这将不起作用,因为标识列可能永远不可空,且没有SET选项,您无法插入任意值,您可以使用: INSERT INTO MyTable DEFAULT VALUES INSERT INTO MyTable (MyTableId) VALUES (Null) implicitly tries to insert a null into the identity column, so th ...
-
使用内置数据类型serial或bigserial 。 create table users ( id serial primary key, name varchar(100) not null unique -- ? ); 命名列; 省略serial或bigserial列的名称。 insert into users (name) values ('usr4'); 一般规则是您必须为INSERT语句中使用的每个列提供一个值。 如果未指定列名,则必须为每列提供一个值,包括“Id”,并且必须按列中显 ...
-
通常,如果仅指定过滤器查询( fq ),则不会返回任何结果。 (更准确地说,如果未指定q参数,则默认为“匹配无文档”查询。) 将q参数设置为[* TO *]匹配默认字段中的所有值(现在看起来*将执行相同的操作),因此您应该返回相同的结果集,但不一定是相同的顺序,如果您将第二个查询修改为: http://localhost:8983/solr/collection1/select?fq={!join+from=id+to=manu_id_s+cache=false}id:*&q=[*+TO+*] fq不会影 ...
-
尝试这个