I can't seem to get the very basic FieldBridge
implementation to work. It looks as if the indexing process is ignoring @FieldBridge
annotation completely.
Here's the implementation:
public class LocalisedInformationBridge implements FieldBridge {
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
luceneOptions.addFieldToDocument(name + ".test", "test", document);
}
}
Entity with the @FieldBridge
annotation:
@OneToMany(mappedBy = "product")
@MapKey(name = "languageCode")
@IndexedEmbedded
@FieldBridge(impl = LocalisedInformationBridge.class)
private Map<String, LocalisedProductInformation> localisedProductInformation;
Contained entity:
@ManyToOne
@JoinColumn(name="productId")
@ContainedIn
private Product product;
When I try to search on localisedProductInformation.test
field, I'm getting exception:
org.hibernate.search.exception.SearchException: Unable to find field localisedProductInformation.test
Here's how I'm indexing data:
FullTextEntityManager fullTextEntityManager =
Search.getFullTextEntityManager(entityManager);
fullTextEntityManager.createIndexer().startAndWait();
The weird thing is when I put a breakpoint on set
method of LocalisedInformationBridge
class, debugger doesn't stop the execution of the program. Is there something very obvious that I'm missing here?