Skip to content

Commit

Permalink
HSEARCH-711 Updating test using the new Field parameters. Removing de…
Browse files Browse the repository at this point in the history
…fault parameter settings.
  • Loading branch information
hferentschik committed Sep 13, 2011
1 parent d174123 commit 7c95544
Show file tree
Hide file tree
Showing 99 changed files with 1,297 additions and 1,195 deletions.
Expand Up @@ -5,7 +5,6 @@
import javax.persistence.Id;

import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Store;

@Entity
Expand All @@ -23,7 +22,7 @@ public void setId(Integer id) {
this.id = id;
}

@Field(index = Index.TOKENIZED, store = Store.YES)
@Field(store = Store.YES)
public String getName() {
return name;
}
Expand Down
Expand Up @@ -11,12 +11,12 @@
import org.apache.solr.analysis.SnowballPorterFilterFactory;
import org.apache.solr.analysis.StandardTokenizerFactory;

import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.AnalyzerDef;
import org.hibernate.search.annotations.DateBridge;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Parameter;
Expand Down Expand Up @@ -56,7 +56,7 @@ public void setAuthors(Set<Author> authors) {
public Book() {
}

@Field(index = Index.TOKENIZED, store = Store.YES)
@Field(store = Store.YES)
@Analyzer(definition = "customanalyzer")
public String getTitle() {
return title;
Expand All @@ -76,7 +76,7 @@ public void setId(Integer id) {
this.id = id;
}

@Field(index = Index.TOKENIZED, store = Store.NO)
@Field(store = Store.NO)
@Analyzer(definition = "customanalyzer")
public String getSubtitle() {
return subtitle;
Expand All @@ -86,7 +86,7 @@ public void setSubtitle(String subtitle) {
this.subtitle = subtitle;
}

@Field(index = Index.UN_TOKENIZED, store = Store.YES)
@Field(analyze = Analyze.NO, store = Store.YES)
@DateBridge(resolution = Resolution.DAY)
public Date getPublicationDate() {
return publicationDate;
Expand Down
Expand Up @@ -92,7 +92,7 @@ private void initHibernate() {
}

private void index() {
FullTextSession ftSession = org.hibernate.search.Search.getFullTextSession( ( Session ) em.getDelegate() );
FullTextSession ftSession = org.hibernate.search.Search.getFullTextSession( (Session) em.getDelegate() );
try {
ftSession.createIndexer().startAndWait();
}
Expand All @@ -102,7 +102,7 @@ private void index() {
}

private void purge() {
FullTextSession ftSession = org.hibernate.search.Search.getFullTextSession( ( Session ) em.getDelegate() );
FullTextSession ftSession = org.hibernate.search.Search.getFullTextSession( (Session) em.getDelegate() );
ftSession.purgeAll( Book.class );
ftSession.flushToIndexes();
ftSession.close();
Expand All @@ -126,10 +126,10 @@ private Query searchQuery(String searchQuery) throws ParseException {

//lucene part
Map<String, Float> boostPerField = new HashMap<String, Float>( 4 );
boostPerField.put( bookFields[0], ( float ) 4 );
boostPerField.put( bookFields[1], ( float ) 3 );
boostPerField.put( bookFields[2], ( float ) 4 );
boostPerField.put( bookFields[3], ( float ) .5 );
boostPerField.put( bookFields[0], (float) 4 );
boostPerField.put( bookFields[1], (float) 3 );
boostPerField.put( bookFields[2], (float) 4 );
boostPerField.put( bookFields[3], (float) .5 );

FullTextEntityManager ftEm = org.hibernate.search.jpa.Search.getFullTextEntityManager( em );
Analyzer customAnalyzer = ftEm.getSearchFactory().getAnalyzer( "customanalyzer" );
Expand All @@ -145,5 +145,4 @@ private Query searchQuery(String searchQuery) throws ParseException {

return query;
}

}
Expand Up @@ -28,8 +28,8 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;

Expand All @@ -44,8 +44,8 @@ public class SimpleEmail {
@GeneratedValue
public Long id;

@Field(index = Index.UN_TOKENIZED)
@Column(name="recipient")
@Field(analyze = Analyze.NO)
@Column(name = "recipient")
public String to = "";

@Field(store = Store.COMPRESS)
Expand Down
@@ -1,7 +1,6 @@
package org.hibernate.search.test.integration.jtaspring;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
Expand All @@ -10,48 +9,49 @@
import javax.persistence.Table;

import org.apache.lucene.analysis.standard.StandardAnalyzer;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;
import org.hibernate.search.annotations.TermVector;

@Entity
@Table(name = "snert")
@Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL, region="snert")
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL, region = "snert")

// full text search
@Indexed(index="Snert")
@Indexed(index = "Snert")
@Analyzer(impl = StandardAnalyzer.class)

public class Snert {

@Id()
@GeneratedValue(strategy = GenerationType.AUTO)
@DocumentId
private Long id;

@Column(nullable=true)
@Column(nullable = true)
private Date birthday;

@Column(length = 255)
@Field(index = Index.TOKENIZED, store = Store.NO, termVector = TermVector.YES)
@Field(termVector = TermVector.YES)
private String name;
@Column(length=24)

@Column(length = 24)
private String nickname;
@Field(index=Index.UN_TOKENIZED, store=Store.NO)

@Field(analyze = Analyze.NO)
private Boolean cool;
@Column(name="readCount")
@Field(index=Index.UN_TOKENIZED, store=Store.YES)

@Column(name = "readCount")
@Field(analyze = Analyze.NO, store = Store.YES)
private int age;

public Snert() {
}

Expand Down Expand Up @@ -139,5 +139,5 @@ public void setAge(int age) {
this.age = age;
}


}
Expand Up @@ -29,7 +29,6 @@

import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;

/**
Expand All @@ -42,9 +41,9 @@ public class Construction {
@GeneratedValue
@DocumentId
private Integer id;
@Field(index = Index.TOKENIZED)
@Field
private String name;
@Field(index = Index.TOKENIZED)
@Field
private String address;


Expand Down
Expand Up @@ -27,9 +27,9 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;

/**
Expand All @@ -42,9 +42,9 @@ public class Worker {
@GeneratedValue
@DocumentId
private Integer id;
@Field(index = Index.TOKENIZED)
@Field
private String name;
@Field(index = Index.UN_TOKENIZED)
@Field(analyze = Analyze.NO)
private int workhours;


Expand Down
Expand Up @@ -27,9 +27,9 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;

/**
Expand All @@ -42,11 +42,11 @@ public class Detective {
@GeneratedValue
@DocumentId
private Integer id;
@Field(index = Index.TOKENIZED)
@Field
private String name;
@Field(index = Index.TOKENIZED)
@Field
private String physicalDescription;
@Field(index = Index.UN_TOKENIZED)
@Field(analyze = Analyze.NO)
private String badge;


Expand Down
Expand Up @@ -30,7 +30,6 @@

import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;

/**
Expand All @@ -43,11 +42,11 @@ public class Suspect {
@GeneratedValue
@DocumentId
private Integer id;
@Field(index = Index.TOKENIZED)
@Field
private String name;
@Field(index = Index.TOKENIZED)
@Field
private String physicalDescription;
@Field(index = Index.TOKENIZED)
@Field
@Column(length = 500)
private String suspectCharge;

Expand Down
Expand Up @@ -27,15 +27,15 @@
import javax.persistence.Id;
import javax.persistence.Lob;

import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Boost;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Boost;

/**
* Example of 2 entities mapped in the same index
*
* @author Emmanuel Bernard
*/
@Entity
Expand Down Expand Up @@ -67,7 +67,7 @@ public void setId(Long id) {
this.id = id;
}

@Field( name = "alt_title", store = Store.YES, index = Index.TOKENIZED )
@Field(name = "alt_title", store = Store.YES)
@Boost(2)
public String getTitle() {
return title;
Expand All @@ -77,7 +77,7 @@ public void setTitle(String title) {
this.title = title;
}

@Field( name="Abstract", store = Store.NO, index = Index.TOKENIZED )
@Field(name = "Abstract", store = Store.NO)
public String getSummary() {
return summary;
}
Expand All @@ -87,7 +87,7 @@ public void setSummary(String summary) {
}

@Lob
@Field( store = Store.NO, index = Index.TOKENIZED )
@Field(store = Store.NO)
public String getText() {
return text;
}
Expand Down
Expand Up @@ -28,7 +28,6 @@

import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;

Expand All @@ -46,15 +45,17 @@ public Clock(Integer id, String brand) {
this.brand = brand;
}

@Field(index= Index.TOKENIZED, store= Store.YES) public String getBrand() {
@Field(store = Store.YES)
public String getBrand() {
return brand;
}

public void setBrand(String brand) {
this.brand = brand;
}

@Id @DocumentId
@Id
@DocumentId
public Integer getId() {
return id;
}
Expand Down
Expand Up @@ -63,7 +63,7 @@ public void setId(Long id) {
this.id = id;
}

@Field(store = Store.YES, index = Index.TOKENIZED)
@Field(store = Store.YES)
@Boost(2)
public String getTitle() {
return title;
Expand All @@ -73,7 +73,7 @@ public void setTitle(String title) {
this.title = title;
}

@Field(name = "Abstract", store = Store.NO, index = Index.TOKENIZED)
@Field(name = "Abstract")
public String getSummary() {
return summary;
}
Expand All @@ -82,7 +82,7 @@ public void setSummary(String summary) {
this.summary = summary;
}

@Field(store = Store.NO, index = Index.TOKENIZED)
@Field
public String getText() {
return text;
}
Expand Down

0 comments on commit 7c95544

Please sign in to comment.