I want to write a script to compare results from a DataImportHandler to earlier results in an ETL process. The url I use in solr is:
http://HOSTNAME:PORT/solr/#/CORENAME/dataimport//dataimport
The Raw Status-Output has a nice JSON output with the information I need (documents fetched, etc) but I can't find anyway to return just this JSON output. Is there some argument I can give the URL or something? As it is I can't parse the page for the info I need.
You could use the LukeRequestHandler to get the state of the index.
If you set numTerms=0 you get a minimal output, with last index time.
In order to get json output, you can append wt=json&json.nl=map to your SOLR request querystring.
You can get it with: http://<host>:<port>/solr/dataimport?command=status&wt=json
If you want a pretty-printed output, pipe the body of the response to python -mjson.tool
Related
is it possible to use GrapdDB to create a curl SPARQL query with json-LD output (no export)?
Which parameter do I have to insert in the URL?
thank you in advance
In order to get results in JSON-LD format you should add the following to the URL:
Accept=application%2Fld%2Bjson
Please note that only DESCRIBE and CONSTRUCT queries support the JSON-LD format.
I think that you have to add a HTTP header and I don't think adding a query param will work. Eg:
curl -HAccept:application/ld+json http://localhost:7200/repositories/some/statements?query=CONSTRUCT...
Unfortunately, you can't specify a context or frame to be used for the output.
Whenever I query a string in solr, i want to get the synonyms of field value if there exists any as a part of query result, is it possible to do that in solr
There is no direct way to fetch the synonyms used in the search results. You can get close by looking at how Solr parsed your query via the debugQuery=true parameter and looking at the parsedQuery value in the response but it would not be straightforward. For example, if you search for "tv" on a text field that uses synonyms you will get something like this:
$ curl "localhost:8983/solr/your-core/select?q=tv&debugQuery=true"
{
...
"parsedquery":"SynonymQuery(Synonym(_text_:television _text_:televisions _text_:tv _text_:tvs))",
...
Another approach would be to load in your application the synonyms.txt file that Solr uses and do the mapping yourself. Again, not straightforward,
I currently have solr and carrot2 configured and working on my server. I am using the dcs example class for php provided in the DCS download from project.carrot2.org . For reference the class can be found here https://github.com/amoghtolay/clustering/blob/master/carrot2-dcs-3.6.2/examples/php5/
I have tried a few things to modify the query to descending order and alter the number of records returned. The query used from a browser that give the results I need is q=*:*&sort=_docid_%20desc&rows=20. Although when I alter the query by altering the equivalent to line 35 in example.php found in link above to match the query I need I get the following error message "An error occurred during processing: HTTP error occurred, error code: 500" having the query only set to *:* works fine but it not the information needed. Also, source is set to solr.
Could anyone provide some assistance in getting this working, thanks.
If you'd like to pass some extra parameters to the Solr request URL, you'll need need to append them to the SolrDocumentSource.serviceUrlBase attribute. You can specify the number of results using the results attribute.
I'm running Solr + Nutch and need to get a snippet of each result. I tried setting hl to true in the query URL but I still get the same XML result (without snippets). Any ideas on how to get this done?
You need to specify the fields that you want highlight results returned for by passing field names to the hl.fl parameter in your query. Please see HighlightingParameters on the Solr Wiki for more details and examples.
I needs to export doc_id, all fields, socr, rank of one search result to evaluate the results. How can I do this in solr?
Solr provides you with a CSV Response writer, which will help you to export the results of solr in an csv file.
http://localhost:8983/solr/select?q=ipod&fl=id,cat,name,popularity,price,score&wt=csv
All the fields queried would be returned by Solr in proper format.
This has nothing to do with SOLR. When you make a SOLR query over http, then SOLR does the search and returns the results to you in your desired format. The default is XML but lots of people specify wt=json to get results in json format. If you want this result in a text file, then make your search client put it there.
In the browser, File -> Save As.
But most people who want this use curl as the client and use the -o option like this:
curl -o result1.xml 'http://solr.local:8080/solr/stuff/select?indent=on&version=2.2&q=fish&fq=&start=0&rows=10&fl=*%2Cscore&qt=&wt=&explainOther=&hl.fl='
Note the single quotes around the URL due to the use of & characters.
There is not a built in export function in Solr. The easiest way would be to query your Solr instance and evaluate the XML result. Check out Querying Data in the Solr Tutorial for details on how to query a result from Solr. In order to convert the result into a text file, I would recommend using one of the Solr Clients found on the Integrating Solr page in the Solr Wiki and then choose your programming language of choice to create the text file.