How to fix or remove Solr configuration? - solr

I'm trying to set up Solr on RHEL as a better search engine for Drupal and admittedly I don't really know what I'm doing. I've installed Solr and am now trying to create a core. While crafting the URL, I accidently clicked on it and now I have a unusable configuration. I'm getting this error:
ylncore-name: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core ylncore-name: Error loading solr config from /var/solr/data/path/to/dir/conf/solrconfig.xml
I deleted the core via the dashboard and from the command line which didn't help. I've grepped across the drive for files with the path but can't find any. Web searching makes it sound like I have to do something with Zookeeper but I don't know what. How do I fix or delete the config so that I can start over?

Related

How to make config changes take effect in Solr 7.3

We are using solr.SynonymFilterFactory with synonyms.txt in Solr during querying. I realized that there is an error in synonyms.txt, corrected it and uploaded the new file. I can see the modified synonyms.txt from Admin. But it looks like the queries are still using the old synonyms.txt. I am executing test queries from Admin with debugQuery=true and can see the synonyms getting used. How can this be fixed? It is a production environment with 3 nodes using zookeeper for management.
You'll need to reload your core for the changes to take effect.
In a single-node Solr you can do that from the Admin page: go to Core Admin, select your core, and hit Reload. This will slow down some queries but it shouldn't drop queries or connections.
You can also reload the core via the API:
curl 'http://localhost:8983/solr/admin/cores?action=RELOAD&core=your-core'
I am not sure how this works on an environment with 3 nodes, though.

SolrJ : Server refused connection

For a customer, I need to write a search engine running on Linux. I am using SolrJ and did not configure anything else so far.
I followed https://lucene.apache.org/solr/guide/7_4/using-solrj.html#common-build-systems and thus added SolrJ in the project pom.xml, and also that tutorial.
The SolR client is instanciated like :
solrClient = new HttpSolrClient.Builder(
GeneralSettings.getRootSolrPath() + "/" + getCollectionName()).
build();
But for any query or commit I keep getting org.apache.solr.client.solrj.SolrServerException: Server refused connection at: http://localhost:8983/solr/test. I read http://lucene.472066.n3.nabble.com/Default-query-error-quot-Server-refused-connection-quot-td4010806.html but I am already using the expected port.
My understanding of the java doc SolrClient ’s handle the work of connecting to and communicating with Solr, and are where most of the user configuration happens. is that I only need to import the jar and then everything will work out of the box.
But as I keep getting this "Server refused connection" error I may have to configure something, but I could not find how to configure SolrJ (use solrconfig.xml or core.properties or call System.setProperty or call an API).
Please note that Apache may be running somewhere because I used to test some sites on it.
So how to get rid of this "Server refused connection" error?
Any help or tutorial to set SolrJ up based on Solr available doc would be very much appreciated,
Edit 2018-08-12 16:10
I thought SolrJ could work like Lucene, without a server, but it looks that I missed one essential piece: installing Solr (see https://www.baeldung.com/apache-solrj). I'll give it a try and post updates.
In case it might help someone else starting with SolrJ here are the steps I did to get rid of the error mentionned in the title (actually I followed https://www.baeldung.com/apache-solrj).
Downloaded the latest binary release of Solr
Extracted it somewhere
CDed into that dir
Lauched bin/solr start from that dir
Created a core with bin/solr create -c coreName (maybe another way exists but I hadn't been able to make it work so far)
Then Solr was running and listening on port 8983, and my Java app could connect to it via SolrJ.

Solr cloud - reloading elevate.xml

I am using Apache Solr 6.5 with Query Elevation Component (/elevate endpoint) to support elevation of particular documents in my queries.
I am using elevate.xml file in
<instanceDir>/conf/<config-file>
directory. However on production server (Solr configured as cloud with zookepper to maintain configuration) changes in the elevate.xml are not loaded. To check if it works, I just query the elevated phrase and as a result I get elevated documents from previous version of elevate.xml.
Of course I am restarting all Solr cloud instances after loading new version of elevate.xml and updated file is visible in the Solr's Admin UI files section (of the particular core of course).
The query I am using to test results, to prove that I am not using stardard /query component:
/elevate?df=name&fl=id,name,[elevated]&indent=on&q=heart&wt=json
What should I do to actually tell Solr that the new elevate.xml was loaded? That works fine on my development standalone configuration of Solr (not cloud one) after the solr service is restarted, the documents are elevated by updated elevate.xml file.
You should be doing this:
upload the elevate.xml file to zookeeper as explained here
reload the collection with the RELOAD collection api, no need to restart Solr
Ok I think I figured it out. The problem was with a directory in which elevate.xml file was anticipated by Solr.
The documentation states (as for 6.5.0 version)
config-file
Path to the file that defines query elevation.
This file must exist in <instanceDir>/conf/<config-file> or <dataDir>/<config-file>.
In my dev configuration that was true for both cases (the file was read either from conf or data directory). However on production (in cloud environment with external zooKeepers) the file was read from the root directory of a core (aka collection), where also solrconfig.xml and schema.xml exists.
Probably it has some explanation and it's just data dir itself, but since I don't know how to check what are values of instanceDir and dataDir variables, the documentation was misleading for me.
I hope it helps other Solr adepts.

This resource can not be previewed at the moment. - CKAN

I’m running CKAN 2.2 on Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64).
I have uploaded a dataset to the CKAN instance. It has been uploaded successfully and can be downloaded as well. But when I try to preview the database I end up with below error.
This resource can not be previewed at the moment.
When I click on the “Click here for more information”, It says
Could not load preview: DataProxy returned an error (Request Error:
Backend did not respond after 10 seconds)
How can I fix this error?
The problem is that the data proxy (which is used to transform csv to
something that the data preview can understand) is a server on the
internet. Consequently the files you want to preview have to publicly
accessible from the internet as well. localhost is your own computer
which means that the dataproxy cannot access it. To solve this, wither put the file in the datastore using the datastorer or put the file on a server and provide the correct url.
.
This happens because the data proxy which is used to transform the
data into something we can preview with recline needs the files to be
accessible from the internet. The best solution is to store the data
in the datastore and then the preview will work.
Extracted from here & here
Sometimes you get the same message as the title question:
This resource can not be previewed at the moment.
But when you click on the “Click here for more information”, It says:
Could not load preview: DataProxy returned an error (Data transformation failed. error: An error occured while connecting to the server: DNS lookup failed for URL: http:///dataset/c3ce226b-73bd-4b06-9d1b-ffea13d5f770/resource/580fb05f-6d86-4748-aac7-560b904a208f/download/foo.csv)
In this case, probably the datapusher plugin is not working. First follow the instructions for datapusher in CKAN manual. If you already did this or you installed CKAN from a package, check the CKAN configuration in production.ini (development.ini) file. A small check list to solve the problem:
add datapusher in "ckan.plugins"
set "ckan.site_url"
set "ckan.datapusher.url"
check Apache/nginx server logs (/var/log/apache2/datapusher.*.log, /var/log/apache2/ckan_default*.log)
In my case, the issue was in my development.ini (or production.ini for you maybe) file where the lines for DataPusher's configuration were commented out with a # in the start of the line. Also, the ckan storage config line was also commented.
I uncommented those lines and it was solved.

Finding or configuring Solr home directory

I'm following this tutorial on setting up django-haystack and solr: http://django-haystack.readthedocs.org/en/latest/tutorial.html
I hit a stumbling block here:
If you’re using the Solr backend, you have an extra step. Solr’s
configuration is XML-based, so you’ll need to manually regenerate the
schema. You should run ./manage.py build_solr_schema first, drop the
XML output in your Solr’s schema.xml file and restart your Solr
server.
Where is my schema.xml file located? It says it should in the Solr home directory and the .conf folder. But where is the Solr home directory, and/or how do I configure its location?
The solr home is the place where you can find your schema.xml and solrconfig.xml, as well as some other files depending on the text analysis you're using (dictionaries for stemming, stopwords etc.), and where your index gets created by default.
There are a couple of ways to configure the solr home, since it is located outside of the servlet container:
solr.solr.home java system property (most used one)
java:comp/env/solr/home for JNDI lookup
You can either check your servlet container configuration or go to the Solr admin page http://host:port/solr/admin, which prints out the actual solr home location together with other information about the solr instance running.
First check whether your Solr instance is working.
Got to -> http://localhost:8983/solr
If you can see a Solr web panel you have a live Solr instance.
Now go to Java Properties
Here you will see the the variables. This is where you can find the home DIRs
Note schema is now managed. If you want to override this you will have to hack it a bit. check here

Resources