Want to add new search field in Solr Search

401 views Asked by At

We are using Solr 5.2.1 with Zookeeper 3.4.6.

We would like to add an extra search field in the solr search schema, for that we have added filed in schema.xml however it is not reflecting to the solr index.

We have also tried below things - 1. Started Zookeeper as well as solr services. 2. Tried to reload the core

Could you please share what we need to do fix this issue?

Thank You in advance.

Bhagwat Mane

2

There are 2 answers

0
Bhagwat Mane On BEST ANSWER

Thank You Pihentagyu,

Short steps for above discussion -

Considering :

  • You are running solr in cloud mode with Zookeeper
  • You are using schemaFactory as ManagedIndexSchemaFactory in the solrconfig.xml file

Follow below steps to reflect changes made in schema.xml to zookeeper configuration -

For Windows

  1. Execute - zkcli.bat -cmd upconfig -confdir "C:\path to solr directory\solr\configsets\asi_configs\conf" -confname PRODSEARCH -z 10.0.0.223:2181
  2. Then you need to clear managed-schema to reflect changes from schema.xml to managed-schema. To clear managed-schema execute - zkcli.bat -cmd clear -z 10.0.0.223:2181 /configs/PRODSEARCH/managed-schema
  3. Last step to restart Solr and Zookeeper services.

Where

  • zkcli.bat - is present in "solr\server\scripts\cloud-scripts"
  • PRODSEARCH - is name of config, you can get it from Solr Admin UI under Cloud\Tree\configs\confname

Note : use zkcli.sh for linux.

11
James Doepp - pihentagyu On

Since you are using Solr cloud, you need to update the zookeeper with the new schema. This is done on the solr server in the server/scripts/cloud-scripts directory using the zkcli.sh script, as follows:

./zkcli.sh -cmd upconfig -confdir /opt/solr/server/solr/collection0/conf -confname configName -z zookeeper1:2181,zookeeper2:2181,zookeeper3:2181

where configName is the name of the config (you can find this in the solr admin panel under cloud-->/configs), zookeeperX is the ip address of zookeeperX, and 2181 is the port number of the zookeeper.

Then, of course, you will need to index, adding data to that field as mentioned above.