Nesting tuples and UDTs 

Examples of nesting tuples and UDTs in CQL lists and sets.

DSE Search supports queries for nested tuples and UDTs. For example, you can nest and declare tuples and UDTs inside CQL lists and sets. You cannot nest tuples and UDTS inside maps or keys.

Inserting data

Data that is inserted using CQL is automatically recognized by DSE Search and is indexed like any other data. However, data that is inserted by using the HTTP interface requires the tuple/UDT field as a string in its JSON representation. For example:

{"alternativeAddressCollection":"[{\"city\": \"NY\", \"street\": \"sesame1\"}, {\"city\": \"SF\", \"street\": \"sesame2\"}]" , "mainAddress":"{\"street\":\"Sesame\", \"city\":\"Atlanta\"}}

Create a type with the Address tuple

CREATE TYPE Address (street text, city text, residents set<tuple<text, text>>)

Create a table with the Address tuple

CREATE TABLE Location (id text, address Address)

In the Solr schema, declare the TupleField class

UDTs are a specialization of tuples. The TupleField class applies to both UDTs and tuples.
<fieldType class=""

In the Solr schema, declare the TupleField and the nested TupleField

<field name="address" type="TupleField" indexed="true" stored="true"/>
<field name="address.street" type="text" indexed="true" stored="true"/>
<field name="" type="text" indexed="true" stored="true"/>
<field name="address.residents" type="TupleField" indexed="true" stored="true" multiValued=”true”/>
<field name="address.residents.field1" type="text" indexed="true" stored="true"/>
<field name="address.residents.field2" type="text" indexed="true" stored="true"/>

The residents nested tuple is TupleField. Each nested field is concatenated with each parent tuple or UDT by using dots.