[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model ...
Christian Bauer
christian at hibernate.org
Tue Jun 12 08:29:59 EDT 2007
User: cbauer
Date: 07/06/12 08:29:59
Modified: examples/wiki/src/main/org/jboss/seam/wiki/core/model
Comment.java Node.java Document.java
Log:
Completed first iteration of search engine
Revision Changes Path
1.4 +22 -3 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Comment.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Comment.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Comment.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Comment.java 19 Apr 2007 18:36:11 -0000 1.3
+++ Comment.java 12 Jun 2007 12:29:59 -0000 1.4
@@ -2,8 +2,7 @@
import org.hibernate.validator.Length;
import org.hibernate.validator.Email;
-import org.jboss.seam.wiki.core.model.Document;
-import org.jboss.seam.wiki.core.model.User;
+import org.jboss.seam.wiki.core.search.annotations.*;
import javax.persistence.*;
import java.util.Date;
@@ -11,11 +10,23 @@
@Entity
@Table(name = "COMMENTS")
+
+ at org.hibernate.annotations.BatchSize(size = 10)
+
+ at org.hibernate.search.annotations.Indexed
+ at Searchable(description = "Comments")
+ at CompositeSearchables(
+ @CompositeSearchable(
+ description = "Content", type = SearchableType.PHRASE,
+ properties = {"subject", "text"}
+ )
+)
public class Comment implements Serializable {
@Id
@GeneratedValue(generator = "wikiSequenceGenerator")
@Column(name = "COMMENT_ID")
+ @org.hibernate.search.annotations.DocumentId(name = "commentId")
private Long id = null;
@Version
@@ -30,6 +41,7 @@
@Column(name = "SUBJECT", nullable = false)
@Length(min = 3, max = 255)
+ @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.TOKENIZED)
private String subject;
@Column(name = "FROM_USER_NAME", nullable = false)
@@ -46,10 +58,17 @@
private String fromUserHomepage;
@Column(name = "COMMENT_TEXT", nullable = false)
- //@Length(min = 1, max = 32768)
+ @Length(min = 1, max = 32768)
+ @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.TOKENIZED)
private String text;
@Column(name = "CREATED_ON", nullable = false, updatable = false)
+ @org.hibernate.search.annotations.Field(
+ index = org.hibernate.search.annotations.Index.UN_TOKENIZED,
+ store = org.hibernate.search.annotations.Store.YES
+ )
+ @org.hibernate.search.annotations.DateBridge(resolution = org.hibernate.search.annotations.Resolution.DAY)
+ @Searchable(description = "Created", type = SearchableType.PASTDATE)
private Date createdOn = new Date();
public Comment () {}
1.15 +22 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Node.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Node.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Node.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- Node.java 3 May 2007 14:10:50 -0000 1.14
+++ Node.java 12 Jun 2007 12:29:59 -0000 1.15
@@ -3,6 +3,9 @@
import org.hibernate.validator.Length;
import org.hibernate.validator.Pattern;
import org.jboss.seam.wiki.core.preferences.WikiPreferenceValue;
+import org.jboss.seam.wiki.core.search.PaddedIntegerBridge;
+import org.jboss.seam.wiki.core.search.annotations.Searchable;
+import org.jboss.seam.wiki.core.search.annotations.SearchableType;
import javax.persistence.*;
import java.util.*;
@@ -42,7 +45,7 @@
@Id
@GeneratedValue(generator = "wikiSequenceGenerator")
@Column(name = "NODE_ID")
- @org.hibernate.search.annotations.DocumentId(name = "id")
+ @org.hibernate.search.annotations.DocumentId(name = "nodeId")
protected Long nodeId;
@Version
@@ -53,6 +56,7 @@
@Length(min = 3, max = 255)
@Pattern(regex="[a-zA-Z]?.+", message="Name must start with a letter")
@org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.TOKENIZED)
+ @Searchable(description = "Name")
protected String name;
@Column(name = "WIKINAME", length = 255, nullable = false)
@@ -78,6 +82,12 @@
private List<Node> children = new ArrayList<Node>();
@Column(name = "CREATED_ON", nullable = false, updatable = false)
+ @org.hibernate.search.annotations.Field(
+ index = org.hibernate.search.annotations.Index.UN_TOKENIZED,
+ store = org.hibernate.search.annotations.Store.YES
+ )
+ @org.hibernate.search.annotations.DateBridge(resolution = org.hibernate.search.annotations.Resolution.DAY)
+ @Searchable(description = "Created", type = SearchableType.PASTDATE)
private Date createdOn = new Date();
@ManyToOne(fetch = FetchType.LAZY)
@@ -86,6 +96,12 @@
protected User createdBy;
@Column(name = "LAST_MODIFIED_ON")
+ @org.hibernate.search.annotations.Field(
+ index = org.hibernate.search.annotations.Index.UN_TOKENIZED,
+ store = org.hibernate.search.annotations.Store.YES
+ )
+ @org.hibernate.search.annotations.DateBridge(resolution = org.hibernate.search.annotations.Resolution.DAY)
+ @Searchable(description = "Modified", type = SearchableType.PASTDATE)
protected Date lastModifiedOn;
@ManyToOne(fetch = FetchType.LAZY)
@@ -100,6 +116,11 @@
protected int writeAccessLevel;
@Column(name = "READ_ACCESS_LEVEL", nullable = false)
+ @org.hibernate.search.annotations.Field(
+ index = org.hibernate.search.annotations.Index.UN_TOKENIZED,
+ store = org.hibernate.search.annotations.Store.YES
+ )
+ @org.hibernate.search.annotations.FieldBridge(impl = PaddedIntegerBridge.class)
protected int readAccessLevel;
@OneToMany(mappedBy="node")
1.12 +6 -2 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Document.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Document.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Document.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- Document.java 7 May 2007 11:42:31 -0000 1.11
+++ Document.java 12 Jun 2007 12:29:59 -0000 1.12
@@ -1,18 +1,22 @@
package org.jboss.seam.wiki.core.model;
import org.hibernate.validator.Length;
+import org.jboss.seam.wiki.core.search.annotations.Searchable;
import javax.persistence.*;
@Entity
@DiscriminatorValue("DOCUMENT")
- at org.hibernate.search.annotations.Indexed(index = "Document")
+ at org.hibernate.search.annotations.Indexed
+ at Searchable(description = "Documents")
+ at org.hibernate.annotations.BatchSize(size = 10)
public class Document extends Node {
@Column(name = "CONTENT")
@Length(min = 0, max = 32768)
- @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.TOKENIZED)
@Basic(fetch = FetchType.LAZY) // Lazy loaded through bytecode instrumentation
+ @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.TOKENIZED)
+ @Searchable(description = "Content")
private String content;
@Column(name = "NAME_AS_TITLE")
More information about the jboss-cvs-commits
mailing list