Reputation: 6141
Question regarding data storing concept in SOLR I will have three documents:
User with: - id (unique) - CompanyName - Address
Property: - isCarOwner - Car type
Location with: - Address
Data will be collected from Relational database. Question is how do I represent this data in solr.
In my head I have this concept: I will have one document that will have all these fields defined. And I will feed that document as a collection of data from relational database. I will use this:
I will fill this index with following query (8983/solr/update/json?commit=true):
[{
"id" : "1",
"companyname" : "BlackDevil",
"iscarowner": true,
"cartype": "Honda R1",
"Address": "Super Hero Street."
}]
I will search this index with the following query:
:8983/solr/select?q=id:1&wt=json&indent=true
DataSet is much bigger than this, but this is only a concept. Is this the right approach?
My main source of problem is this: Is one index sufficient for this? Do I need to expand?
Upvotes: 0
Views: 180
Reputation: 1019
If your original tables have 1-1 relationships (one user, 0 or 1 car type, 0 or 1 address) then yes, your approach is the right one for Solr - certainly the simplest.
More complex relations in the original data can be handled in different ways (multi-value fields, nested documents, multiple cores), but from your description you don't need any of this. One flat collection with all the info in each document will work beautifully - and again is the "default" way of working with Solr.
Upvotes: 1