Reputation: 279
I am using HBase as big data store for real-time access of individual record(s) and Solr for searching data stored in HBase.
I want to add versions to a column of HBase table so that it can also hold previous values. For example, I set parameter VERSIONS => 5 for column cust_info:address so as to keep last five addresses of customer.
I have created an equivalent field in schema.xml file of Solr collection as shown,
<field name="address" type="text_general" indexed="true" stored="true" multiValued="true"/>
When I search for a record in Solr, it shows only latest updated value of address. I want to do searching in all five addresses of customers.
How can I index and store this multi-version column of table in corresponding Solr field?
Upvotes: 0
Views: 521
Reputation: 279
I have found an alternative stratey for doing same thing with HBase and solr. Instead of adding versions to a column cust_info:address, add multiple columns in Hbase as required. Since HBase is schema-free, you can add as many columns as you want in a column-family. Add columns cust_info:addr1, cust_info:addr2, cust_info:addr3, cust_info:addr4, cust_info:addr5 to insert five addresses if they exist.
In Solr, create a dynamic field in schema.xml file, as shown
<dynamicField name="addr*" type="text_general" indexed="true" stored="true"/>
Now there will be five fields in Solr document as addr1, addr2, addr3, addr4, addr4, addr5. You can search in all these fields.
OR
If you don't want to create multiple address fields like addr1, addr2,... you can do it with copyField as following:
address
addr*
that will match all fields beginning
with addr
addr*
to address
fieldE.g.
<field name="address" type="text_general" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="addr*" type="text_general" indexed="false" stored="false"/>
<copyField source="addr*" dest="address"/>
This way makes querying much easier than previous one because you have to search only in single field address
.
Upvotes: 0