Help us understand the problem. What is going on with this article?

Apache Solr 7.6 で日付のフィールドを使う

More than 1 year has passed since last update.

フィールドの定義

Typeに「pdate」を指定する

SolrJ での追加

format には「"yyyy-MM-dd'T'HH:flag_mm:ss"」を使う。

String urlString = "http://localhost:8983/solr/sandbox";
SolrClient solr = new HttpSolrClient.Builder(urlString).build();

SolrInputDocument document = new SolrInputDocument();
document.addField("id", "5");
document.addField("field_text_en", "This is test. for Date formatting ");
String dateNow = (new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss")).format(new Date());
document.addField("field_date", dateNow);
UpdateResponse response = solr.add(document);
System.err.println(response);
solr.commit();


oyahiroki
Hiroki Oya <oyahiroki> 自然言語処理技術者 NLP Engineer (2001-2018) IBMで自然言語処理ソリューションの開発 (IBM Watson) (2018-現在) 日産自動車で自然言語処理ソリューションの開発 --- #NLP4J Java 自然言語処理
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away