floriansemm / SolrBundle

Solr-Integration into Symfony and Doctrine2
http://floriansemm.github.io/SolrBundle
MIT License
123 stars 73 forks source link

Schema is not updated #66

Closed rkmax closed 10 years ago

rkmax commented 10 years ago

This is the first time I use Solr and bundle, follow the guide and everything seems properly but when creating an entity, I get an error

org.apache.solr.common.SolrException: ERROR: [doc=1] unknown field 'document_name_s'

I understand Solr needs a schema that can be updated dynamically. and the bundle does for me when going to store Entity into the index but this is not happening.

My entity class

/** 
 * @ORM\Entity
 * @ORM\Table()
 * @Solr\Document 
 */
class Entity {
    /** orm suff...
     *  @Solr\Id
     *  @ORM\Id
     *  @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id

    /**
     * @ORM\Column(name="product_name", type="string")
     * @Solr\Field(type="string")
     */
    private $productName;

    //...
}
floriansemm commented 10 years ago

Solr/lucene provides "dynamic fields" , and it looks like as if these definitions are missing. Please check your schema.xml for those definitions. You can find an example under the section "dynamic fields": http://wiki.apache.org/solr/SchemaXml

Which solr-version do you use?

rkmax commented 10 years ago

solr 4.5.1 on ArchLinux. @floriansemm thanks i've created a new core with this fields

 <fields>   
  <!-- general -->
  <field name="id"        type="string"   indexed="true"  stored="true"  multiValued="false" required="true"/>
  <field name="type"      type="string"   indexed="true"  stored="true"  multiValued="false" /> 
  <field name="name"      type="string"   indexed="true"  stored="true"  multiValued="false" /> 
  <field name="core0"     type="string"   indexed="true"  stored="true"  multiValued="false" /> 
  <field name="_version_" type="long"     indexed="true"  stored="true"/>
  <dynamicField name="*_i"  type="long"  indexed="true"  stored="true"/> 
  <dynamicField name="*_s"  type="string"  indexed="true"  stored="true"/> 
 </fields>