ドキュメント ID にはどの long 型フィールドタイプを使うべきでしょうか? LongPointField は動作せず、TrieLongField は非推奨になっています。 | KandaSearch Community Support Forum

ドキュメント ID にはどの long 型フィールドタイプを使うべきでしょうか? LongPointField は動作せず、TrieLongField は非推奨になっています。

トピック作成者:ks-solruserml-bot (2025/10/24 18:25 投稿)
2
OpenOpen

(The bot translated the original post https://lists.apache.org/thread/9cwppdh8j5ygpslbfqkjlnoo1rmstynv into Japanese and reposted it under Apache License 2.0. The copyright of posted content is held by the original poster.)

こんにちは。

ドキュメント ID 値に LongPointField を使おうとして苦労しています。

<fieldType name="long_dv" class="solr.LongPointField" docValues="true" />
<field name="id" type="long_dv" indexed="true" stored="true"
docValues="true" required="true" />
<uniqueKey>id</uniqueKey>

これでコアを作成しようとすると、次のエラーしか出ません:

Error CREATEing SolrCore 'test': Unable to create core [test] Caused by:
uniqueKey field (id) can not be configured to use a Points based FieldType: long

一方、上記の fieldType を次のように変更するとコア作成はすぐに正常に動作します:

<fieldType name="long_dv" class="solr.TrieLongField" docValues="true" />

しかしリファレンスガイド(cf.
https://solr.apache.org/guide/solr/latest/indexing-guide/field-types-included-with-solr.html)には、

TrieLongField: LongPointField を代わりに使用すること

と書かれています。

そこで質問です:
Solr 9.8 でドキュメント ID を long 型にするには、エラーにならず、かつ非推奨の long 型を使わずに、どのように設定すればよいでしょうか?

どんな助けでもありがたいです。

ありがとうございます。
Marc

返信投稿者:ks-solruserml-bot (2025/10/24 18:25 投稿)

識別子の整数を solr.StringField として保存しています。桁数の異なる識別子の範囲が不要であれば、非常にうまく動作します。もし範囲検索や識別子でのソートが必要なら、左側にゼロを詰めて固定長にした方が良いと思います。つまり、典型的な printf 構文で言えば、12 桁の 10 進数なら "%012d"、16 進数が良ければ "%012X" といった具合です。

<field name="buchID" type="id" indexed="true" stored="true"/>
<fieldType name="id" class="solr.StrField"/>
<uniqueKey>buchID</uniqueKey>

非推奨にはなっていますが、TrieLongField を試してみるのもありかもしれません。

本来の 正しい 方法は UUID を使うことだと思いますが、それがどう動くのかは分かりません。

返信投稿者:ks-solruserml-bot (2025/10/24 18:25 投稿)

自分のメモにちょっとだけ補足します:

識別子の ソートや範囲指定をしたい場合 は、当然ですがフィールド定義に 'docValue="true"' を追加する必要があります。

トピックへ返信するには、ログインが必要です。

KandaSearch

Copyright © 2006-2025 RONDHUIT Co, Ltd. All Rights Reserved.

投稿の削除

この投稿を削除します。よろしいですか?