2015-07-09 12 views
6

Sto cercando di ottenere un core Solr in esecuzione con il mio schema.xml, ma Solr (versione 5.2.1) continua a lamentarsi degli elementi mancanti fieldType che non sono nemmeno nelle definizioni fields.Errore Solr che crea core: fieldType [x] non trovato nello schema

org.apache.solr.common.SolrException: fieldType 'booleans' not found in the schema 

Ogni volta che posso aggiungere un 'mancante' fieldtype un altro errore si apre lamentarsi un'altra fieldType mancanti, come longs, ecc, fino a quando li ho aggiunti e lo schema viene accettato senza errori.

Ora, come mai devo fornire questi elementi quando non li usano?

In config.xml ho:

<schemaFactory class="ClassicIndexSchemaFactory"/> 

Ecco la mia schema.xml:

<schema name="collections" version="1.5"> 

<fields> 
    <field name="id_object" type="string" indexed="true" stored="true" /> 
    <field name="id_organization" type="string" indexed="true" stored="true" /> 
    <field name="title" type="string" indexed="true" stored="true" /> 
    <field name="artist" type="string" indexed="true" stored="true" /> 
    <field name="searchname" type="string" indexed="true" stored="true" /> 
    <field name="technique_group" type="string" indexed="true" stored="true" /> 
    <field name="technique" type="string" indexed="true" stored="true" /> 
    <field name="color_type" type="string" indexed="true" stored="true" /> 
    <field name="color" type="string" indexed="true" stored="true" /> 
    <field name="subject" type="string" indexed="true" stored="true" /> 
    <field name="height" type="tint" indexed="true" stored="true" /> 
    <field name="width" type="tint" indexed="true" stored="true" /> 
    <field name="depth" type="tint" indexed="true" stored="true" /> 
    <field name="price_sale" type="tfloat" indexed="true" stored="true" /> 
    <field name="price_rental" type="tfloat" indexed="true" stored="true" /> 
    <field name="price_rental_with_savings" type="tfloat" indexed="true" stored="true" /> 
    <field name="savings_portion" type="tfloat" indexed="true" stored="true" /> 
    <field name="year" type="tint" indexed="true" stored="true" /> 
    <field name="is_for_rent" type="boolean" indexed="true" stored="true" /> 
    <field name="is_for_sale" type="boolean" indexed="true" stored="true" /> 
    <field name="status" type="string" indexed="true" stored="true" /> 
    <field name="shipment" type="tfloat" indexed="true" stored="true" /> 
    <field name="timestamp" type="tdate" indexed="true" stored="true" default="NOW" /> 

    <!-- catch all field, must be multiValued if any of its source fields is --> 
    <field name="quick_search" type="text" indexed="true" stored="false" /> 

    <!-- mandatory --> 
    <field name="_version_" type="tlong" indexed="true" stored="true" /> 

</fields> 

<uniqueKey>id_object</uniqueKey> 

<copyField source="id_object" dest="quick_search" /> 
<copyField source="title" dest="quick_search" /> 
<copyField source="artist" dest="quick_search" /> 
<copyField source="searchname" dest="quick_search" /> 
<copyField source="technique_group" dest="quick_search" /> 
<copyField source="technique" dest="quick_search" /> 
<copyField source="color_type" dest="quick_search" /> 
<copyField source="color" dest="quick_search" /> 
<copyField source="subject" dest="quick_search" /> 

<types> 
    <fieldtype name="string" class="solr.StrField" /> 
    <fieldtype name="boolean" class="solr.BoolField" /> 
    <fieldtype name="tint" class="solr.TrieIntField" /> 
    <fieldtype name="tlong" class="solr.TrieLongField" /> 
    <fieldtype name="tfloat" class="solr.TrieFloatField" /> 
    <fieldtype name="tdate" class="solr.TrieDateField" /> 
    <fieldtype name="text" class="solr.TextField"/> 
</types> 

</schema> 

Non c'è un singolo multiValued campo in là. Tuttavia, ho provato a impostare esplicitamente multiValued='false' per ogni campo singolarmente, ma inutilmente. Anche quando spoglio l'intero schema solo su una manciata di campi String, questo errore viene comunque generato.

Sono abbastanza fiducioso il mio schema.xml è OK ma forse qualche impostazione da qualche parte dovrebbe dire Solr a prendersela comoda.

risposta

4
<lst name="typeMapping"> 
    <str name="valueClass">java.lang.Boolean</str> 
    <str name="fieldType">booleans</str> 
</lst> 

qui è necessario correggere "booleani" a "booleano".

<lst name="typeMapping"> 
    <str name="valueClass">java.lang.Boolean</str> 
    <str name="fieldType">boolean</str> 
</lst> 

Allora funzionerà ..

Si prega di controllare i link

https://lucene.apache.org/solr/4_6_0/solr-core/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.html

http://events.linuxfoundation.org/sites/events/files/slides/whats-new-in-apache-solr.pdf

+1

Sembra una soluzione molto più elegante del semplice commento dell'intera cosa. Per funzionare, ho dovuto usare ** ManagedIndexSchemaFactory ** invece di ** ClassicIndexSchemaFactory **, impostare 'mutable = true' e usare un nome diverso da schema.xml – acdhirr

+0

in' Solr 6.3.0' funziona anche. La sezione necessaria può essere trovata in 'solrconfig.xml'. A proposito, dovevo anche rimuovere 's' da' tdates', 'tlongs' e da' tdoubles'. Ho preso 'solrconfig.xml' da' basic_configs'. – TitanFighter

6

Non sono sicuro se sia il modo migliore per andare, ma commentare la sezione solr.AddSchemaFieldsUpdateProcessorFactory in config.xml sembra risolvere il problema.

<!-- 
<processor class="solr.AddSchemaFieldsUpdateProcessorFactory"> 
    <str name="defaultFieldType">strings</str> 
    <lst name="typeMapping"> 
    <str name="valueClass">java.lang.Boolean</str> 
    <str name="fieldType">booleans</str> 
    </lst> 
    <lst name="typeMapping"> 
    <str name="valueClass">java.util.Date</str> 
    <str name="fieldType">tdates</str> 
    </lst> 
    <lst name="typeMapping"> 
    <str name="valueClass">java.lang.Long</str> 
    <str name="valueClass">java.lang.Integer</str> 
    <str name="fieldType">tlongs</str> 
    </lst> 
    <lst name="typeMapping"> 
    <str name="valueClass">java.lang.Number</str> 
    <str name="fieldType">tdoubles</str> 
    </lst> 
</processor> 
--> 
+0

Nel mio caso solr 5.2.1 ho trovato questa sezione 'solrconfig.xml '. Anche il commento ha funzionato per me. Grazie – Kirby

+0

Utilizza lo schema ckan predefinito, anche per il mer lavorato. Grazie! – Alex

Problemi correlati