dse cassandra solr doesnt return _uniqueKey in response

110 views Asked by At

Im using Datastax 4.6. My solr client queries data by using _uniqueKey. From version 4.6 the limitation about using simple primary key is removed. How can i configure solr or create table in cassandra, so that I receive in solr response information about synthetic key _uniqueKey. There is no problem when i use compound keys, only with simple.

DROP TABLE IF EXISTS unitable;
CREATE TABLE IF NOT EXISTS unitable (
    "depId" INT PRIMARY KEY,
    "parentId" INT,
    "name" text
);

INSERT INTO unitable ( "depId", "parentId", "name" ) VALUES ( 689, 2, 'test' );

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<schema name="autoSolrSchema" version="1.5">
<types>
<fieldType class="org.apache.solr.schema.TrieIntField" name="TrieIntField"/>
<fieldType class="org.apache.solr.schema.TextField" name="TextField">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
</types>
<fields>
<field indexed="true" multiValued="false" name="depId" stored="true" type="TrieIntField"/>
<field indexed="true" multiValued="false" name="name" stored="true" type="TextField"/>
<field indexed="true" multiValued="false" name="parentId" stored="true" type="TrieIntField"/>
</fields>
<uniqueKey>depId</uniqueKey>
</schema>

no _uniqueKey in response

<response>

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">5</int>
</lst>
<result name="response" numFound="1" start="0" maxScore="1.0">
  <doc>
    <int name="depId">689</int>
    <str name="name">test</str>
    <int name="parentId">2</int></doc>
</result>
</response>
1

There are 1 answers

0
sbtourist On BEST ANSWER

The synthetic _uniqueKey field is generated and returned only when using compound keys; in case of simple keys, the key field is directly used.