How to Ignore a Missing Field in Solr Request Parameters API? - solr

I have an old solr instance that has enabled a customer parameter in the json API, e.g.
?json.customParam="eeebc"
In order to upgrade Solr to a new version (on a new machine), I simply want to ignore it instead of solr returning an exception so some level of backward compatibility is possible. The current exception is:
Unknown top-level key in JSON request: customParam
I'm hoping there is some fairly simple way to just ignore that parameter using the schema/solrconfig etc.

Related

Apache solr search 3.4 version in coldfusion 11

Have an ecommerce application in coldfusion 11 which is using apache solr search feature for creating collection .
The built in solr version in it seems to be 3.4
When searching a word with space like 'console sink',it also brings result for products like console sink legs.
when the user expects to see the sink products. Hope that is fetching since the title contain the string
'console sink' along with legs. The sink products which are expected are also coming along with it,but in last pages.
Http request call format like this
http://localhost:8987/solr//select?indent=on&q="console sink"~10&start=0&rows=10&fl=*,score&wt=json
How can we handle to display the expected result(ie in the above case sink products instead of its parts) in top results of solr search?Any parameters to be passed?
Is it possible to upgrade the solr version without upgrading coldfusion version?

Can I query a new handler not in solr config?

I am using solr 5.4.0.
I want to create a new handler in solr say "X". This handler is not defined in solr config, but can I define this on run time and include it in query using the qt field?
The same way how we can replace the bq, qf etc fields for an already existing handler in solr config, is there a support for creating a new handler while issuing the solr query as well
I do not remember being able to create additional request handlers via API in Solr 5.4. You may be able to modify or XInclude a file on a filesystem and reload core. But that's a bit hacky.
In the latest versions of Solr, you do have
configuration API to override solrconfig.xml
request parameters API, that allow you to define parameter sets, which you can apply with useParams configuration or as a query parameter in the URL.

Retrieve schema info from HttpSolrServer and CloudSolrServer with SolrJ

HttpSolrServer/CloudSolrServer support the /schema request handler but that isn't supported on the EmbeddedSolrServer and I would like a way to access the same information using SolrJ (and without HTTP requests).
When using EmbeddedSolrServer, the instance is created by passing a CoreContainer to the constructor. Later, the CoreContainer can be queried for all (well, just the one in the case of an embedded server) SolrCores with the getCores() method. From any given SolrCore I can obtain its schema using getSchema().
I now want to do the same thing but with an HttpSolrServer server and a CloudSolrServer. They, however, don't seem to have a way to ask for the list of loaded SolrCores or CoreContainers or anything. I know about the CoreAdmin but that only retrieves the status of each core, with no way to get Java instances of SolrCore.
Is it possible to obtain a list of SolrCores from a HttpSolrServer/CloudSolrServer using SolrJ, and how is it done?
Since Solr 5.3 SolrJ has API for Schema Access - see SchemaRequest.
For example, to retrieve collection schema one can use (in Solr 7) :
CloudSolrClient client = ...;
SchemaRequest request = new SchemaRequest();
SchemaResponse response = request.process(client, "collectionName");
SchemaRepresentation schema = response.getSchemaRepresentation();

Search using SOLR is not up to date

I am writing an application in which I present search capabilities based on SOLR 4.
I am facing a strange behaviour: in case of massive indexing, search request doesnt always "sees" new indexed data. It seems like the index reader is not getting refreshed frequently, and only after I manually refresh the core from the Solr Core Admin window - the expected results will return...
I am indexing my data using JsonUpdateRequestHandler.
Is it a matter of configuration? do I need to configure Solr to reopen its index reader more frequently somehow?
Changes to the index are not available until they are commited.
For SolrJ, do
HttpSolrServer server = new HttpSolrServer(host);
server.commit();
For XML either send in <commit/> or add ?commit=true to the URL, e.g. http://localhost:8983/solr/update?commit=true

How to add data to the solr's schema

I try to add new data to the solandra according to the solr's schema but I can't find any example about this. My ultimate goal is to integrate solandra with django-solr.
What I understand about the insert and updating in the solr based on the original solr and django-solr is to send the new data on the http protocol to the decent path, for example:
http://localhost:8983/solandra/wikipedia/update/json
However, when I access the url, the browser keep telling me HTTP ERROR: 404.
Can you help me understand the step to add new data and delete the data in the solandra environment?
I also have a look at the reuters-demo, but the procedure to insert data is process in the file of reutersimporter.jar, but I can't see the source as well. So Please help me to understand how the system work in terms of data inserting and deleting.
Thank you.
Since you are using the JSON update handler, this UpdateJSON page on the Solr Wiki has some good examples of inserting data using the JSON handler via curl. Also, the Indexing Data section of the Solr Tutorial shows how you can insert data using the post.jar file that is included with the Solr source.
Are you creating the solr schema.xml and solrconfig.xml and posting it to solandra? If you add the JSON handler then this should work. The reutersdemo uses solrj. django-solr should work as well.

Resources