How to start an optimize in SolrJ without waiting for it to complete?
This is my solrj code: UpdateRequest req = new UpdateRequest("/" + _name + "/update"); req.setAction(UpdateRequest.ACTION.OPTIMIZE, false, false); UpdateResponse ur = req.process(_client); The _name variable contains the name of the core, and _client is a 5.0 SolrClient, specifically HttpSolrClient. I'm trying to kick off an optimize against a specific core without waiting for it to finish. All my research and testing says that this is safe to do as long as the Solr server is at least 4.0. The servers that this code runs against are 4.7.2 and 4.9.1. This is the resulting log entry: INFO - 2015-05-01 03:30:34.689; org.apache.solr.update.processor.LogUpdateProcessor; [s1build] webapp=/solr path=/update params={optimize=true&waitSearcher=true&maxSegments=1&wt=javabin&version=2} {optimize=} 0 2 Notice the waitSearcher=true in that log. I have set both waitFlush and waitSearcher to false with setAction in my code. How do I successfully start an optimize and return immediately, without waiting for it to complete? Thanks, Shawn
Re: How to start an optimize in SolrJ without waiting for it to complete?
On 5/1/2015 7:23 AM, Shawn Heisey wrote: > This is my solrj code: > > UpdateRequest req = new UpdateRequest("/" + _name + "/update"); > req.setAction(UpdateRequest.ACTION.OPTIMIZE, false, false); > UpdateResponse ur = req.process(_client); Followup. I must not have actually been running that code, because when I created a test program and ran it, I got this in the log: INFO - 2015-05-01 08:04:02.246; org.apache.solr.update.processor.LogUpdateProcessor; [s5live] webapp=/solr path=/update params={optimize=true&waitSearcher=false&maxSegments=1&wt=javabin&version=2} {optimize=} 0 1221053 Now waitSearcher is set to false, but the call in SolrJ still took over 20 minutes, when what I was after was an immediate return. Will I need to start a separate thread to allow my program to continue running while an optimize is happening? Thanks, Shawn
RE: How to start an optimize in SolrJ without waiting for it to complete?
If I recall correctly, waitSearcher only affects the opening of the new Searcher, and not the part of the optimize where the segments are being merged together (the long part). I took a quick look at DirectUpdateHandler2, and I don't see anything to allow the request to return immediately. I think you'll need to run it on a separate thread. -Michael -Original Message- From: Shawn Heisey [mailto:apa...@elyograg.org] Sent: Friday, May 01, 2015 10:09 AM To: solr-user@lucene.apache.org Subject: Re: How to start an optimize in SolrJ without waiting for it to complete? On 5/1/2015 7:23 AM, Shawn Heisey wrote: > This is my solrj code: > > UpdateRequest req = new UpdateRequest("/" + _name + "/update"); > req.setAction(UpdateRequest.ACTION.OPTIMIZE, false, false); > UpdateResponse ur = req.process(_client); Followup. I must not have actually been running that code, because when I created a test program and ran it, I got this in the log: INFO - 2015-05-01 08:04:02.246; org.apache.solr.update.processor.LogUpdateProcessor; [s5live] webapp=/solr path=/update params={optimize=true&waitSearcher=false&maxSegments=1&wt=javabin&version=2} {optimize=} 0 1221053 Now waitSearcher is set to false, but the call in SolrJ still took over 20 minutes, when what I was after was an immediate return. Will I need to start a separate thread to allow my program to continue running while an optimize is happening? Thanks, Shawn
Empty buckets when faceting over an EnumField or TrieIntField (5.1.0)
Hi, I’m having problems when faceting over an EnumField such as this: required="true" /> And in enumsConfig.xml: plants metazoa fungi A query such as the one below returns all buckets empty: curl http://localhost:8983/solr/enumTest/query -d ' { query: "*:*", facet : { kingdom : {terms : kingdom} } }' {... "facets":{ "count":17, "kingdom":{ "buckets":[]}}} If I turn the kingdom field to be a string, then faceting works as expected. The same happens with TrieIntField (aggregating functions like avg work but unique doesn’t). This worked in Heliosearch. Has anybody had any similar problems? Am I missing something? Thank you in advance. Alfonso
Re: Empty buckets when faceting over an EnumField or TrieIntField (5.1.0)
I forgot to add my "kingdomEnum" definition in schema.xml: enumsConfig="enumsConfig.xml" enumName="kingdom"/> On 01/05/2015 16:38, Alfonso Muñoz-Pomer Fuentes wrote: Hi, I’m having problems when faceting over an EnumField such as this: And in enumsConfig.xml: plants metazoa fungi A query such as the one below returns all buckets empty: curl http://localhost:8983/solr/enumTest/query -d ' { query: "*:*", facet : { kingdom : {terms : kingdom} } }' {... "facets":{ "count":17, "kingdom":{ "buckets":[]}}} If I turn the kingdom field to be a string, then faceting works as expected. The same happens with TrieIntField (aggregating functions like avg work but unique doesn’t). This worked in Heliosearch. Has anybody had any similar problems? Am I missing something? Thank you in advance. Alfonso
Re: Empty buckets when faceting over an EnumField or TrieIntField (5.1.0)
This is unsupported at the moment and the devs ara aware of the issue. https://issues.apache.org/jira/browse/SOLR-7497 On 01/05/2015 16:53, Alfonso Muñoz-Pomer Fuentes wrote: I forgot to add my "kingdomEnum" definition in schema.xml: On 01/05/2015 16:38, Alfonso Muñoz-Pomer Fuentes wrote: Hi, I’m having problems when faceting over an EnumField such as this: And in enumsConfig.xml: plants metazoa fungi A query such as the one below returns all buckets empty: curl http://localhost:8983/solr/enumTest/query -d ' { query: "*:*", facet : { kingdom : {terms : kingdom} } }' {... "facets":{ "count":17, "kingdom":{ "buckets":[]}}} If I turn the kingdom field to be a string, then faceting works as expected. The same happens with TrieIntField (aggregating functions like avg work but unique doesn’t). This worked in Heliosearch. Has anybody had any similar problems? Am I missing something? Thank you in advance. Alfonso