Reputation: 5253
i am new to Apache SOLR..n i am learning how to create documents in SOLR..
My scenario : In my RDBMS database, i have the following scenario :
A "cars" table "jc_cars" : id, name, extra
An "attributes" table "jc_attributes" : id, attributeName
A Many-to_many table between Attribute and Cars : "jc_car_attributes" : carID, attributeID , value
An "article" table : jc_articles : id, title, description
A Many-to-many table between Article and Cars : "jc_car_articles" : articleID, carID
Now what I want is :
Actually I want results when i make the following the query :
So how should i create the Corresponding document and Schema.xml..??
Upvotes: 0
Views: 473
Reputation: 20270
Solr has a flat index, so you can't really have a list of relations with multiple values (e.g. a relation with both a name and a value, like your attributes).
For the articles, you can provide the IDs of related articles in a multi-valued field, then do a separate lookup for these either (a) in your database (b) in another solr core.
For the attributes, if you have a fixed list of attributes you can join these to cars
and read each attribute into its own field. If you do not have a fixed list of attributes, you'll also have to resort to a separate core, doing essentially the reverse of what you would do for articles; do a lookup in the attributes core then lookup the specific cars from your cars core.
Upvotes: 1