Reputation: 743
How can I "replicate" database structure in Solr?
Is the schema.xml
a represetation of only one entity type? Like Car or Costumer, etc?
How can I declare the structure of Car and Costumer?
Upvotes: 0
Views: 1950
Reputation: 23088
Have a field type
of the string
datatype. At index-time, set the value to car
or customer
. So if you want to shop for red swifts:
q=red+swifts&fq=type:car
The solr schema is a giant (and sparsely occupied) table. So if your Db had a car
s table with 20 columns and 12500 entries and a customer
table with 30 columns and 12500 entries, your solr core contains 25000 entries with 50 fields. And yes, its efficient given Solr's indexing strategies, even faster than relational DBs.
Upvotes: 4
Reputation: 52779
solr will allow you to index both the entities together if you maintain the fields which both of Entities have and still query them.
However, if you want to have a relationship with the entities Solr does provide a Join feature which though limited (as i had last checked upon) would enable you to query with relationship. Check for the Join further and you would find new developments in it.
Upvotes: 1
Reputation: 989
No you can't. Solr is a kind of Nosql, which is different from RDBMS. In RDBMS, tables are in relationship, you can perform join action to join them together, or get data from view. But in solr, you can not perform join action at all. One solr query can only be executed on one core. So you can't replicate strcture from RDBMS simply and you must redesign your schema for solr.
Upvotes: 0