solrj

How to do Solr Dataimport (i.e from RDBMS) using Java API?

只愿长相守 提交于 2019-12-02 14:05:19
问题 I am new to Solr, actually I tried Database table indexing in Solr manually, i.e creating a new data-config.xml and running the full import from Solr webUI, successfully did that. But now I need to do the same thing in Java. So I need know the following things using Java: How to set Solr datasource in Java api How to set the entity and query How to run full import Actually, for data import we write a configuration file like below <?xml version="1.0" encoding="UTF-8" ?> <dataConfig>

Solrj to index document from Android

孤者浪人 提交于 2019-12-02 13:07:20
问题 I'm trying to index document using Solrj from my android application, but it seems to not work. I following this LINK This is the code I'm writing: package com.example.secondapp; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.IntentSender; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.view.View; import android.widget.Button;

Caused by: java.lang.ClassNotFoundException: org.apache.http.message.TokenParser

假如想象 提交于 2019-12-02 10:49:05
写完程序启动不报错,执行时总是报错 java.lang.ClassNotFoundException: org.apache.http.message.TokenParser 认真检查代码没问题,试了多次以后发现是 solrj和httpclient的 jar版本冲突 我原来的jar包版本为solrj-4.10.2,httpclient-4.5.5 改成solrj-4.10.2,httpclient-4.3.5就不报错了 Tips:看了别人的jar不需要引httpclient依赖,只用一个solrj依赖就会自动引入solrj-4.10.2,httpclient-4.3.5两个包,可能是因为我在parent工程里加了4.5.5版本的httpclient,然后依赖parent导致了问题 来源: https://www.cnblogs.com/murmansk/p/11742152.html

SolrJ Thread Safety

烈酒焚心 提交于 2019-12-02 08:00:32
问题 I am using CommonsHttpSolrServer in a Web Application. Is it safe to reuse the CommonsHttpSolrServer over multiple requests or should I instantiate a new object for each request? Could not find the answer in the API docs. 回答1: According to the documentation and the source comments, SolrJ is thread safe. However, be careful when you update solr. According to this post, the transactions are implemented per instance, not per queue. This means that each thread does not have it's own isolated

Missing mandatory unique key field error in SolrJ

冷暖自知 提交于 2019-12-02 07:50:35
I've this issue in my project. I read my .xlsx excel file using Apache Poi and I want to index them in my Solr core. I use SolrInputDocument to index reading file. Here is my java codes package org.solr; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util

SolrJ: Disable Autocommit

╄→гoц情女王★ 提交于 2019-12-02 07:46:43
We have an instance of Solr, where we've found that turning on autoCommit in the solrconfig.xml actually may serve our needs well. However there are some instances and some batch operations where we want to temporarily disable autocommit. I have not been able to find anything, but I'm wondering if anyone knew if via SolrJ you could disable autocommit for a certain process, and then re-enable it? You can't disable and enable autocommit as it's configured in solrconfig.xml. However, you can leave it disabled in solrconfig.xml and use commitWithin for those add commands that need autocommit .

How do Solrj pojo Java types map to Solr types?

我的梦境 提交于 2019-12-02 05:57:26
问题 I'm new to Solr, and I'm trying to use Solrj pojo's to create my documents. Is there a mapping of Solr types to Java I should adhere to in my pojo's? is everything in the pojo a String? is there a magical mapping from Java basic types to Solr and it's transparent? This seems like a basic question but I can't find an answer. TIA. 回答1: You can map pojo with solr types using @Field annotation of solrj below is the example code import org.apache.solr.client.solrj.beans.Field; public class Person

SolrJ Thread Safety

巧了我就是萌 提交于 2019-12-02 05:11:34
I am using CommonsHttpSolrServer in a Web Application. Is it safe to reuse the CommonsHttpSolrServer over multiple requests or should I instantiate a new object for each request? Could not find the answer in the API docs. According to the documentation and the source comments, SolrJ is thread safe. However, be careful when you update solr. According to this post , the transactions are implemented per instance, not per queue. This means that each thread does not have it's own isolated transaction to work with. Rollback will rollback every call (regardless of originating thread) to the last

How to do Solr Dataimport (i.e from RDBMS) using Java API?

我的未来我决定 提交于 2019-12-02 04:00:49
I am new to Solr, actually I tried Database table indexing in Solr manually, i.e creating a new data-config.xml and running the full import from Solr webUI, successfully did that. But now I need to do the same thing in Java. So I need know the following things using Java: How to set Solr datasource in Java api How to set the entity and query How to run full import Actually, for data import we write a configuration file like below <?xml version="1.0" encoding="UTF-8" ?> <dataConfig> <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/test_db" user=

How do Solrj pojo Java types map to Solr types?

百般思念 提交于 2019-12-02 00:08:48
I'm new to Solr, and I'm trying to use Solrj pojo's to create my documents. Is there a mapping of Solr types to Java I should adhere to in my pojo's? is everything in the pojo a String? is there a magical mapping from Java basic types to Solr and it's transparent? This seems like a basic question but I can't find an answer. TIA. You can map pojo with solr types using @Field annotation of solrj below is the example code import org.apache.solr.client.solrj.beans.Field; public class Person { @Field private int id; @Field("first_name") private String firstName; @Field("last_name") private String