I saw two methods in SolrServer: addBean( Object bean ) and add (SolrDocument doc ).
My question is:
If I can add objects directly using addBean(), do I need to create any schema for the object?
Doesn't Solr look at fields of the object and determine the schema from there?
Or does Solr serialize the object into a string first and then proceeds with a normal add?
(This might require schema specification)
Solr supports a Schemaless Mode. When starting Solr this way, you are initially not bound to a schema. When you give Solr a first document it will guess the appropriate field types and generate a schema that includes those field types for you. These fields are then fixed. You may still add new fields on the fly that way.
This feature is - imho - good for prototyping and to get first version of a schema, but you should not go to production with such a core.
There are some resources out there giving more details on that topic
- https://cwiki.apache.org/confluence/display/solr/Schemaless+Mode
- http://searchhub.org/2013/05/21/schemaless-solr-part-1/
But to answer your question
- if you run your server in that schemaless mode, no, you do not need a schema.
- if you do not - which is likely, as it does not come out of the box - yes you do need a schema