简体   繁体   中英

solr field defined in schema.xml but missing at runtime

I have created a field called "searchme" (that would eventually be used as a catch-all field for querying) and then I made it as a default search field using the "df" parameter in the requestHandler of /select.

However, to start with I noticed that the field itself is not seen in the schema when I look through the Solr Dashboard and Schema Browser. I don't see any error related to that field loading but it doesn't work as a search field.

It's a bit weird and I couldn't find any solution online and hence posting.

I am using Solr 4.5.1. Please help/suggest. Thanks!

My schema.xml (containing the field definition and copyFields tags)

    <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="name" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="category1" type="string" indexed="true" stored="true" required="false" multiValued="false" />
    <field name="category2" type="string" indexed="true" stored="true" required="false" multiValued="false" />
    <field name="category3" type="string" indexed="true" stored="true" required="false" multiValued="false" />
    <field name="content" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="_version_" type="long" indexed="true" stored="true"/>
    <field name="searchme" type="string" indexed="true" stored="true" required="true" multiValued="true" />

...

   <copyField source="id" dest="searchme"/>
   <copyField source="name" dest="searchme"/>
   <copyField source="category1" dest="searchme"/>
   <copyField source="category2" dest="searchme"/>
   <copyField source="category3" dest="searchme"/>
   <copyField source="content" dest="searchme"/>

My solrconfig.xml (containing the df param)

<requestHandler name="/select" class="solr.SearchHandler">
    <!-- default values for query parameters can be specified, these
         will be overridden by parameters in the request
      -->
    <lst name="defaults">
      <str name="echoParams">explicit</str>
      <int name="rows">10</int>
      <str name="df">searchme</str>
    </lst>
</requestHandler>

If you are not seeing this field through Solr dashboard you are not changing right schema.xml file and you will not be able to use your new field. Make sure you are in the right folder (example: solr-4.5.1\\example\\solr\\collection1\\conf).

To check your folder go to your Dashboard and click on CoreAdmin tab (example: http://yourhost:yourport/solr/#/~cores/collection1 ) and check instanceDir value (by default:C:\\Installs\\solr-4.5.1\\example\\solr\\collection1\\ ) go to that folder and look for conf\\schema.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM