SolrCloud backup data not finding on my system path - solr

When I ran the SolrCloud (6.3.0) Back API using this url backup url
It returns response status 0 i.e no error
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">213</int>
</lst>
<lst name="success">
<lst name="localhost:8983_solr">
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">43</int>
</lst>
</lst>
</lst>
</response>
But I didn't find any locations_back folder with backed up data on my system.
When I ran this curl from command line, it returns some numbers like 32058, 32059,32060 etc.
curl http://localhost:8983/solr/admin/collections?action=BACKUP&name=locations_back&collection=locations&location=/opt/solr/server/solr
[1] 32058
[2] 32059
[3] 32060
Where I tested with location param path location=/opt/solr/server/solr OR location =/
But It also didn't show any locations_back folder with backed up data on my system.

In order to troubleshoot this issue please check the following:
modify the backup folder from /opt/solr/server/solr to /tmp/ That will help you understanding if it's a permission problem;
Is your collection really called locations (as one of your params is collection=locations)? Change it as necessary
Check the Solr server logs in order to see what's the error;
Is SSH enabled or are you hitting a firewall?
Are your Solr nodes healthy?
Are you calling that url through a browser or programmatically?

Related

SOLR why does its state this 'leaderUrl' must be specified without the /replication suffix

Why when I setup a Solr follower/slave do I get this message in the Solr logs
'leaderUrl' must be specified without the /replication suffix
This used to work fine in ersion 7.6 but now in version 8.11.1 it complains. What should the value be if not /replication?
This is the XML snippet in the solrconfig.xml that does the replications
<requestHandler name="/replication" class="solr.ReplicationHandler">
<lst name="slave">
<str name="leaderUrl">http://solr1:8983/solr/bookings/replication</str>
<str name="pollInterval">00:00:20</str>
</lst>
</requestHandler>
It seems to mean the leadUrl, I seemed to be transfixed on the name of the request handler!
So going from this which worked in 7.6
<str name="masterUrl">http://solr1:8983/solr/bookings/replication</str>
to this which works in 8.11.1
<str name="leaderUrl">http://solr1:8983/solr/bookings</str>

Can Solr Index ASPX Files?

When I try to index ASPX files using Solr, I keep getting an error. My ASPX file is very standard. Does anyone know if Solr just isn't able to index ASPX files? If I change the extension from ASPX to HTML, Solr can index the file just fine which I find very odd.
The command I use is (im a Windows user):
java -Dc=collection -Drecursive -Dfiletypes=aspx jar example/exampledocs/post.jar c:/folder
I get the errors:
SimplePostTool: WARNING: Solr returned an error #400 (Bad Request) for url: http://localhost:8983/solr/collection/update
SimplePostTool: WARNING: Response: <?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">400</int>
<int name="QTime">1</int>
</lst>
<lst name="error">
<lst name="metadata">
<str name="error-class">org.apache.solr.common.SolrException</str>
<str name="root-error-class">com.ctc.wstx.exc.WstxUnexpectedCharException</str>
</lst>
<str name="msg">Unexpected character '=' (code 61); expected a semi-colon after the reference for entity 'l'
at [row,col {unknown-source}]: [8,43]</str>
<int name="code">400</int>
</lst>
</response>
In the Solr log:
org.apache.solr.common.SolrException: Unexpected character '=' (code 61); expected a semi-colon after the reference for entity 'l'

Search suggestions in django-oscar using solr

I've setup a django-oscar project and enabled solr 4.7.2 on it as per documentation.
Solr seems to be working fine. Testing the suggestions for 'exxample' (localhost:8983/solr/collection1/spell?spellcheck.q=exxample&spellcheck=true>) I get:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">10</int>
</lst>
<result name="response" numFound="0" start="0"/>
<lst name="spellcheck">
<lst name="suggestions">
<lst name="exxampl">
<int name="numFound">1</int>
<int name="startOffset">0</int>
<int name="endOffset">8</int>
<int name="origFreq">0</int>
<arr name="suggestion">
<lst>
<str name="word">exampl</str>
<int name="freq">2</int>
</lst>
</arr>
</lst>
<bool name="correctlySpelled">false</bool>
<lst name="collation">
<str name="collationQuery">exampl</str>
<int name="hits">2</int>
<lst name="misspellingsAndCorrections">
<str name="exxampl">exampl</str>
</lst>
</lst>
</lst>
</lst>
</response>
I've also enabled OSCAR_SEARCH_FACETS to make sure that Solr has been correctly registered by Django-Oscar, and it seems to be working fine.
HOWEVER, when I do a test search for a simple misspelling in django-oscar, I get 0 returned search results and no suggestions. I'm not sure what to do next.
Help would be greatly appreciated!
I've managed to fix this problem. I'll write my complete solution to setting up Solr with spelling suggestions on Django-Oscar since setup procedures require adjustments from that described in the official documentation. This is also my first time working with Solr (or any search engine), so don't expect some expert guidance, just a guide on how to get Solr up and running on Oscar.
I am using Oscar 1.5 with Solr 4.7.2 (solutions also works for 4.10.4 ... not sure about other versions). Do everything as per documentations - note that there is a slight difference in instructions for versions of Oscar that are < 1.5.
Once you have Solr installed and running you can test out an inquiry on the Solr server # localhost:8983/solr/collection1/spell?spellcheck.q=[your search inquiry goes here; no brackets]&spellcheck=true>. Needs to be a word from your database - either in product description or product title.
You will get an error result saying that Analyzer needs to be of same type. Fix this by editing the solrconfig.xml file located at ./solr-4.7.2/example/solr/collection1/conf/solrconfig.xml. Search for <str name="field">, and change each non-commented instance to <str name="field">text</str> - you can also change each instance to <str name="field">title</str>, but this restricts to words found in titles only. Restart the Solr server. These changes will do away with the Analyzer error and your Solr server will now start showing results, however they won't yet be fed into your Oscar site.
To fix this you need to make another adjustment to the same solrconfig.xml file. Search for <requestHandler name="/select" class="solr.SearchHandler">, and at the bottom of this request handler include the following code:
<arr name="last-components">
<str>spellcheck</str>
</arr>
Restart the server. Now you have spelling suggestions in your Oscar site. Hope others have found this helpful. Like I said - this is the first time I'm using Solr. If someone has anything to add, or extend Solr functionality on Oscar it would be great.

Cannot get highlighted Solr response

I'm using Solr example server to do an investigation. After fed it with all cached documents, mostly html files, it works fine except the highlight part.
The request URL I'm using is as followed,
http://localhost:8983/solr/collection1/select?q=keyword&wt=xml&hl=true
And the XML response is as followed,
<response>
<lst name="responseHeader">...</lst>
<result name="response" numFound="371" start="0">
<doc>
<arr name="links">
<str>rect</str>
<str>FJU_KDJFJJ_DJ_13</str>
</arr>
<str name="id">
F:\SkyDrive\funproj\cache\adfadf\asdff.htm
</str>
<arr name="title">
<str>asdff.htm</str>
</arr>
<arr name="content_type">
<str>text/html; charset=ISO-8859-1</str>
</arr>
<str name="resourcename">
F:\SkyDrive\funproj\cache\adfadf\asdff.htm
</str>
<arr name="content">
<str>...</str>
</arr>
<long name="_version_">1418589758873927680</long>
</doc>
<doc>...</doc>
</result>
<lst name="highlighting">
<lst name="F:\SkyDrive\funproj\cache\adfadf\asdff.htm"/>
<lst name="F:\SkyDrive\funproj\cache\cvzcv\c58053e10vq.htm"/>
<lst name="F:\SkyDrive\funproj\cache\hgdfhdfgh\c00302e10vq.htm"/>
<lst name="F:\SkyDrive\funproj\cache\asdfasdf\c00945e10vq.htm"/>
<lst name="F:\SkyDrive\funproj\cache\hjmyukt\asfdf06113002_03312010.htm"/>
<lst name="F:\SkyDrive\funproj\cache\nmvbmnm\saf0q033111.htm"/>
<lst name="F:\SkyDrive\funproj\cache\lkiullkl\a10-5974_110q.htm"/>
<lst name="F:\SkyDrive\funproj\cache\jhlhjkl\fdfinal.htm"/>
<lst name="F:\SkyDrive\funproj\cache\vcbxcbvcx\zynex10q33110_5132010.htm"/>
<lst name="F:\SkyDrive\funproj\cache\yuiuiou\v185403_10q.htm"/>
</lst>
</response>
The response, no matter JSON or XML, does not have the highlight part at all. I've checked the solrconfig.xml both in local file system and the admin page of the example server. The Highlighting is default on and pre/post are set to ""/"". The example search portal itself works fine with highlight in its results. But since it's not AJAX, there's no way for me to check its result through chrome.
What did I do wrong?
You have to define the fields using hl.fl which needs to be highlighted. For example, if you want to search and highlight hits in content field, you can use query below:
http://localhost:8983/solr/collection1/select?q=content:keyword&wt=xml&hl=true&hl.q=content:keyword&hl.fl=content
By default highlighting response returns only one snippet,even if your field have multiple hits. Also the length of snippet(fragsize) is set to 100 chars by default.
You can use hl.snippets and hl.fragsize to modify them.
For example, to modify fragsize:
http://localhost:8983/solr/collection1/select?q=content:keyword&wt=xml&hl=true&hl.q=content:keyword&hl.fl=content&hl.fragsize=5000
Passing hl.fragsize=0 will make fragsize unlimited.
For changing number of snippets:
http://localhost:8983/solr/collection1/select?q=content:keyword&wt=xml&hl=true&hl.q=content:keyword&hl.fl=content&hl.snippets=10
Refer to solr wiki for more parameters.
you would need to add the field hl.fl on which the highlighting needs to be enabled.
Default value for the param is blank.

Unable to retrieve computed distance in Spatial Solr queries

I'm using this plugin to allow spatial queries in Solr. I have followed the steps included in the documentation and I've got the spatial queries working fine.
Now I want to retrieve the computed distance. I added these lines in the solrconfig.xml file:
<searchComponent name="geodistance" class="nl.jteam.search.solrext.spatial.GeoDistanceComponent">
<defaults>
<str name="distanceField">geo_distance</str>
</defaults>
</searchComponent>
And I have added the "geodistance" component to the standard request handler:
<requestHandler name="standard" class="solr.SearchHandler" default="true">
<lst name="defaults">
<str name="echoParams">explicit</str>
</lst>
<arr name="components">
<str>query</str>
<str>geodistance</str>
</arr>
</requestHandler>
Then, when I run a query such as "q={!spatial lat=41.641184 long=-0.894032 radius=2 calc=arc unit=km} cafeteria" it works, but only the first time. When I run the same query again I get this error:
GRAVE: java.lang.NullPointerException
at nl.jteam.search.solrext.spatial.DistanceFieldValueSource.getValues(DistanceFieldValueSource.java:57)
at nl.jteam.search.solrext.spatial.GeoDistanceComponent.process(GeoDistanceComponent.java:60)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316)
I have no idea where is the error because the first time the query works and I get the computed distance in the "geo_distance" field. But when repeating the query, I get a NullPointerException.
This problem is fixed in version 1.0-RC5. This version has been released some days ago.

Resources