このコンテンツは選択した言語では利用できません。
4.6.2. Custom Bridges
Custom bridges are available in situations where built-in bridges, or the bridge's String representation, do not sufficiently address the required property types.
4.6.2.1. FieldBridge リンクのコピーリンクがクリップボードにコピーされました!
リンクのコピーリンクがクリップボードにコピーされました!
For improved flexibility, a bridge can be implemented as a
FieldBridge
. The FieldBridge
interface provides a property value, which can then be mapped in the Lucene Document
. For example, a property can be stored in two different document fields.
Example 4.13. Implementing the FieldBridge Interface
In the following example, the fields are not added directly to the
Lucene Document
. Instead the addition is delegated to the LuceneOptions
helper. The helper will apply the options selected on @Field
, such as Store
or TermVector
, or apply the chosen @Boost
value.
It is recommended that
LuceneOptions
is delegated to add fields to the Document
, however the Document
can also be edited directly, ignoring the LuceneOptions
.
Note
LuceneOptions
shields the application from changes in Lucene API
and simplifies the code.