Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Re-enable HTextFlowTarget indexing (for TM), but leave DB search enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Oct 25, 2012
1 parent ec3e188 commit ceed250
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions zanata-model/src/main/java/org/zanata/model/HTextFlowTarget.java
Expand Up @@ -31,6 +31,7 @@
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
Expand All @@ -41,16 +42,29 @@
import javax.persistence.PreUpdate;
import javax.persistence.Transient;

import org.hibernate.annotations.AccessType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CollectionOfElements;
import org.hibernate.annotations.IndexColumn;
import org.hibernate.annotations.NaturalId;
import org.hibernate.annotations.Type;
import org.hibernate.search.annotations.AnalyzerDiscriminator;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FieldBridge;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Parameter;
import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;
import org.zanata.common.ContentState;
import org.zanata.common.HasContents;
import org.zanata.hibernate.search.ContentStateBridge;
import org.zanata.hibernate.search.IndexFieldLabels;
import org.zanata.hibernate.search.LocaleIdBridge;
import org.zanata.hibernate.search.StringListBridge;
import org.zanata.hibernate.search.TextContainerAnalyzerDiscriminator;
import com.google.common.base.Objects;

Expand All @@ -68,6 +82,7 @@
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Indexed
@Setter
@NoArgsConstructor
public class HTextFlowTarget extends ModelEntityBase implements HasContents, HasSimpleComment, ITextFlowTargetHistory, Serializable
Expand Down Expand Up @@ -112,12 +127,16 @@ public HTextFlowTarget(HTextFlow textFlow, HLocale locale)
@NaturalId
@ManyToOne
@JoinColumn(name = "locale", nullable = false)
@Field(index = Index.UN_TOKENIZED)
@FieldBridge(impl = LocaleIdBridge.class)
public HLocale getLocale()
{
return locale;
}

@NotNull
@Field(index = Index.UN_TOKENIZED)
@FieldBridge(impl = ContentStateBridge.class)
@Override
public ContentState getState()
{
Expand All @@ -144,6 +163,8 @@ public HPerson getLastModifiedBy()
@NaturalId
@ManyToOne
@JoinColumn(name = "tf_id")
//@Field(index = Index.UN_TOKENIZED)
//@FieldBridge(impl = ContainingWorkspaceBridge.class)
@IndexedEmbedded
public HTextFlow getTextFlow()
{
Expand Down Expand Up @@ -176,6 +197,12 @@ public void setContent(String content)
@Override
@Transient
@NotEmpty
// TODO extend HTextContainer and remove this
@Field(name=IndexFieldLabels.CONTENT,
index = Index.TOKENIZED,
bridge = @FieldBridge(impl = StringListBridge.class,
params = {@Parameter(name="case", value="fold"),
@Parameter(name="ngrams", value="multisize")}))
@AnalyzerDiscriminator(impl = TextContainerAnalyzerDiscriminator.class)
public List<String> getContents()
{
Expand Down

0 comments on commit ceed250

Please sign in to comment.