You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Joseph Tech <ja...@gmail.com> on 2016/01/13 14:50:57 UTC

Cassandra DSE Solr - search JSON content in column

Hi,

Is it possible in DSE Cassandra Solr to search for JSON content within a
column?
We store a complex JSON in a column of type "text", very simplified version
below.

{
"userId": "user100",
"addressList": [{
"addressId": "100",
"address": "100 ABC Street"
}],
"userName": "user11"
}

In this, can search return all records that have address="100 ABC Street" ?

Thanks,
Joseph

Re: Cassandra DSE Solr - search JSON content in column

Posted by Joseph Tech <ja...@gmail.com>.
Hi Jack,

I didnt exactly understand your suggestion. Could you please share an
example?

Thanks,
Joseph

On Thu, Jan 14, 2016 at 10:21 AM, Jack Krupansky <ja...@gmail.com>
wrote:

> For a nested object you can just concatenate the sequence of names with
> dots or some other separator and use that for each leaf value of the nested
> tree.
>
> -- Jack Krupansky
>
> On Wed, Jan 13, 2016 at 11:40 PM, Joseph Tech <ja...@gmail.com>
> wrote:
>
>> Thanks, Field Transformers is exactly what i was looking for. Mine is a
>> somewhat nested object, so will need to see how complex the transformer
>> would get, and if it would become a maintenance hassle later on; will try
>> this out and share feedback.
>>
>> -Joseph
>>
>> On Wed, Jan 13, 2016 at 8:31 PM, Russell Bradberry <rb...@gmail.com>
>> wrote:
>>
>>> You can use the full text wildcard search as mentioned. However, if you
>>> need something more specific like certain fields in the JSON indexed, you
>>> can use DSE SOLR field transformers.
>>> http://www.datastax.com/dev/blog/dse-field-transformers
>>>
>>> From: DuyHai Doan <do...@gmail.com>
>>> Reply-To: <us...@cassandra.apache.org>
>>> Date: Wednesday, January 13, 2016 at 9:10 AM
>>> To: <us...@cassandra.apache.org>
>>> Subject: Re: Cassandra DSE Solr - search JSON content in column
>>>
>>> Try
>>>
>>> SELECT * FROM your_table WHERE solr_query='json:"*100 ABC Street*"';
>>>
>>> Warning: since you're storing in JSON format, searching data inside a
>>> JSON is equivalent to a wildcard seach *xxx* and it is quite expensive,
>>> even for full text search engines like Solr
>>>
>>> On Wed, Jan 13, 2016 at 2:50 PM, Joseph Tech <ja...@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Is it possible in DSE Cassandra Solr to search for JSON content within
>>>> a column?
>>>> We store a complex JSON in a column of type "text", very simplified
>>>> version below.
>>>>
>>>> {
>>>> "userId": "user100",
>>>> "addressList": [{
>>>> "addressId": "100",
>>>> "address": "100 ABC Street"
>>>> }],
>>>> "userName": "user11"
>>>> }
>>>>
>>>> In this, can search return all records that have address="100 ABC
>>>> Street" ?
>>>>
>>>> Thanks,
>>>> Joseph
>>>>
>>>>
>>>
>>
>

Re: Cassandra DSE Solr - search JSON content in column

Posted by Jack Krupansky <ja...@gmail.com>.
For a nested object you can just concatenate the sequence of names with
dots or some other separator and use that for each leaf value of the nested
tree.

-- Jack Krupansky

On Wed, Jan 13, 2016 at 11:40 PM, Joseph Tech <ja...@gmail.com> wrote:

> Thanks, Field Transformers is exactly what i was looking for. Mine is a
> somewhat nested object, so will need to see how complex the transformer
> would get, and if it would become a maintenance hassle later on; will try
> this out and share feedback.
>
> -Joseph
>
> On Wed, Jan 13, 2016 at 8:31 PM, Russell Bradberry <rb...@gmail.com>
> wrote:
>
>> You can use the full text wildcard search as mentioned. However, if you
>> need something more specific like certain fields in the JSON indexed, you
>> can use DSE SOLR field transformers.
>> http://www.datastax.com/dev/blog/dse-field-transformers
>>
>> From: DuyHai Doan <do...@gmail.com>
>> Reply-To: <us...@cassandra.apache.org>
>> Date: Wednesday, January 13, 2016 at 9:10 AM
>> To: <us...@cassandra.apache.org>
>> Subject: Re: Cassandra DSE Solr - search JSON content in column
>>
>> Try
>>
>> SELECT * FROM your_table WHERE solr_query='json:"*100 ABC Street*"';
>>
>> Warning: since you're storing in JSON format, searching data inside a
>> JSON is equivalent to a wildcard seach *xxx* and it is quite expensive,
>> even for full text search engines like Solr
>>
>> On Wed, Jan 13, 2016 at 2:50 PM, Joseph Tech <ja...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> Is it possible in DSE Cassandra Solr to search for JSON content within a
>>> column?
>>> We store a complex JSON in a column of type "text", very simplified
>>> version below.
>>>
>>> {
>>> "userId": "user100",
>>> "addressList": [{
>>> "addressId": "100",
>>> "address": "100 ABC Street"
>>> }],
>>> "userName": "user11"
>>> }
>>>
>>> In this, can search return all records that have address="100 ABC
>>> Street" ?
>>>
>>> Thanks,
>>> Joseph
>>>
>>>
>>
>

Re: Cassandra DSE Solr - search JSON content in column

Posted by Joseph Tech <ja...@gmail.com>.
Thanks, Field Transformers is exactly what i was looking for. Mine is a
somewhat nested object, so will need to see how complex the transformer
would get, and if it would become a maintenance hassle later on; will try
this out and share feedback.

-Joseph

On Wed, Jan 13, 2016 at 8:31 PM, Russell Bradberry <rb...@gmail.com>
wrote:

> You can use the full text wildcard search as mentioned. However, if you
> need something more specific like certain fields in the JSON indexed, you
> can use DSE SOLR field transformers.
> http://www.datastax.com/dev/blog/dse-field-transformers
>
> From: DuyHai Doan <do...@gmail.com>
> Reply-To: <us...@cassandra.apache.org>
> Date: Wednesday, January 13, 2016 at 9:10 AM
> To: <us...@cassandra.apache.org>
> Subject: Re: Cassandra DSE Solr - search JSON content in column
>
> Try
>
> SELECT * FROM your_table WHERE solr_query='json:"*100 ABC Street*"';
>
> Warning: since you're storing in JSON format, searching data inside a JSON
> is equivalent to a wildcard seach *xxx* and it is quite expensive, even for
> full text search engines like Solr
>
> On Wed, Jan 13, 2016 at 2:50 PM, Joseph Tech <ja...@gmail.com>
> wrote:
>
>> Hi,
>>
>> Is it possible in DSE Cassandra Solr to search for JSON content within a
>> column?
>> We store a complex JSON in a column of type "text", very simplified
>> version below.
>>
>> {
>> "userId": "user100",
>> "addressList": [{
>> "addressId": "100",
>> "address": "100 ABC Street"
>> }],
>> "userName": "user11"
>> }
>>
>> In this, can search return all records that have address="100 ABC Street"
>> ?
>>
>> Thanks,
>> Joseph
>>
>>
>

Re: Cassandra DSE Solr - search JSON content in column

Posted by Russell Bradberry <rb...@gmail.com>.
You can use the full text wildcard search as mentioned. However, if you need something more specific like certain fields in the JSON indexed, you can use DSE SOLR field transformers.  http://www.datastax.com/dev/blog/dse-field-transformers

From:  DuyHai Doan <do...@gmail.com>
Reply-To:  <us...@cassandra.apache.org>
Date:  Wednesday, January 13, 2016 at 9:10 AM
To:  <us...@cassandra.apache.org>
Subject:  Re: Cassandra DSE Solr - search JSON content in column

Try

SELECT * FROM your_table WHERE solr_query='json:"*100 ABC Street*"'; 

Warning: since you're storing in JSON format, searching data inside a JSON is equivalent to a wildcard seach *xxx* and it is quite expensive, even for full text search engines like Solr

On Wed, Jan 13, 2016 at 2:50 PM, Joseph Tech <ja...@gmail.com> wrote:
Hi,

Is it possible in DSE Cassandra Solr to search for JSON content within a column? 
We store a complex JSON in a column of type "text", very simplified version below.

{
"userId": "user100",
"addressList": [{
"addressId": "100",
"address": "100 ABC Street"
}],
"userName": "user11"
}

In this, can search return all records that have address="100 ABC Street" ? 

Thanks,
Joseph




Re: Cassandra DSE Solr - search JSON content in column

Posted by DuyHai Doan <do...@gmail.com>.
Try

SELECT * FROM your_table WHERE solr_query='json:"*100 ABC Street*"';

Warning: since you're storing in JSON format, searching data inside a JSON
is equivalent to a wildcard seach *xxx* and it is quite expensive, even for
full text search engines like Solr

On Wed, Jan 13, 2016 at 2:50 PM, Joseph Tech <ja...@gmail.com> wrote:

> Hi,
>
> Is it possible in DSE Cassandra Solr to search for JSON content within a
> column?
> We store a complex JSON in a column of type "text", very simplified
> version below.
>
> {
> "userId": "user100",
> "addressList": [{
> "addressId": "100",
> "address": "100 ABC Street"
> }],
> "userName": "user11"
> }
>
> In this, can search return all records that have address="100 ABC Street"
> ?
>
> Thanks,
> Joseph
>
>