Hi,
I'm having problems reindexing from db, and i suspect it's because one of my fields is mapped with @FieldBridge annotation, where i have a list of items and i decide how to index them. When i reindex from db, i only get id, created, modified and location. None of the metadata is indexed. i suspect it has something to do with the @FieldBridge or @Analyzer. here's the mapping:
public class MediaItemEntity implements Serializable { @Id @DocumentId private String id; @Column(name = "uri", length = 1000, nullable = false) private String uri; @Column(name = "sourceItemURI", length = 1000) private String sourceItemURI; @IndexedEmbedded() @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) private MediaLocationEntity location; @Temporal(TemporalType.TIMESTAMP) @Column(name = "created", updatable = false, nullable = false) @Field(index = Index.UN_TOKENIZED) @DateBridge(resolution = Resolution.DAY) private Date created; @Temporal(TemporalType.TIMESTAMP) @Column(name = "modified", nullable = false) @Field(index = Index.UN_TOKENIZED) @DateBridge(resolution = Resolution.DAY) private Date modified; @CollectionOfElements() @Type(type = "com.espn.metadatastore.impl.jpa.MetadataValueType") @JoinTable(name = "media_item_metadata", joinColumns = @JoinColumn(name = "media_item_id")) @Columns(columns = {@Column(name = "metadata_key"), @Column(name = "readable_value"), @Column(name = "object_value")}) @Field(bridge = @FieldBridge(impl = MetadataFieldsBridge.class), analyzer = @Analyzer(impl = MetadataFieldsAnalyzer.class)) private List<MetadataProperty> metadata; @PrePersist private void prePersist() { created = new Date(); modified = created; }
@PreUpdate private void preUpdate() { modified = new Date(); }
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public String getUri() { return uri; }
public void setUri(String uri) { this.uri = uri; }
public MediaLocationEntity getLocation() { return location; }
public void setLocation(MediaLocationEntity location) { this.location = location; }
public void setMetadata(List<MetadataProperty> metadata) { this.metadata = metadata; }
public List<MetadataProperty> getMetadata() { return metadata; }
public Date getCreated() { return created; }
public Date getModified() { return modified; }
public void setCreated(Date created) { this.created = created; }
public void setModified(Date modified) { this.modified = modified; }
public String getSourceItemURI() { return sourceItemURI; }
public void setSourceItemURI(String sourceItemURI) { this.sourceItemURI = sourceItemURI; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((uri == null) ? 0 : uri.hashCode()); return result; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MediaItemEntity other = (MediaItemEntity) obj; if (uri == null) { if (other.uri != null) return false; } else if (!uri.equals(other.uri)) return false; return true; } }
Please help this is causing me lots of problems. Using hibernate search 3.0.1. Using FullTextEntityManager.index to reindex.
Thank you!
|