I have a single core solr instance running. I want to store two different types of docs.
- Basic profile for a user(s). (fields: uid : “1” , docType=”profile”..)
- The cars each user owns. (fields uid:”1″, docType=”cars”…)
1 will have single doc per user. 2 will have multiple docs(each separate car) for each user.
I dont want multivalues field for cars due to some design reason. I need multiple docs for 1 car per user.
If i declare uid as unique field in schema then my car doc added later will overwrite my profile doc for that user, or even other car docs from the same user added previously bcoz the uid is same. How can I achieve what I am trying to(i.e. 1 profile doc per user and multiple car docs per user)
I have just started working on solr so this cud be very basic so please pardon me for that.
Thnx for your time.
You can solve this by adding the Universal Unique Identifier to the schema.xml.
In the schema.xml file add the following fieldType.
Then add new field with this type.
Finally, define your uniqueId key with this field.
For more information check UniqueKey page in Solr wiki.