ethanxyz_0
ethanxyz_0

Reputation: 743

How to declare various document types in Solr?

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

Answers (3)

Jesvin Jose
Jesvin Jose

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 cars 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

Jayendra
Jayendra

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

Cao Dongping
Cao Dongping

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

Related Questions