> I figured I would create three entities and relevant > schema.xml entries in this way: > > dataimport.xml: > <entity name="Users" query="select id,firstname,lastname from > user"></entity> > <entity name="Artwork" query="select id,user,name,description from > artwork"></entity> > <entity name="Jobs" query="select id,company,position,location,description > from jobs"></entity> That's correct. You can list several entities under document element. You can index them separately using entity parameter (i.e. add entity=Users to you full import HTTP request). Do not forget to add clean=false so you won't delete previously indexed documents. Or you can index all entities in one request (by default).
> schema.xml: > <field name="id" type="int" indexed="true" stored="true" required="true"/> > <field name="firstname" type="string" indexed="true" stored="true"/> > <field name="lastname" type="string" indexed="true" stored="true"/> > <field name="user" type="int" indexed="true" stored="true"/> > <field name="name" type="string" indexed="true" stored="true"/> > <field name="description" type="text" indexed="true" stored="false"/> > <field name="company" type="string" indexed="true" stored="true"/> > <field name="position" type="string" indexed="true" stored="true"/> > <field name="location" type="string" indexed="true" stored="false"/> Why do you use string type for textual fields (description, company, name, firstname, lastname, etc)? Is it intentional to use these fields in filtering/faceting? You can also add "default" searchable multivalued field (type=text) and copy field instructions to copy all textual content into this field ( http://wiki.apache.org/solr/SchemaXml#Copy_Fields ). Thus you will be able to search in "default" field for terms from all fields (firstname, lastname, name, description, company, position, location, etc). You would probably want to add field type=user/artwork/job. You will be able to facet/filter on that fields and provide better user search experience. > This obviously does not work as I want. I only get results from the "users" > table, and I cannot get results from neither "artwork" nor "jobs". Are you sure that this is because the indexing isn't working? How do you search for your data? What query parser (standard/dismax)/etc? > I have > found out that the possible solution is in putting <field> tags in the > <entity> tag and somehow aliasing column names for Solr, but the logic > behind this is completely alien to me and the blind tests I tried did not > yield anything. You don't need to list your fields explicitly in fields declaration. BTW, what database do you use? Oracle has some issue with upper casing column names that could be a problem. > My logic says that the "id" field is getting replaced by the > "id" field of other entities and indexes are being overwritten. Are your ids unique across different objects? I.e. is there any job with the same id as user? If so then you would probably want to prefix your ids like: <entity name="Users" query="select ('user_' || id) as id,firstname,lastname from user"></entity> <entity name="Artwork" query="select ('artwork_' || id) as id,user,name,description from artwork"></entity> > But if I > aliased all "id" fields in all entities into something else, such as > "user_id" and "job_id", I couldn't figure what to put in the <primaryKey> > configuration in schema.xml because I have three different id fields from > three different tables that are all primary keyed in the database! You can still create separate id fields if you need to search for different objects by id and don't mess with prefixed ids. But it's not required. HTH, Alexey