solrj

Solrcloud Zookeper Setup : No registered leader was found after waiting for 4000ms , collection: c1 slice: shard2

梦想与她 提交于 2019-12-07 06:45:02
问题 Am using solr 4.10.3, I start solr via embedded jetty server in java. Am trying to configure solrcloud with 2 shards(Leaders). I have an external zookeeper setup, I point to zookeeper instance while starting solr like this. System.setProperty("zkHost", "192.168.2.21:2111"); System.setProperty("numShards", "2"); System.setProperty("collection.configName", "configuration1"); System.setProperty("bootstrap_confdir","/conf/zooconf"); I have two solr instances running, one in 8983 port & other in

Faceting using SolrJ and Solr4

走远了吗. 提交于 2019-12-07 06:32:09
问题 I've gone through the related questions on this site but haven't found a relevant solution. When querying my Solr4 index using an HTTP request of the form &facet=true&facet.field=country The response contains all the different countries along with counts per country. How can I get this information using SolrJ? I have tried the following but it only returns total counts across all countries, not per country: solrQuery.setFacet(true); solrQuery.addFacetField("country"); The following does seem

Solr/SolrJ: how to iterate results without creating a giant ArrayList

…衆ロ難τιáo~ 提交于 2019-12-07 05:37:10
问题 Is there a way to iterate over a Solrj response such that the results are fetched incrementally during iteration, rather than returning a giant in-memory ArrayList ? Or do we have to resort to this: SolrQuery query = new SolrQuery(); query.setQuery("*:*"); int fetchSize = 1000; query.setRows(fetchSize); QueryResponse rsp = server.query(query); long offset = 0; long totalResults = rsp.getResults().getNumFound(); while (offset < totalResults) { query.setStart((int) offset); // requires an int?

Querying Solr via Solrj: Basics

霸气de小男生 提交于 2019-12-07 02:42:31
问题 I am trying to query solr via solrj in Eclipse. I have tried the latest solrj wiki example: import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.params.ModifiableSolrParams; import java.net.MalformedURLException; public class SolrQuery2 { public static void main(String[] args) throws

How can use the /export request handler via SolrJ?

蹲街弑〆低调 提交于 2019-12-06 14:57:34
问题 I'm using Solr 4.10. I have enabled the /export request handler for an index by adding this to the solrconfig.xml (as mentioned here: https://cwiki.apache.org/confluence/display/solr/Exporting+Result+Sets): <requestHandler name="/export" class="solr.SearchHandler"> <lst name="invariants"> <str name="rq">{!xport}</str> <str name="wt">xsort</str> <str name="distrib">false</str> </lst> <arr name="components"> <str>query</str> </arr> </requestHandler> Now I can use: http://localhost:8983/solr

How to add shards dynamically to collection in solr?

末鹿安然 提交于 2019-12-06 10:31:19
Using the following query when I create the collection I set two shards for the collection10 . /solr/admin/collections?action=CREATE&name=collection10&numShards=2&replicationFactor=2 But what is my requirement is, I have to add 3rd shard dynamically after 10000 documents has been indexed in first two shards. Is it possible to add shards dynamically once we started the collection and indexing at existing shards? If it possible means how to add shards dynamically once after we started the collection? And also, is it possible to add replicas dynamically once we started the collection.For example

solr cannot delete anything

六眼飞鱼酱① 提交于 2019-12-06 09:25:59
I'm trying to delete documents on my solr server, but it doesn't work and I get no error. I tried deleting via browser, curl and solrj and nothing works. (browser and curl as explained here: Solr delete not working for some reason ) My solrj code is: server.deleteByQuery("*:*"); server.deleteById("*"); server.deleteById("guid:*"); server.commit(true, true); UpdateRequest update = new UpdateRequest(); update.deleteByQuery("*:*"); update.setCommitWithin(0); server.request(update); server.commit(true, true); SolrQuery query = new SolrQuery("*:*");//Search for everything/anything query.setRows(10)

How can I Ignore some fields in a SOLR query

给你一囗甜甜゛ 提交于 2019-12-06 08:07:43
I have Solr 5.3.1 and need to do query for all field except some field (what I need search in some field not retrieve fields this way to retrieve [/?q=query&fl=field1,field2,field3] ) i try with some solution but not work 1. How to exclude fields in a SOLR query [this soluation not work] 2.[the below solution work but take more time] query = field1:"+txtSearch+"OR field1:"+ txtSearch+" OR field1:"+txtSearch 3.I set indexed="false" in data-config.xml it only Ignore search in this field but when I search for all fields http://localhost:8983/solr/test?q=query the query search in all field

Solr, how to use the new field update modes (atomic updates) with SolrJ

独自空忆成欢 提交于 2019-12-06 03:30:26
Solr 4.x has this nice new feature that lets you specify how, when doing an update on an existing document, the multiValued fields will be updated. Specifically, you can say if the update document will replace the old values of a multivalued field with the new ones, or if it should append the new values to the existing ones. I've tried this using the request handler, as described here: http://wiki.apache.org/solr/UpdateXmlMessages#Optional_attributes_for_.22field.22 I've used curl to send xml where some fields used the update=add option: <field name="skills" update="add">Python</field> This

Searching for nested Documents in Solr(J)

 ̄綄美尐妖づ 提交于 2019-12-06 00:08:00
问题 I implemented a simple adding tool for PDF documents. I first create a master document (SolrInputDocument) of all documents. It gets fields like author, filehash, keywords, 'content_type=document' and so on. After that I generate a SolrInputDocument for every page, this object gets an id like 'parentID_p01', the page as a field value, 'content_type=page' usw. Finally, I add all page documents to my master document with addChildDocument().. Now my question is, how do I perform a search for a