Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Allow codec configuration on BranchIndexWriter (currently blocks Lucene suggest fields)

オープン
#7 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
64/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
clojure, java

調査の方向性

src/java/org/replikativ/scriptum/BranchIndexWriter.java の createOver、create、open、forkLocked から始め、続いてそれらの IndexWriterConfig インスタンスを構築する公開ファクトリを追跡してください。src/clojure/scriptum/core.clj の Clojure エントリポイント、特に create-index と open-store-index を確認してください。既存のデフォルトを変更せず、フォーク中に作成される writer を含むすべての writer 構成にオプションの codec が渡れば完了です。

索引モデルが issue の本文から書いたものです。

説明

Checked against v0.1.30 (90dbd2a) / Lucene 10.3.2.

Problem

SuggestField
and ContextSuggestField
require a Codec
whose getPostingsFormatForField
returns a CompletionPostingsFormat
(Completion101PostingsFormat
for Lucene 10.3). That codec has to be set on the
IndexWriterConfig
before the IndexWriter
is constructed.

BranchIndexWriter
builds its IndexWriterConfig internally at four sites, and none of them call
setCodec:

Line Enclosing method
328 createOver
402 create
507 open
693 forkLocked

None of the public factories take a codec either; they stop at
create(basePath, branchName, analyzer, cryptoHash).

There is no post-construction escape hatch either.
getIndexWriter().getConfig()
returns a LiveIndexWriterConfig,
where the codec is read-only.

So a SuggestField can be handed to
addDocument(Iterable<? extends IndexableField>)
and will be accepted, but it cannot be indexed in a form
SuggestIndexSearcher
can query.

The read half already works.
openReader()
and openReaderAt(generation)
return a plain DirectoryReader,
which wraps in a SuggestIndexSearcher with no change to scriptum. Per-branch and
historical suggest queries come for free once the write path is unblocked.

Why it fits

Completion postings are ordinary per-segment files, so I would expect COW segment
sharing, fork, snapshot addresses and the merkle content-hash to cover them
unchanged. I have not tested that, and it is the part of this I am least sure of.
Autocomplete you can fork, or query at an older commit, seems like a reasonable
thing to want from a branched index, and ContextSuggestField maps onto
multi-tenant scoping.

Suggested shape

Accept an optional Codec on the create / createOver / open factories and
thread it to all four construction sites, with today's behavior as the default. An
IndexWriterConfig customizer such as a
UnaryOperator<IndexWriterConfig>
would be more general if you prefer that.

forkLocked
is the one I would watch. It builds a fresh config rather than inheriting the
parent's, so if it is missed a fork quietly loses its codec and only fails later,
at query time, on the branch rather than on main.

On the Clojure side this could be an option to
create-index
and open-store-index,
plus a :suggest field type in
add-doc.

lucene-suggest need not become a scriptum dependency. A codec parameter is
enough to let callers bring their own.

Two interactions to watch

  • BranchAwareMergePolicy
    will not merge all-shared segments, so segment count grows with branch and
    commit history. Completion FSTs are held per segment, so a suggest-heavy index
    would feel that as heap growth sooner than an ordinary index does.
  • For store-backed indices,
    warm!
    would want to cover the completion files. Otherwise a cold suggest query pays a
    round trip per file, like any other cold read.

I am happy to put up a PR if this shape sounds right. If you would rather expose
the whole IndexWriterConfig than just the codec, say so and I will follow that
instead.

主要言語
Clojure
スター
20
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

似ている issue

Clojure の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。