Wednesday, 15 September 2010

solr4 - Solr index values of Cassandra Map type -



solr4 - Solr index values of Cassandra Map type -

i have cassandra table contains map type. want create solr index allow me search values in map (ignoring keys). have been successful @ doing set type , hoping there way same thing map.

here example.

create table company (id text primary key, name text, user_phones map<text,text>);

insert company (id, name, user_phones) values ('1', 'joes construction', {'userid_52':'1-333-444-5555', 'userid_17':'1-333-222-4444'});

insert company (id, name, user_phones) values ('5', 'marks auto', {'userid_7':'1-333-123-4567'});

i want utilize solr index find companies given phone number -- "user_phones:1333*"

unfortunately have not found allow me this. have read page - mapping of solr types , page - using dynamic fields. sec page talks using dynamicfields forcefulness me know keys in map , in case keys unique. if had way extract values of map , re-create them field it. unfortunately have not figured out how this.

is there way search values of cassandra map in solr?

i using cassandra 2, solr 4, datastax 4.

you can go 2 approaches:

1) seek transformer in dataconfig.xml

< entity name="entity" transformer="regextransformer" query="........> < field column="user_phones" splitby="}" /> < /entity>

now can search " user_phones: * 1333 * " bring expected output. :)

2) please seek <script>..... </script> in dataconfig.xml.

cassandra integration solr. here

solr4 cassandra-2.0 datastax

No comments:

Post a Comment