Hi emmanuel!
Thanks for your assistance! In the meantime I was able to isolate the problem a bit more. It seems that the object structure causes the issue. Below the structure of my classes:
1. First I store location objects:
Code:
@Indexed
public class Location implements XMLConvertible {
@DocumentId
private Long locationId;
@IndexedEmbedded
private VCard card;
...
2. Associated with locations are vcards:
Code:
@Indexed
public class VCard {
@DocumentId
private Long id;
@Field(index=Index.TOKENIZED)
private String name;
@Field(index= Index.TOKENIZED)
private String firstName;
@Field(index= Index.TOKENIZED)
private String address;
@Field
private String zip;
...
Maybe I mis-configured something or I didn't completely understand how HS works but when I index Location objects manually (with fullTextSession.index(location)), HS insert the tokens flat:
Code:
Document<stored/uncompressed,indexed<_hibernate_class:ch.xy.server.model.Location> stored/uncompressed,indexed<locationId:80250> stored/uncompressed,indexed<card.id:162707> indexed,tokenized<card.name:Hotel Cafe Fischer> indexed,tokenized<card.address:Weienburger Str. 31> indexed,tokenized<card.zip:63739> indexed,tokenized<card.city:Aschaffenburg> indexed,tokenized<card.country:Deutschland> indexed,tokenized<card.latitude:49.9781> indexed,tokenized<card.longitude:9.14461>>
But when I insert a location via hibernate, HS creates two documents: one Location document (same code as above) and a VCard document like this:
Code:
Document<stored/uncompressed,indexed<_hibernate_class:ch.xy.server.model.VCard> stored/uncompressed,indexed<id:162707> indexed,tokenized<name:Hotel Cafe Fischer> indexed,tokenized<address:Weienburger Str. 31> indexed,tokenized<zip:63739> indexed,tokenized<city:Aschaffenburg> indexed,tokenized<country:Deutschland> indexed,tokenized<latitude:49.9781> indexed,tokenized<longitude:9.14461>>
The problem now encounters when i update a location: HS just updates the VCard document. Because I search in the location index for card.name for example lucene just finds the old value (inserted via initial update).
So my question is now: How can I handle a structure like this (and why HS inserts the information twice)? How can I insert the VCards with fullTextSession.index (and the link to the locations) and how can i search the vcards in the location, because there a also vcards associated with people?
Thanks a lot for your help!