How can I retrieve the metrics from my Solr server using SolrJ? - solr

We are running Solr 8.4 and SolrJ 8.4. I can successfully retrieve about 18K lines of metrics using curl: curl 'http://localhost:1080/MySolr/admin/metrics'. How can I retrieve the same metrics using SolrJ?
I was unable to find any information in either the Solr or SolrJ documentation about this.
Any help is appreciated.

You make explicit use of the CommonParams.QT parameter to change the query path into any value.
query.setParam(CommonParams.QT, "/admin/metrics");
This lets you make a custom query to a path under a specific core name.

Related

SOLR query with DISMAX giving empty result with code and working fine with solr admin

I'm trying to query certain fields using "DISMAX Query Parser" , so the query is like below,
https://localhost:8983/solr/OOOOO/select?bq=country:PL^100.0&dType=dismax&defType=dismax&df=dismax&q=25392907{!boost}(%2B{!lucene+v%3D$yq})&qf=xxx_text
which is working fine in Solr Admin console but when trying to write logic via code and execute it the result is empty.
The query framed in code level,
yq=(25392907)&q={!boost}(%2B{!lucene+v%3D$yq})&bq=country:PL^100.0&defType=dismax&dType=dismax&df=dismax&qf=xxx_text
Need help on this query framing to understand more in solr.
Thanks !!
After solr 7.2 it doesn't support Local param {! for edismax.
https://lucene.apache.org/solr/guide/8_1/major-changes-in-solr-8.html

Test Solrnet resulting query url in Solr Admin

I am very new to SolrNet. So, I am not exactly sure how to test my queries in the Solr Admin tool. When I say Solr Admin tool I am referring to the web page UI that is used for testing queries, swapping cores, ect. I am trying to match my results in the Solr Admin with the results from my SolrNet query. The final generated query in my SolerNet application contains:
q=("Crystal"~4)(*Crystal*)&start=0&rows=24&fq=department:(eyeglasses)&fq=status:(active)&fq=brand_site_code:(CS)&facet=true&facet.field=gender&facet.field=department&facet.field=color&facet.field=frame_shape&facet.field=frame_material&facet.field=face_shape&facet.limit=-1&indent=on&bq=name:(Sullivan)&sort=has_images+desc%2cseller_rank+asc%2cin_stock+desc%2cbrand_rank+asc%2cname+desc&version=2.2&wt=xml
I am expecting the parameter bq=name:(Sullivan) to boost the name field to the top of the query if it is equal to "Sullivan". Can someone please tell me if this url is valid? Also, if someone could explain how I could test it in the Solr Admin I would very much appreciate it. Thank you!

Solr_query not working in terminal, but query can be executed on Solr admin page

I am using Solr within my datastax enterprise package.
I have created a cassandra cluster which is using Solr and created a Solr core which is working properly.
I am able to see my core on the Solr admin page.....and I can execute queries using the admin page.
However, when I attempt to use the string "solr_query" on my terminal to make a search, I am getting this error......
Bad Request: No search handler with name: solr_query found for Solr query: q=family_size%3A6, did you miss to configure it?
Any suggestions?
Thanks
In order to run CQL Solr queries in DSE Search 4.6 you have to configure a special purpose search handler in your solrconfig.xml, as described here: http://www.datastax.com/documentation/datastax_enterprise/4.6/datastax_enterprise/srch/srchCql.html

How to access solr using solrj

I'm new to solr and i'm trying to index some files using solrj. I already did http://lucene.apache.org/solr/api-3_6_1/doc-files/tutorial.html .
But now I would like to use solr with solrj. I would like to send pdf files and get them indexed.
I have already found a tutorial but i get CommonsHttpSolrServer is deprecated errors.
Are there any good tutorials around to use solrj? What jars do I need to import etc..?
You can find the solrj source & test codes inside the solr folder when you download apache-solr-src file.
In the following path you can find test codes for Solrj which will help you understand how to use Solrj.
apache-solr/solr/solrj/src/test

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