java - Lucene index not updated with Hibernate Search and Spring Data -


i getting started hibernate search/lucene using spring boot , spring data, having issue index not getting updated (checked luke tool).

i have 3 classes in domain. datasheet, root entity:

@entity @indexed public class datasheet {      @id     @generatedvalue()     private long m_id;      @field(name="name")      private string m_name;      @field(name="description")     private string m_description;      @indexedembedded(prefix = "documents.")     @onetomany(cascade = cascadetype.remove)     private set<datasheetdocument> m_documents; } 

then datasheetdocument:

@entity public class datasheetdocument {     @id     @generatedvalue()     private long m_id;      private string m_originalfilename;      @field(name="componentname")     private string m_componentname;      @indexedembedded(prefix = "manufacturer.")     @manytoone     private manufacturer m_manufacturer; } 

and manufacturer:

@entity public class manufacturer {     @id     @generatedvalue()     private long m_id;      @field(name="name", analyze = analyze.no)     private string m_name;      private string m_website; } 

when explicitly call startandwait() on indexer (org.hibernate.search.massindexer), expected in index. contains fields name, description, documents.componentname , documents.manufacturer.name.

however, when updates through @restcontroller classes call spring data crudrepository classes, index only changes when changing direct field of datasheet (e.g. name or description). changing datasheetdocument instances not update index. idea why might be?

note have tried add backreferences parent. datasheetdocument:

@manytoone @containedin private datasheet m_datasheet; 

and manufacturer:

@manytomany @containedin private set<datasheetdocument> m_datasheetdocuments; 

but not help.

i using spring boot 1.0.1 includes hibernate 4.3.1. added hibernate search 4.5.1. see lucense 3.6.2 gets added transitively well.

you need references sure. without them , in particular without @containedin there no way search know has update datasheet index when datasheetdocument instance changes.

have added mappedby 1 many side?

@onetomany(cascade = cascadetype.remove, mappedby="m_datasheet") private set<datasheetdocument> m_documents; 

also, how update datasheetdocument? can show code? either way, need make associations bi-directional start with.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -