solrj

Solr/Solrj: How can I determine the total number of documents in an index?

一个人想着一个人 提交于 2019-12-20 16:11:45
问题 How can I determine the total number of documents in a Solr index using Solrj? After hours of searching on my own, I actually have an answer (given below); I'm only posting this question so others can find the solution more easily. 回答1: Here's what I'm using. Is this canonical? Is there a better way? SolrQuery q = new SolrQuery("*:*"); q.setRows(0); // don't actually request any data return server.query(q).getResults().getNumFound(); 回答2: Your answer of sending the query : is probably the

Implementing Tagging and Excluding Filters with Solrj / Spring Data Solr

倖福魔咒の 提交于 2019-12-20 02:34:54
问题 I am trying to implement a Solr Facet search with multi-select on a field. To take this example: http://docs.lucidworks.com/display/solr/Faceting#Faceting-LocalParametersforFaceting, I would like to generate this call to solr: q=mainquery&fq=status:public&fq={!tag=dt}doctype:pdf&facet=on&facet.field={!ex=dt}doctype I am not sure how to call this using solrj (java) as I don't want to add a simple filed but I need to include the tagging and excluding (!tag=dt and !ex=dt). Any ideas what the

What is the default address of Solr Server (Solr 4.0) for use from a SolrJ client

旧街凉风 提交于 2019-12-19 17:37:39
问题 I'm trying to connect with Solr Server from a SolrJ client, but it gives an HTTPResponse Exception. Here's my code: SolrServer server = new HttpSolrServer("http://"localhost":8983/solr/"); Here's the exception: java.lang.NoClassDefFoundError: org/apache/http/NoHttpResponseException: Does Solr have a default address? Where can you find it? 回答1: I am not familiar with SolrJ - but the endpoint seems to be missing the core name to me. You would need to point your Solr client to a particular core.

What is the default address of Solr Server (Solr 4.0) for use from a SolrJ client

荒凉一梦 提交于 2019-12-19 17:37:20
问题 I'm trying to connect with Solr Server from a SolrJ client, but it gives an HTTPResponse Exception. Here's my code: SolrServer server = new HttpSolrServer("http://"localhost":8983/solr/"); Here's the exception: java.lang.NoClassDefFoundError: org/apache/http/NoHttpResponseException: Does Solr have a default address? Where can you find it? 回答1: I am not familiar with SolrJ - but the endpoint seems to be missing the core name to me. You would need to point your Solr client to a particular core.

create new core directories in SOLR on the fly

╄→гoц情女王★ 提交于 2019-12-19 14:49:20
问题 i am using solr 1.4.1 for building a distributed search engine, but i dont want to use only one index file - i want to create new core "index"-directories on the fly in my java code. i found following rest api to create new cores using an EXISTING core directory (http://wiki.apache.org/solr/CoreAdmin). http://localhost:8983/solr/admin/cores?action=CREATE&name=coreX&instanceDir=path_to_instance_directory&config=config_file_name.xml&schema=schem_file_name.xml&dataDir=data is there a way to

Solr rule based boost

北慕城南 提交于 2019-12-18 13:23:34
问题 I am using Solr-5.0.0 . I am searching on a field product_name . I need to add some rules to get relevant results. If I search for a word, if exact match exists , it should come first. Ex: if I search for laptop ,it should return exact product_name with laptop first. If I search for more than one word , it should obey rule 1. along with least word length distanced names come first. Ex: if I search dell laptop , it should return Dell laptop first than dell inspiron laptop . If I search for

Indexing PDF with Solr

∥☆過路亽.° 提交于 2019-12-18 12:54:43
问题 Can anyone point me to a tutorial. My main experience with Solr is indexing CSV files. But I cannot find any simple instructions/tutorial to tell me what I need to do to index pdfs. I have seen this: http://wiki.apache.org/solr/ExtractingRequestHandler But it makes very little sense to me. Do I need to install Tika? Im lost - please help 回答1: With solr-4.9 (the latest version as of now), extracting data from rich documents like pdfs, spreadsheets(xls, xlxs family), presentations(ppt, ppts),

How Get Suggestions from Solr Server in a PHP variable

旧时模样 提交于 2019-12-18 07:07:30
问题 I've got this problem that I can't solve. Partly because I can't explain it with the right terms. I'm new to this so sorry for this clumsy question. Below you can see an overview of my goal. I'm using Magento CE 1.7.0.2 & Solr 4.6.0. Working with Spell checker in Solr I'm Searching with iphon instead of iphone the solr Spell Checker throwing these suggestions. <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">48</int> </lst> <str name="command">build</str>

How to add shards dynamically to collection in solr?

筅森魡賤 提交于 2019-12-14 03:43:58
问题 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

Solrj DeleteByQuery is not working

点点圈 提交于 2019-12-13 07:13:53
问题 I have spent more than 3 hours of time to fix this issue, but unfortunately i am not able to fix it. Can anyone help me on this ? Here is the exception i am getting while running deletebyQuery using solrj while adding to solr is working. Note : deletebyQuery is not working but add is working. org.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: http://localhost:8090/solr/abc at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod