0

我有一个 SOLR 架构如下:

<field name="category_id1" type="integer" indexed="false" stored="true" />
<field name="category_id2" type="integer" indexed="false" stored="true" />
<field name="category_id3" type="integer" indexed="false" stored="true" />
<field name="category_ids" type="integer" multiValued="true" indexed="true" stored="true"/>

和一个复制部分:

<copyField source="category_id1" dest="category_ids" />

但是每当我尝试将数据注入 DSE/Cassandra 时,都会出现此错误

InvalidRequestException(why:(Expected 4 or 0 byte int (14)) [diem][business][category_ids] failed validation) me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(why:(Expected 4 or 0 byte int (14)) [diem][business][category_ids] failed validation) Exception in thread "main" me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(why:(Expected 4 or 0 byte int (14)) [diem][business][category_ids] failed validation) at me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl.java:45) at me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:264) at me.prettyprint.cassandra.model.ExecutingKeyspace.doExecuteOperation(ExecutingKeyspace.java:97) at me.prettyprint.cassandra.model.MutatorImpl.execute(MutatorImpl.java:243) at com.diem.db.crud.CassandraStorageManager.insertMultiColumns(CassandraStorageManager.java:197) at com.diem.db.dao.impl.AbstractDaoImpl.saveUUIDEntity(AbstractDaoImpl.java:47) at com.diem.db.dao.impl.BusinessDaoImpl.saveBusiness(BusinessDaoImpl.java:81) at com.diem.data.LoadBusinesses.execute(LoadBusinesses.java:187) at com.diem.data.LoadContent.run(LoadContent.java:121) at com.diem.data.LoadBusinesses.main(LoadBusinesses.java:45) Caused by: InvalidRequestException(why:(Expected 4 or 0 byte int (14)) [diem][business][category_ids] failed validation) at org.apache.cassandra.thrift.Cassandra$batch_mutate_result.read(Cassandra.java:20833) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) at org.apache.cassandra.thrift.Cassandra$Client.recv_batch_mutate(Cassandra.java:964) at org.apache.cassandra.thrift.Cassandra$Client.batch_mutate(Cassandra.java:950) at me.prettyprint.cassandra.model.MutatorImpl$3.execute(MutatorImpl.java:246) at me.prettyprint.cassandra.model.MutatorImpl$3.execute(MutatorImpl.java:243) at me.prettyprint.cassandra.service.Operation.executeAndSetResult(Operation.java:103) at me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:258) ... 8 more

复制到 multiValued solr.IntField (integer) 并不是什么特别的事情,我们可以在使用 DSE/SOLR 之前完成它。但我似乎无法在 DSE/SOLR 组合中完成这项工作。从逻辑上讲,我看不出有什么失败的原因,因为 DSE 不应该干扰对category_ids主要用于索引的字段的操作。有没有人看到这种情况有什么问题?在这种情况下我可以做些什么来防止验证错误(注意:我不能使用文本/字符串类型category_ids)?

谢谢!

4

2 回答 2

0

If I understand it correctly, you are using thrift tables, so you either declare the category_ids column as UTF8Type (the Solr field can be of any type), or you declare the category_ids Solr field as stored=false (in which case the copy field will not be stored, only indexed).

Let us know if any of the two works for you.

于 2014-03-24T17:58:27.747 回答
0

我可以找出问题所在,我的 CF 有一个default_validation_class=BytesType,因此category_ids使用 DSE/Solr 中的 BytesType 验证了 multiValued 字段,这将导致错误。因此,除非我使用 of 的类型将我的 CF 更改为 CQL 声明LIST<int>并且不使用 Hector(至少对于此 CF),否则我将无法使用 Solr 中的文本/字符串字段以外的多值字段。

于 2014-03-24T03:28:51.757 回答