solrj

How to get last indexed record in Solr?

孤街浪徒 提交于 2020-01-21 03:07:35
问题 I want to know how to get/search last indexed record in Apache Solr..? When the existing record is updated then it goes to end of all the records...so I want to get that last indexed record. thanks.. 回答1: You could add a 'timestamp' field to your Solr schema that puts the current date/time into the record when it is added. <field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/> Then, do a sort in descending order by this field and the first record

Solr Composite Unique key from existing fields in schema

删除回忆录丶 提交于 2020-01-19 05:28:59
问题 I have an index named LocationIndex in solr with fields as follows: <fields> <field name="solr_id" type="string" stored="true" required="true" indexed="true"/> <field name="solr_ver" type="string" stored="true" required="true" indexed="true" default="0000"/> // and some more fields </fields> <uniqueKey>solr_id</uniqueKey> But now I want to change schema so that unique key must be composite of two already present fields solr_id and solr_ver ... something as follows: <fields> <field name="solr

Solr Composite Unique key from existing fields in schema

本秂侑毒 提交于 2020-01-19 05:26:29
问题 I have an index named LocationIndex in solr with fields as follows: <fields> <field name="solr_id" type="string" stored="true" required="true" indexed="true"/> <field name="solr_ver" type="string" stored="true" required="true" indexed="true" default="0000"/> // and some more fields </fields> <uniqueKey>solr_id</uniqueKey> But now I want to change schema so that unique key must be composite of two already present fields solr_id and solr_ver ... something as follows: <fields> <field name="solr

Solr query issue with Faceting and Stats in dse

独自空忆成欢 提交于 2020-01-16 18:02:06
问题 Query : http://localhost:8983/solr/trackfleet_db.location/select?q=*:*&facet=true&facet.pivot={!stats=piv1}date,latitude,longitude&stats=true&stats.field={!tag=piv1}gpsdt When I execute this query on a separate solr instance (which is not an instance of DSE) then this query works fine. But in case of dse (Now I am using in built Solr of DSE) then it does not return anything ....And when I execute this query using curl command then it is giving following error <?xml version="1.0" encoding="UTF

How to set ResponseWriter to non-default in Solr

那年仲夏 提交于 2020-01-15 11:49:07
问题 I have the following code, which is simply searching the Solr Server. SolrServer server = new CommonsHttpSolrServer(url); SolrQuery searchquery = new SolrQuery("company profile"); QueryResponse response = server.query(searchquery) I want to have the response in json, other than the default which is xml. So I went into the solrconfig.xml file and enabled the following line: <queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter" /> However, from the console, I'm

SolrJ集成步骤

梦想的初衷 提交于 2020-01-15 00:53:54
最开始先在pom文件导入solr <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-solrj</artifactId> <version>5.3.1</version> </dependency> 第一步:创建solr查询的接收对象 每个属性配置上Field属性 第二步:编写客户端程序 1.创建HttpSolrClient对象 2.创建SolrQuery对象 3.创建QueryResponse数据接收对象 4.接收数据,转化数据 package cn.solrDemo; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.client.solrj.impl.XMLResponseParser; import org.apache.solr.client.solrj.response.QueryResponse; import java.io.IOException; import java

Solrcloud delete collection bug?

依然范特西╮ 提交于 2020-01-13 19:07:05
问题 First,I create a collection called usercollection : http://xxxxx/solr/admin/collections?action=CREATE&name=usercollection&numShards=3&replicationFactor=3&maxShardsPerNode=3 Then I found something wrong, so I delete it. http://xxxx/solr/admin/collections?action=DELETE&name=usercollection At last ,I want to create the collection again. And I found something wrong. `May 16, 2013 8:32:23 PM org.apache.solr.cloud.OverseerCollectionProcessor run INFO: Overseer Collection Processor: Get the message

Solr exact word result come first

强颜欢笑 提交于 2020-01-12 10:49:20
问题 In Solr-5.0.0, I have one product_name field. When I search for a word or more than words, its giving results with product names that contain the words. How can I make it as the exact match come first. My Schema.xml is below: <field name="product_name" type="text_wslc" indexed="true" stored="true" required="true" multiValued="false"/> and my field definition is also given below: <fieldType name="text_wslc" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer

java.lang.VerifyError: Cannot inherit from final class when using spring boot data solr

≡放荡痞女 提交于 2020-01-07 07:42:32
问题 I have a rest web service that running with spring boot 1.4.2.RELEASE. I trying to use spring data solr with my project but I am getting a VerifyError. Caused by: java.lang.VerifyError: Cannot inherit from final class at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_40-ea] at java.lang.ClassLoader.defineClass(ClassLoader.java:760) ~[na:1.8.0_40-ea] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_40-ea] at java.net.URLClassLoader.defineClass

solrj : expicit commit required after add?

拥有回忆 提交于 2020-01-04 09:28:09
问题 I am using the solrClient.add(SolrInputDocument doc) method to add documents, one by one, to my solr . after this i explicitly call solrClient.commit() Is it required? , I have seen some add methods, which specify a delay for commit . What does this mean, does the simple add method does not commit, or if it does, after how long? 回答1: In Solr we have mainly two different types of commit: Hard commit : This is governed by the autoCommit option in solrconfig.xml or explicit calls from a client