Can I edit Apache Solr's managed-schema file manually? - solr

If I just created a new core with Apache Solr 6.1.0 and haven't added any documents yet, will manually editing the default managed-schema file cause errors down the line?

The managed-schema.xml could be changed manually and that wouldn't cause errors, however the best practice regardless of the existing documents is to use the API as explained here.

Related

What is correct means of upgrading a solr schema on running system?

We're using Solr 7 and running in production via docker images. I was reading the https://lucene.apache.org/solr/guide/7_4/schema-api.html guide to using the API and trying it to add a new field to an existing schema on a local instance when I got the following error:
{
"responseHeader":{
"status":0,
"QTime":9},
"errors":[{"errorMessages":"schema is not editable"}]}
So I wondered what is the best practice approach for updating a schema on a live system. Is it a case of editing the schema.xml on each node and restarting in turn?
You can either use managed-schema (ManagedIndexSchemaFactory) or classic schema.xml (ClassicIndexSchemaFactory), defined in the solrconfig.xml. The schema.xml doesn't allow change the schema via API. Also if using
ManagedIndexSchemaFactory check if subtag name="mutable" is false, if so the change is disabled. If you are using SolrCloud and recent versions of Solr it is recommended to use managed-schema.

solr tries to upgrade my schema to managed

This is on solr 7.1.0. I have a classic schema, with the proper line in solrconfig.xml:
<schemaFactory class="ClassicIndexSchemaFactory"/>
However I still get this line in the log:
ManagedIndexSchemaFactory The schema has been upgraded to managed,​ but the non-managed schema schema.xml is still loadable. PLEASE REMOVE THIS FILE.
And when I inspect that core's schema it's the generic schema, not the one defined in my schema.xml.
This sounds like the core you think is loading is not the one that that is actually loading. Because:
Upgraded schema should have been the same as the original one - you are seeing a different one
You don't see managed-schema in the directory you expect it to be
You keep getting the message
So, have a look at the overview page of that core and check whether the instance directory points to where you expect it to be.

MultiRequestHandler not working in solr

I'm was trying to run multiple queries in a single go then I came across something called MultiRequestHandler. I had put request handler in the solrconfig.xml file and restarted the solr.
<requestHandler name="/multi" class="solr.MultiRequestHandler"/>
I'm getting the error
org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
Error loading class 'solr.MultiRequestHandler'
My version of Solr is 5.4.0. Does my version of Solr doesnot support MultiRequestHandler?
There never was a MultiRequestHandler added to Solr. The ticket tracking its addition were resolved as Won't fix.
The patch is available on Github, but hasn't been updated in three years - so it might not apply cleanly to 5.4.x.
Newer versions of Solr do however have Streaming Expressions, which could be what you're looking for.

Solr 5 custom field and filter

I'm new to solr. After i tried using Solr 5 client. I want to try Solr 5 source code.
So my questions are,
can i create a custom field for my own core on solr 5 by editing
schema.xml? if it's possible, please tell me the location (it wasn't in my conf folder, should i create a new one?).
Is there any other method for adding a custom field other than using schema
api?
Everytime i try to create a new core and then index the files, there are only currency.xml, elevate.xml, managed-schema(generated schema), params.json, protwords.txt, solrconfig.xml, stopwords.txt synonyms.txt on my conf folder and there's no schema.xml. Did i miss something?
Is there any simple tutorial to explain the custom filter on solr 5?
I really appriciate your answer. Thank's
When you create a core in Solr 5 it comes by default with schemaless mode active. This mode make solr schema not visible and all changes need to be done with schema API. If you want to manage schema by yourself you could rename managed-schema to schema.xml and modify solrconfig.xml to not use schemaless mode. In solrconfig.xml replace
<schemaFactory class="ManagedIndexSchemaFactory">
<bool name="mutable">true</bool>
<str name="managedSchemaResourceName">managed-schema</str>
</schemaFactory>
by
<schemaFactory class="ClassicIndexSchemaFactory"/>
Now solr will use schema.xml managed by yourself.
The only mandatory configuration files to use are solrconfig.xml and in your case schema.xml. The other files are used just if you configure some filters using them. If you are using the example schema.xml probably you need to have all these files. But clean the configuration files to have just the fields and field types you really expect to use.
To learn more about filters, tokenizers and analyzers you can take a look at https://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters.
Yes
Manually editing the schema and using the API, are only two ways, as far as i know.
How exactly are you creating this core? Are you using the install_solr_service.sh ? Assuming its a linux system, check /var/solr/configs folder. Thats where the config files are if you ran that script.
Yes of course :) . https://cwiki.apache.org/confluence/display/solr/Apache+Solr+Reference+Guide There is a "Getting Started" section, which should answer all your questions, including where configs are stored, how to use them etc.
Happy Searching!

How to start work on Solrnet

I have installed Apache Tomcat 6 and configure Solr 1.4. Now Solr service running successfully.
In Solr 1.4 has two important file solrconfig.xml and schema.xml to configure c# application with Solr service.
But whenver I changed schema.xml file according to sql table’s field it’s stop the Solr service.
so tell me step by step to configure solrconfig.xml and schema.xml
Thanks,
Unfortunately, the question isn't clear or is too broad, so I can only give general advice and point to documentation.
But whenver I changed schema.xml file according to sql table’s field it’s stop the Solr service.
Yes, after changing your schema you either have to restart your Solr instance, or, if you are using Cores (recommended), you have to reload the changed core.
tell me step by step to configure solrconfig.xml and schema.xml
Just change the files according to your needs. The Solr package contains numerous examples, all thoroughly commented. Documentation on solrconfig.xml is here. Documentation on schema.xml is here. After making any change in solrconfig.xml you have to restart your Solr instance.
Also, when making changes to the schema, make sure you reflect those changes in your SolrNet mapping.

Resources