I'm trying to timeout Solr if it takes too long to run a query.
What I've tried:
According to Solr documentation there is timeAllowed parameter which does exactly what I'm looking for, I've tried to
add <int name="timeAllowed">50</int> to requestHadnler in solrConfig.xml;
add timeAllowed parameter to request URL:
localhost:8080/solr4/alfresco/select?q=*&timeAllowed=50
But it doesn't work (time to load results is more than provided value).
Why I want to do this: we implemented access right validation on Solr side and now for some vague queries like * it takes too much time for Solr to respond.
Probably it could be possible to close such connections from Alfresco or from web container but then such queries will internally run on Solr slowing down the server.
You need to insert timeAllowed in milliseconds. timeAllowed 50 - This means that you need to complete the request in 50 milliseconds.
Try timeAllowed 5000.
Related
I am trying increase the amount of term facets returned from a query.
I have first added -1 to the request handler in solrconfig.xml. It works fine if I query solr servers directly, but once I try to use the same query on Solrj client, it is still returns only 10 facets in the response. I have tried to add facet.limit param to the query explicitly for solrj, but still I am only seeing 10 facets in the response. Are there any kind of other params or configs needed for solrj to use unlimited amount of facets or increase the number of facets to something bigger than the default value?
p.s I have initially tried to post the question on the mail list of Solr, but for some reason it failed constantly to post there
edit: I have tried to use direct solr querying with the json.facets, and setting facet.limit value does not work work json.facets.
Okay, it was basically the json.facet part. Although the docs on https://lucene.apache.org/solr/guide/7_2/json-facet-api.html are for 7.2, the same rule applies for 6.1.0.
It is seriously confusing though, as setting the facet.limit value via solrconfig.xml or Solrj client fails silently and there docs do not mention about the issue for json.facets
I need the status about if solr has started running, whether the indexing is going on or it has been stopped unexpectedly or finished. Also about the results of the query I have given. Like that for every action performed there in the interface, I need to know it via java code.
To check Solr is running, whether solr is responding.
You can use the ping service of solr
refer solr ping
I am doing two very identical queries into Solr for the same search term, it gives me different results. Actually one is done using Solr Admin interface and another is using SolrNet - Client library.
Can anyone give me any explanation why this is happening, or what's wrong and how to fix. I'm out of idea!
http://localhost:8983/solr/demo/select?q=black%20samsung%20android%20smart%20phone&wt=json&indent=true&defType=edismax&mm=75%25
Gives 816 results - this one is done using Solr Admin.
http://localhost:8983/solr/demo/select?q=black%20samsung%20android%20smart%20phone&start=0&rows=2&qt=edismax&mm=75%25
Gives 10224 results - this one is done using SolrNet.
I have total 80k + test products.
The correct result is produced by doing query by Solr Admin.
The problem in the second query might be qt=edismax! Do you have defined any request handler like that?
I would suggest you to define defType in extra param while querying Solr using SolrNet.
We are usig solr 1.4.1 Dataimport handler to build our solr index. Whenver a record on table( where the DIH queries) is updated we call the DIH with a query that updates that solr record with the new values. Right now the problem is sometimes the solr records are not updated eventhough we see on the logs that solr query have been called when there is record update on the DB side. Is there anyway we can turn on solr to show us the follwing stuff onthe logs;
Show the SQL query it's executing
Results returned ( Both the count as well as the individual records).
Tried debugQuery=true but that does not give us the No.2(above) we are looking for.
Any help would be greatly appreciated
Thanks
s
You should be able to see the sql queries fired by Solr data import handler if you change your logging level to fine or finest.
You can dynamically change the logging level for solr.
You can also use http://wiki.apache.org/solr/DataImportHandler#Commands, the debug feature to sample test you data.
debugQuery would only help you debug search results and relevance.
The default configuration for solr of /admin/ping provided for load balancer health check integrates well with the Amazon ELB load balancer health checks.
However since we're using master-slave replication when we provision a new node, Solr starts up, and replication happens, but in the meantime /admin/ping return success before the index has replicated across from master and there are documents.
We'd like nodes to only be brought live once they have done the first replication and have documents. I don't see any way of doing this with /admin/ping PingRequestHandler - it always return success if the search succeeds, even with zero results.
Nor is there anyway of matching/not matching expected text in the response with the ELB health check configuration.
How can we achieve this?
To expand on the nature of the problem here, the PingRequestHandler will always return a success unless....
Its query results in an exception being thrown.
It is configured to use a healthcheck file, and that file is not found.
Thus my suggestion is that you configure the PingRequestHandler handler to use a healthcheck file. You can then use a cron job on your Solr system whose job is to check for the existence of documents and create (or remove) the healthcheck file accordingly. If the healthcheck file is not present, the PingRequestHandler will throw a HTTP 503 which should be sufficient for ELB.
The rough algorithm that I'd use...
Every minute, query http://localhost:8983/solr/select?q=*:*
If numDocs > 0 then touch /path/to/solr-enabled
Else rm /path/to/solr-enabled (optional, depending on your strictness)
The healthcheck file can be configured in the <admin> block, and you can use an absolute path, or a filename relative to the directory from which you have started Solr.
<admin>
<defaultQuery>solr</defaultQuery>
<pingQuery>q=*:*</pingQuery>
<healthcheck type="file">/path/to/solr-enabled</healthcheck>
</admin>
Let me know how that works out! I'm tempted to implement something similar for read slaves at Websolr.
I ran into an interesting solution here: https://jobs.zalando.com/tech/blog/zookeeper-less-solr-architecture-aws/?gh_src=4n3gxh1
It's basically a servlet that you could add to the Solr webapp and then check all of the cores to make sure they have documents.
I'm toying with a more sophisticated solution but haven't tested it/made much progress yet: https://gist.github.com/er1c/e261939629d2a279a6d74231ce2969cf
What I like about this approach (in theory) is the ability to check the replication status/success for multiple cores. If anyone finds an actual implementation of this approach please let me know!