given ...
Code:
public class Post {
@Id()
@GeneratedValue(strategy = GenerationType.AUTO)
@DocumentId
private Long articleId ;
@Column(columnDefinition = "MEDIUMBLOB")
@Field(index=Index.TOKENIZED, store=Store.NO)
private String cleanedContent ;
// ........
}
public class GenericDAO <T, PK extends Serializable> extends
HibernateDaoSupport {
public PK create(T o) {
Serializable pk = getHibernateTemplate().save(o);
return (PK) pk;
}
}
I have several use cases that require the list of unique, stemmed words from Post.cleanedContent. Ideally we would fire off these use cases based on the insert into the index.
My challenge is in understanding the API and determining a place to insert our code.
It seems the @AnalyzerDef / @TokenizerDef / @TokenFilterDef might be one place. However, it didn't seem that a TokenFilter knew the @DocumentId of the field it was processing ?
Another place might be FullTextIndexEventListener.onPostInsert. However, it wasn't clear to me what org.hibernate.event.PostInsertEvent
contains regarding tokens. Perhaps PostInsertEvent.getState() contains tokens?
I'd really prefer not to repeat the token/stem process that hibernate search already does.
[/code]