[jboss-svn-commits] JBL Code SVN: r18823 - in labs/jbossforums/branches/multipleforums110P26: forums and 21 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Mar 11 08:28:50 EDT 2008


Author: unibrew
Date: 2008-03-11 08:28:50 -0400 (Tue, 11 Mar 2008)
New Revision: 18823

Added:
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilder.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilderMBean.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ResultPage.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/Searching.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortBy.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortOrder.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/TimePeriod.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/CategoryIdBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumIdBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumNameBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/MessageTextBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/TopicSubjectBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml
   labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/
   labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib/
   labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib/hibernate-search.jar
   labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib/lucene-core.jar
   labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate/lib/ejb3-persistence.jar
   labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate/lib/hibernate-commons-annotations.jar
Removed:
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilder.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilderMBean.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ResultPage.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/Searching.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortBy.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortOrder.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/TimePeriod.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/CategoryIdBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumIdBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumNameBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/MessageTextBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/TopicSubjectBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml
   labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib/
   labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib/hibernate-search.jar
   labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib/lucene-core.jar
Modified:
   labs/jbossforums/branches/multipleforums110P26/.classpath
   labs/jbossforums/branches/multipleforums110P26/forums/build.xml
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/MessageImpl.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/PostImpl.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/TopicImpl.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/BaseController.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-ear/META-INF/application.xml
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-sar/META-INF/jboss-service.xml
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-sar/conf/hibernate/hibernate.cfg.xml
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
   labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/common/common.xhtml
   labs/jbossforums/branches/multipleforums110P26/thirdparty/xdoclet-xdoclet/lib/xdoclet-xjavadoc.jar
   labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/defaults.ent
   labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/libraries.ent
   labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/task.properties
Log:
[JBFORUMS-2]

Modified: labs/jbossforums/branches/multipleforums110P26/.classpath
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/.classpath	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/.classpath	2008-03-11 12:28:50 UTC (rev 18823)
@@ -36,8 +36,12 @@
 	<classpathentry kind="lib" path="thirdparty/dom4j/lib/dom4j.jar"/>
 	<classpathentry kind="lib" path="thirdparty/javassist/lib/javassist.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jbportal/lib/portal-portlet-jsr168api-lib.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-hibernate/lib/hibernate3.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jboss-cache/lib/jboss-cache-jdk50.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jgroups/lib/jgroups.jar"/>
-	<classpathentry kind="lib" path="thirdparty/jboss-hibernate/lib/hibernate3.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-hibernate-search/lib/hibernate-search.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-hibernate-search/lib/lucene-core.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-hibernate/lib/ejb3-persistence.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss-hibernate/lib/hibernate-commons-annotations.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

Modified: labs/jbossforums/branches/multipleforums110P26/forums/build.xml
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/build.xml	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/build.xml	2008-03-11 12:28:50 UTC (rev 18823)
@@ -75,7 +75,7 @@
 			<path refid="junit.junit.classpath"/>
 			<path refid="sun.servlet.classpath"/>
 			<path refid="jakarta.cactus.classpath"/>
-			<path refid="jakarta.lucene.classpath"/>
+			<!--path refid="jakarta.lucene.classpath"/-->
          	<path refid="jakarta.fileupload.classpath"/>
          	<path refid="jwebunit.jwebunit.classpath"/>
 			<path refid="dbunit.dbunit.classpath"/>
@@ -87,6 +87,7 @@
 			<path refid="jflex.jflex.classpath" />
 			<path refid="jboss.javassist.classpath" />
 			<path refid="dom4j.dom4j.classpath" />
+			<path refid="jboss.hibernate.search.classpath"/>
 		</path>
 
       <!-- Configure modules -->
@@ -240,6 +241,8 @@
       <!-- portal-forums.ear -->
       <copy todir="${build.resources}/portal-forums-ear">
 			<!--fileset dir="${jakarta.lucene.root}/lib" includes="lucene.jar"/-->
+            <fileset dir="${jboss.hibernate.search.root}/lib" includes="lucene-core.jar,hibernate-search.jar"/>
+      	    <fileset dir="${jboss.hibernate.lib}" includes="hibernate-commons-annotations.jar,ejb3-persistence.jar"/>
 			<fileset dir="${build.lib}" includes="portal-forums.war,portal-forums-ui.jar,portal-forums.sar,portal-forums-authz-plugin.sar"/>
 			<fileset dir="${facelets.lib}" includes="jsf-facelets.jar,el-api.jar,el-ri.jar,jsf-example.jar"/>
 			<fileset dir="${apache.myfaces.lib}" includes="myfaces-api.jar,myfaces-impl.jar,tomahawk.jar"/>
@@ -343,7 +346,7 @@
 	   <!-- TEMPORARILY COPIED HERE, NEEDS TO BE REDONE -->
 	   <!-- portal-forums.ear -->
 	   <copy todir="${build.resources}/portal-forums-ear">
-		   <fileset dir="${jakarta.lucene.root}/lib" includes="lucene.jar"/>
+		   <!--fileset dir="${jakarta.lucene.root}/lib" includes="lucene.jar"/-->
 		   <fileset dir="${build.lib}" includes="portal-forums.war,portal-forums-ui.jar,portal-forums.sar,portal-forums-authz-plugin.sar"/>
 		   <fileset dir="${jbportal.root}/../facelets/lib" includes="jsf-facelets.jar,el-api.jar,el-ri.jar"/>
 	   </copy>

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/MessageImpl.java
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/MessageImpl.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/MessageImpl.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -27,7 +27,9 @@
    Serializable,
    Cloneable
 {
+   //@Field(index=Index.TOKENIZED)
    private String subject = "";
+   //@Field(index=Index.TOKENIZED)
    private String text = "";
    private boolean BBCodeEnabled = true;
    private boolean HTMLEnabled = false;

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/PostImpl.java
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/PostImpl.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/PostImpl.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -15,6 +15,15 @@
 import java.util.List;
 import java.util.LinkedList;
 
+import org.hibernate.search.annotations.DateBridge;
+import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.FieldBridge;
+import org.hibernate.search.annotations.Fields;
+import org.hibernate.search.annotations.Index;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.Resolution;
+import org.hibernate.search.annotations.Store;
 import org.jboss.portal.identity.User;
 import org.jboss.portlet.forums.model.Message;
 import org.jboss.portlet.forums.model.Post;
@@ -28,17 +37,42 @@
  * @author <a href="mailto:boleslaw.dawidowicz at jboss.com">Boleslaw Dawidowicz</a>
  * @version $Revision: 2066 $
  */
+ at Indexed(index="posts")
 public class PostImpl
    implements Serializable,
    Post
 {
+
+   @Fields( {
+	   @Field(name="subject", index=Index.TOKENIZED, 
+			   bridge=@FieldBridge(impl=org.jboss.portlet.forums.search.bridge.TopicSubjectBridge.class)),
+	   @Field(name="subject_forSort", index=Index.UN_TOKENIZED, store=Store.YES, 
+			   bridge=@FieldBridge(impl=org.jboss.portlet.forums.search.bridge.TopicSubjectBridge.class)),
+	   @Field(name="forumId", index=Index.UN_TOKENIZED, store=Store.YES,
+			   bridge=@FieldBridge(impl=org.jboss.portlet.forums.search.bridge.ForumIdBridge.class)),
+	   @Field(name="forumName", index=Index.UN_TOKENIZED, store=Store.YES,
+			   bridge=@FieldBridge(impl=org.jboss.portlet.forums.search.bridge.ForumNameBridge.class)),			   
+	   @Field(name="categoryId", index=Index.UN_TOKENIZED, store=Store.YES, 
+			   bridge=@FieldBridge(impl=org.jboss.portlet.forums.search.bridge.CategoryIdBridge.class))			   
+   } )
    private Topic topic;
    private User user;
    private int count;
    private Date date;
+
+   @DocumentId
    private Integer id;
+   
+   @Field(index=Index.UN_TOKENIZED, store=Store.YES)
+   @DateBridge(resolution=Resolution.MINUTE)
    private Date createDate;
+
+   @Field(index=Index.TOKENIZED, 
+		   bridge=@FieldBridge(impl=org.jboss.portlet.forums.search.bridge.MessageTextBridge.class))
    private Message message;
+   
+   @Field(name="userName", index=Index.UN_TOKENIZED, store=Store.YES, 
+           bridge=@FieldBridge(impl=org.jboss.portlet.forums.search.bridge.UserNameTextBridge.class))
    private Poster poster;
    private List attachments;
 

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/TopicImpl.java
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/TopicImpl.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/impl/TopicImpl.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -13,6 +13,12 @@
 import java.io.Serializable;
 import java.util.*;
 
+import org.hibernate.search.annotations.ContainedIn;
+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.jboss.portlet.forums.model.*;
 
 /**
@@ -26,6 +32,7 @@
    Comparable,
    Topic
 {
+
    private Integer id;
    private List posts;
    private Forum forum;
@@ -41,6 +48,7 @@
    private int type;
    private int status;
    //private Topic      target;
+   //@Field(index=Index.TOKENIZED)
    private String subject;
    private List watches;
    private Poll poll;

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search)

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilder.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilder.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilder.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,295 +0,0 @@
-package org.jboss.portlet.forums.search;
-
-import org.apache.log4j.Logger;
-import org.apache.lucene.index.IndexReader;
-import org.hibernate.CacheMode;
-import org.hibernate.FetchMode;
-import org.hibernate.FlushMode;
-import org.hibernate.HibernateException;
-import org.hibernate.ScrollMode;
-import org.hibernate.ScrollableResults;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.criterion.Restrictions;
-import org.hibernate.search.FullTextSession;
-import org.hibernate.search.Search;
-import org.jboss.portal.jems.hibernate.HibernateProvider;
-import org.jboss.portlet.forums.impl.PostImpl;
-import org.jboss.system.ServiceMBeanSupport;
-
-public class ForumsIndexBuilder extends ServiceMBeanSupport 
-    implements ForumsIndexBuilderMBean {
-
-    private final Logger log = Logger.getLogger(getClass());
-
-    private HibernateProvider hibernate;
-    
-    private SessionFactory sessionFactory;
-
-    private String indexBase;
-    
-    private int batchSize;
-    
-    /**
-     * @jmx.managed-attribute
-     */
-    public HibernateProvider getHibernate()
-    {
-        return hibernate;
-    }
-
-    /**
-     * @jmx.managed-attribute
-     */
-    public void setHibernate(HibernateProvider hibernate)
-    {
-        this.hibernate = hibernate;
-    }
-
-    @Override
-    protected void startService() throws Exception
-    {
-        sessionFactory = hibernate.getSessionFactory();
-        
-        Configuration configuration = hibernate.getConfig();
-        
-        indexBase = configuration.getProperty("hibernate.search.default.indexBase");
-        if (indexBase == null) {
-            throw new Exception("The config hibernate.search.default.indexBase has not been set");
-        }
-        
-        String batchSize = configuration.getProperty("org.hibernate.worker.batch_size");
-        if (batchSize == null) {
-            throw new Exception("The config org.hibernate.worker.batch_size has not been set");
-        } else {
-            this.batchSize = Integer.valueOf(batchSize);
-        }
-        
-    }
-
-    public void deleteIndex()
-    {
-        Session session = getSession();
-        FullTextSession fullTextSession = Search.createFullTextSession(session);
-            
-        if (IndexReader.indexExists(indexBase + "/posts")) {
-
-            fullTextSession.purgeAll(PostImpl.class);
-            
-            fullTextSession.getSearchFactory().optimize();
-            
-        } else {
-            new RuntimeException("Index directory " + indexBase + "/posts" + "does not exist");
-        }
-    }
-    
-    @SuppressWarnings("unchecked")
-    public void rebuildIndexForAllForums()
-    {
-        Transaction transaction = null;
-
-        try {
-            Session session = getSession();
-            FullTextSession fullTextSession = Search.createFullTextSession(session);
-            
-            transaction = fullTextSession.beginTransaction();
-
-            if (IndexReader.indexExists(indexBase + "/posts")) {
-
-                fullTextSession.purgeAll(PostImpl.class);
-                
-                fullTextSession.getSearchFactory().optimize(PostImpl.class);
-    
-                transaction.commit();
-    
-                log.debug("indexing documents in batches of: " + batchSize);
-    
-                fullTextSession.setFlushMode(FlushMode.MANUAL);
-                fullTextSession.setCacheMode(CacheMode.IGNORE);
-
-                transaction = fullTextSession.beginTransaction();
-                
-                ScrollableResults results = fullTextSession.createCriteria(PostImpl.class).
-                    setFetchMode("topic", FetchMode.JOIN).
-                    setFetchMode("topic.forum", FetchMode.JOIN).
-                    setFetchMode("topic.forum.category", FetchMode.JOIN).
-                    setFetchMode("poster", FetchMode.JOIN).
-                    scroll(ScrollMode.FORWARD_ONLY);
-                
-                int index = 0;
-                while(results.next()) {
-                    index++;
-                    fullTextSession.index(results.get(0));
-                    if (index % batchSize == 0) 
-                        session.clear();
-                }
-                
-                results.close();
-                transaction.commit();
-    
-                log.debug("indexing completed");
-            } else {
-                new RuntimeException("Index directory " + indexBase + "/posts" + "does not exist");
-            }
-        } catch (HibernateException e) {
-            try {
-                if (transaction != null) 
-                    transaction.rollback();
-            } catch (Exception re) {
-                log.error(e.getMessage(), e);
-            }
-            
-            log.error(e.getMessage(), e);
-            throw new RuntimeException(e);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public void buildIndexForGivenForum(Integer forumId)
-    {
-        if (forumId != null) {
-            Transaction transaction = null;
-    
-            try {
-                if (IndexReader.indexExists(indexBase + "/posts")) {
-                    Session session = getSession();
-                    FullTextSession fullTextSession = Search.createFullTextSession(session);
-                    
-                    log.debug("indexing documents in batches of: " + batchSize);
-                    fullTextSession.setFlushMode(FlushMode.MANUAL);
-                    fullTextSession.setCacheMode(CacheMode.IGNORE);
-    
-                    transaction = fullTextSession.beginTransaction();
-                    
-                    ScrollableResults results = fullTextSession.createCriteria(PostImpl.class).
-                        //setFetchMode("topic", FetchMode.JOIN).
-                        //setFetchMode("topic.forum", FetchMode.JOIN).
-                        setFetchMode("topic.forum.category", FetchMode.JOIN).
-                        setFetchMode("poster", FetchMode.JOIN).
-                        createCriteria("topic").
-                        createAlias("forum", "f").
-                        add(Restrictions.eq("f.id", forumId)).
-                        scroll(ScrollMode.FORWARD_ONLY);
-                    
-                    int index = 0;
-                    while(results.next()) {
-                        index++;
-                        fullTextSession.index(results.get(0));
-                        if (index % batchSize == 0) 
-                            session.clear();
-                    }
-                    
-                    results.close();
-                    transaction.commit();
-                    
-                    log.debug("indexing completed");
-                } else {
-                    new RuntimeException("Index directory " + indexBase + "/posts" + "does not exist");
-                }
-            } catch (HibernateException e) {
-                try {
-                    if (transaction != null) 
-                        transaction.rollback();
-                } catch (Exception re) {
-                    log.error(e.getMessage(), e);
-                }
-                
-                log.error(e.getMessage(), e);
-                throw new RuntimeException(e);
-            }
-        } else {
-            new RuntimeException("Forum id has not been given");
-        }
-    }
-    
-    @SuppressWarnings("unchecked")
-    public void buildIndexForGivenTopic(Integer topicId)
-    {
-        if (topicId != null) {
-            Transaction transaction = null;
-    
-            try {
-                Session session = getSession();
-                FullTextSession fullTextSession = Search.createFullTextSession(session);
-                
-                transaction = fullTextSession.beginTransaction();
-    
-                if (IndexReader.indexExists(indexBase + "/posts")) {
-    
-                    fullTextSession.purgeAll(PostImpl.class);
-                    
-                    fullTextSession.getSearchFactory().optimize(PostImpl.class);
-        
-                    transaction.commit();
-        
-                    log.debug("indexing documents in batches of: " + batchSize);
-        
-                    fullTextSession.setFlushMode(FlushMode.MANUAL);
-                    fullTextSession.setCacheMode(CacheMode.IGNORE);
-    
-                    transaction = fullTextSession.beginTransaction();
-                    
-                    ScrollableResults results = fullTextSession.createCriteria(PostImpl.class).
-                        //setFetchMode("topic", FetchMode.JOIN).
-                        //setFetchMode("topic.forum", FetchMode.JOIN).
-                        setFetchMode("topic.forum.category", FetchMode.JOIN).
-                        setFetchMode("poster", FetchMode.JOIN).
-                        createAlias("topic", "t").
-                        add(Restrictions.eq("t.id", topicId)).
-                        scroll(ScrollMode.FORWARD_ONLY);
-                    
-                    int index = 0;
-                    while(results.next()) {
-                        index++;
-                        fullTextSession.index(results.get(0));
-                        if (index % batchSize == 0) 
-                            session.clear();
-                    }
-                    
-                    results.close();
-                    transaction.commit();
-        
-                    log.debug("indexing completed");
-                } else {
-                    new RuntimeException("Index directory " + indexBase + "/posts" + "does not exist");
-                }
-            } catch (HibernateException e) {
-                try {
-                    if (transaction != null) 
-                        transaction.rollback();
-                } catch (Exception re) {
-                    log.error(e.getMessage(), e);
-                }
-                
-                log.error(e.getMessage(), e);
-                throw new RuntimeException(e);
-            }
-        } else {
-            new RuntimeException("Topic id has not been given");
-        }
-    }
-    
-    public void optimizeIndex()
-    {
-        Session session = getSession();
-        FullTextSession fullTextSession = Search.createFullTextSession(session);
-            
-        if (IndexReader.indexExists(indexBase + "/posts")) {
-                
-            fullTextSession.getSearchFactory().optimize();
-                
-        } else {
-            new RuntimeException("Index directory " + indexBase + "/posts" + "does not exist");
-        }
-    }
-    
-    protected Session getSession()
-    {
-        Session session = sessionFactory.openSession();
-        
-        return session;
-    }
-
-}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilder.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilder.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilder.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilder.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,295 @@
+package org.jboss.portlet.forums.search;
+
+import org.apache.log4j.Logger;
+import org.apache.lucene.index.IndexReader;
+import org.hibernate.CacheMode;
+import org.hibernate.FetchMode;
+import org.hibernate.FlushMode;
+import org.hibernate.HibernateException;
+import org.hibernate.ScrollMode;
+import org.hibernate.ScrollableResults;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.criterion.Restrictions;
+import org.hibernate.search.FullTextSession;
+import org.hibernate.search.Search;
+import org.jboss.portal.jems.hibernate.HibernateProvider;
+import org.jboss.portlet.forums.impl.PostImpl;
+import org.jboss.system.ServiceMBeanSupport;
+
+public class ForumsIndexBuilder extends ServiceMBeanSupport 
+    implements ForumsIndexBuilderMBean {
+
+    private final Logger log = Logger.getLogger(getClass());
+
+    private HibernateProvider hibernate;
+    
+    private SessionFactory sessionFactory;
+
+    private String indexBase;
+    
+    private int batchSize;
+    
+    /**
+     * @jmx.managed-attribute
+     */
+    public HibernateProvider getHibernate()
+    {
+        return hibernate;
+    }
+
+    /**
+     * @jmx.managed-attribute
+     */
+    public void setHibernate(HibernateProvider hibernate)
+    {
+        this.hibernate = hibernate;
+    }
+
+    @Override
+    protected void startService() throws Exception
+    {
+        sessionFactory = hibernate.getSessionFactory();
+        
+        Configuration configuration = hibernate.getConfig();
+        
+        indexBase = configuration.getProperty("hibernate.search.default.indexBase");
+        if (indexBase == null) {
+            throw new Exception("The config hibernate.search.default.indexBase has not been set");
+        }
+        
+        String batchSize = configuration.getProperty("org.hibernate.worker.batch_size");
+        if (batchSize == null) {
+            throw new Exception("The config org.hibernate.worker.batch_size has not been set");
+        } else {
+            this.batchSize = Integer.valueOf(batchSize);
+        }
+        
+    }
+
+    public void deleteIndex()
+    {
+        Session session = getSession();
+        FullTextSession fullTextSession = Search.createFullTextSession(session);
+            
+        if (IndexReader.indexExists(indexBase + "/posts")) {
+
+            fullTextSession.purgeAll(PostImpl.class);
+            
+            fullTextSession.getSearchFactory().optimize();
+            
+        } else {
+            new RuntimeException("Index directory " + indexBase + "/posts" + "does not exist");
+        }
+    }
+    
+    @SuppressWarnings("unchecked")
+    public void rebuildIndexForAllForums()
+    {
+        Transaction transaction = null;
+
+        try {
+            Session session = getSession();
+            FullTextSession fullTextSession = Search.createFullTextSession(session);
+            
+            transaction = fullTextSession.beginTransaction();
+
+            if (IndexReader.indexExists(indexBase + "/posts")) {
+
+                fullTextSession.purgeAll(PostImpl.class);
+                
+                fullTextSession.getSearchFactory().optimize(PostImpl.class);
+    
+                transaction.commit();
+    
+                log.debug("indexing documents in batches of: " + batchSize);
+    
+                fullTextSession.setFlushMode(FlushMode.MANUAL);
+                fullTextSession.setCacheMode(CacheMode.IGNORE);
+
+                transaction = fullTextSession.beginTransaction();
+                
+                ScrollableResults results = fullTextSession.createCriteria(PostImpl.class).
+                    setFetchMode("topic", FetchMode.JOIN).
+                    setFetchMode("topic.forum", FetchMode.JOIN).
+                    setFetchMode("topic.forum.category", FetchMode.JOIN).
+                    setFetchMode("poster", FetchMode.JOIN).
+                    scroll(ScrollMode.FORWARD_ONLY);
+                
+                int index = 0;
+                while(results.next()) {
+                    index++;
+                    fullTextSession.index(results.get(0));
+                    if (index % batchSize == 0) 
+                        session.clear();
+                }
+                
+                results.close();
+                transaction.commit();
+    
+                log.debug("indexing completed");
+            } else {
+                new RuntimeException("Index directory " + indexBase + "/posts" + "does not exist");
+            }
+        } catch (HibernateException e) {
+            try {
+                if (transaction != null) 
+                    transaction.rollback();
+            } catch (Exception re) {
+                log.error(e.getMessage(), e);
+            }
+            
+            log.error(e.getMessage(), e);
+            throw new RuntimeException(e);
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public void buildIndexForGivenForum(Integer forumId)
+    {
+        if (forumId != null) {
+            Transaction transaction = null;
+    
+            try {
+                if (IndexReader.indexExists(indexBase + "/posts")) {
+                    Session session = getSession();
+                    FullTextSession fullTextSession = Search.createFullTextSession(session);
+                    
+                    log.debug("indexing documents in batches of: " + batchSize);
+                    fullTextSession.setFlushMode(FlushMode.MANUAL);
+                    fullTextSession.setCacheMode(CacheMode.IGNORE);
+    
+                    transaction = fullTextSession.beginTransaction();
+                    
+                    ScrollableResults results = fullTextSession.createCriteria(PostImpl.class).
+                        //setFetchMode("topic", FetchMode.JOIN).
+                        //setFetchMode("topic.forum", FetchMode.JOIN).
+                        setFetchMode("topic.forum.category", FetchMode.JOIN).
+                        setFetchMode("poster", FetchMode.JOIN).
+                        createCriteria("topic").
+                        createAlias("forum", "f").
+                        add(Restrictions.eq("f.id", forumId)).
+                        scroll(ScrollMode.FORWARD_ONLY);
+                    
+                    int index = 0;
+                    while(results.next()) {
+                        index++;
+                        fullTextSession.index(results.get(0));
+                        if (index % batchSize == 0) 
+                            session.clear();
+                    }
+                    
+                    results.close();
+                    transaction.commit();
+                    
+                    log.debug("indexing completed");
+                } else {
+                    new RuntimeException("Index directory " + indexBase + "/posts" + "does not exist");
+                }
+            } catch (HibernateException e) {
+                try {
+                    if (transaction != null) 
+                        transaction.rollback();
+                } catch (Exception re) {
+                    log.error(e.getMessage(), e);
+                }
+                
+                log.error(e.getMessage(), e);
+                throw new RuntimeException(e);
+            }
+        } else {
+            new RuntimeException("Forum id has not been given");
+        }
+    }
+    
+    @SuppressWarnings("unchecked")
+    public void buildIndexForGivenTopic(Integer topicId)
+    {
+        if (topicId != null) {
+            Transaction transaction = null;
+    
+            try {
+                Session session = getSession();
+                FullTextSession fullTextSession = Search.createFullTextSession(session);
+                
+                transaction = fullTextSession.beginTransaction();
+    
+                if (IndexReader.indexExists(indexBase + "/posts")) {
+    
+                    fullTextSession.purgeAll(PostImpl.class);
+                    
+                    fullTextSession.getSearchFactory().optimize(PostImpl.class);
+        
+                    transaction.commit();
+        
+                    log.debug("indexing documents in batches of: " + batchSize);
+        
+                    fullTextSession.setFlushMode(FlushMode.MANUAL);
+                    fullTextSession.setCacheMode(CacheMode.IGNORE);
+    
+                    transaction = fullTextSession.beginTransaction();
+                    
+                    ScrollableResults results = fullTextSession.createCriteria(PostImpl.class).
+                        //setFetchMode("topic", FetchMode.JOIN).
+                        //setFetchMode("topic.forum", FetchMode.JOIN).
+                        setFetchMode("topic.forum.category", FetchMode.JOIN).
+                        setFetchMode("poster", FetchMode.JOIN).
+                        createAlias("topic", "t").
+                        add(Restrictions.eq("t.id", topicId)).
+                        scroll(ScrollMode.FORWARD_ONLY);
+                    
+                    int index = 0;
+                    while(results.next()) {
+                        index++;
+                        fullTextSession.index(results.get(0));
+                        if (index % batchSize == 0) 
+                            session.clear();
+                    }
+                    
+                    results.close();
+                    transaction.commit();
+        
+                    log.debug("indexing completed");
+                } else {
+                    new RuntimeException("Index directory " + indexBase + "/posts" + "does not exist");
+                }
+            } catch (HibernateException e) {
+                try {
+                    if (transaction != null) 
+                        transaction.rollback();
+                } catch (Exception re) {
+                    log.error(e.getMessage(), e);
+                }
+                
+                log.error(e.getMessage(), e);
+                throw new RuntimeException(e);
+            }
+        } else {
+            new RuntimeException("Topic id has not been given");
+        }
+    }
+    
+    public void optimizeIndex()
+    {
+        Session session = getSession();
+        FullTextSession fullTextSession = Search.createFullTextSession(session);
+            
+        if (IndexReader.indexExists(indexBase + "/posts")) {
+                
+            fullTextSession.getSearchFactory().optimize();
+                
+        } else {
+            new RuntimeException("Index directory " + indexBase + "/posts" + "does not exist");
+        }
+    }
+    
+    protected Session getSession()
+    {
+        Session session = sessionFactory.openSession();
+        
+        return session;
+    }
+
+}

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilderMBean.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilderMBean.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilderMBean.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,22 +0,0 @@
-package org.jboss.portlet.forums.search;
-
-import org.jboss.portal.jems.hibernate.HibernateProvider;
-import org.jboss.system.ServiceMBean;
-
-public interface ForumsIndexBuilderMBean extends ServiceMBean {
-
-    public HibernateProvider getHibernate();
-    
-    public void setHibernate(HibernateProvider hibernate);
-    
-    public void deleteIndex();
-    
-    public void rebuildIndexForAllForums();
-    
-    public void buildIndexForGivenForum(Integer forumId);
-    
-    public void buildIndexForGivenTopic(Integer topicId);
-    
-    public void optimizeIndex();
-    
-}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilderMBean.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilderMBean.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilderMBean.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsIndexBuilderMBean.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,22 @@
+package org.jboss.portlet.forums.search;
+
+import org.jboss.portal.jems.hibernate.HibernateProvider;
+import org.jboss.system.ServiceMBean;
+
+public interface ForumsIndexBuilderMBean extends ServiceMBean {
+
+    public HibernateProvider getHibernate();
+    
+    public void setHibernate(HibernateProvider hibernate);
+    
+    public void deleteIndex();
+    
+    public void rebuildIndexForAllForums();
+    
+    public void buildIndexForGivenForum(Integer forumId);
+    
+    public void buildIndexForGivenTopic(Integer topicId);
+    
+    public void optimizeIndex();
+    
+}

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,13 +0,0 @@
-package org.jboss.portlet.forums.search;
-
-import org.jboss.portal.core.modules.ModuleException;
-import org.jboss.portal.jems.hibernate.HibernateProvider;
-import org.jboss.portlet.forums.model.Post;
-
-public interface ForumsSearchModule {
-
-	public HibernateProvider getHibernate();
-	
-	public ResultPage<Post> findPosts(SearchCriteria criteria) throws ModuleException;
-	
-}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModule.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,13 @@
+package org.jboss.portlet.forums.search;
+
+import org.jboss.portal.core.modules.ModuleException;
+import org.jboss.portal.jems.hibernate.HibernateProvider;
+import org.jboss.portlet.forums.model.Post;
+
+public interface ForumsSearchModule {
+
+	public HibernateProvider getHibernate();
+	
+	public ResultPage<Post> findPosts(SearchCriteria criteria) throws ModuleException;
+	
+}

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,222 +0,0 @@
-package org.jboss.portlet.forums.search;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import org.apache.log4j.Logger;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document.DateTools;
-import org.apache.lucene.document.DateTools.Resolution;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.MultiFieldQueryParser;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.RangeQuery;
-import org.apache.lucene.search.SortField;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.WildcardQuery;
-import org.apache.lucene.search.BooleanClause.Occur;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.search.FullTextQuery;
-import org.hibernate.search.FullTextSession;
-import org.hibernate.search.Search;
-import org.jboss.portal.core.modules.AbstractModule;
-import org.jboss.portal.core.modules.ModuleException;
-import org.jboss.portal.jems.hibernate.HibernateProvider;
-import org.jboss.portlet.forums.impl.PostImpl;
-import org.jboss.portlet.forums.model.Post;
-
-public class ForumsSearchModuleImpl extends AbstractModule implements ForumsSearchModule {
-
-    private final Logger log = Logger.getLogger(getClass());
-
-    private HibernateProvider hibernate;
-
-    private SessionFactory factory;
-
-    protected void startService() throws Exception {
-        super.startService();
-
-        factory = hibernate.getSessionFactory();
-    }
-
-    /**
-     * @jmx.managed-attribute
-     */
-    public HibernateProvider getHibernate() {
-        return hibernate;
-    }
-
-    /**
-     * @jmx.managed-attribute
-     */
-    public void setHibernate(HibernateProvider hibernate)
-    {
-        this.hibernate = hibernate;
-    }
-	
-    @SuppressWarnings("unchecked")
-    public ResultPage<Post> findPosts(SearchCriteria criteria) throws ModuleException {
-        if (criteria != null) {
-            try {
-                Session session = getSession();
-                FullTextSession fullTextSession = Search.createFullTextSession(session);
-		  
-                BooleanQuery query = new BooleanQuery();
-                
-                String keywords = criteria.getKeywords();
-                if (keywords != null && keywords.length() != 0) {
-                    String[] fields = null;
-                    
-                    Searching searching = Searching.valueOf(criteria.getSearching());
-                    switch(searching) {
-                        case TITLE_MSG:
-                            fields = new String[] { "message", "subject" };
-                            
-                            break;
-                        case MSG:
-                            fields = new String[] { "message" };
-                            
-                            break;
-                    }
-                    
-                    MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
-                    query.add(parser.parse(keywords), Occur.MUST);
-                }
-                
-                String forumId = criteria.getForum();
-                if (forumId != null && forumId.length() != 0) {
-                    query.add(new TermQuery(new Term("forumId", forumId)), Occur.MUST);
-                }
-                
-                String categoryId = criteria.getCategory();
-                if (categoryId != null && categoryId.length() != 0) {
-                    query.add(new TermQuery(new Term("categoryId", categoryId)), Occur.MUST);
-                }
-                
-                String userName = criteria.getAuthor();
-                if (userName != null && userName.length() != 0) {
-                    //query.add(new TermQuery(new Term("userName", userName)), Occur.MUST);
-                    //QueryParser parser = new QueryParser(userName, new StandardAnalyzer());
-                    query.add(new WildcardQuery(new Term("userName", userName)), Occur.MUST);
-                }
-                
-                String timePeriod = criteria.getTimePeriod();
-                if (timePeriod != null && timePeriod.length() != 0) {
-                    addPostTimeQuery(query, TimePeriod.valueOf(timePeriod));
-                }
-                
-                FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(query, PostImpl.class);
-
-                SortOrder sortOrder = SortOrder.valueOf(criteria.getSortOrder());
-                SortBy sortBy = SortBy.valueOf(criteria.getSortBy());
-                fullTextQuery.setSort(getSort(sortBy, sortOrder));
-                
-                fullTextQuery.setFirstResult(criteria.getPageSize() * criteria.getPageNumber() + 1);
-                fullTextQuery.setMaxResults(criteria.getPageSize());
-                
-                ResultPage<Post> resultPage = new ResultPage<Post>();
-                resultPage.setPage(fullTextQuery.list());
-                resultPage.setResultSize(fullTextQuery.getResultSize());
-                
-                return resultPage;
-            } catch (ParseException e) {
-                
-                return null;
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                throw new ModuleException(e.getMessage(), e);
-            }
-        } else {
-            throw new IllegalArgumentException("criteria cannot be null");
-        }
-    }
-	
-    protected org.apache.lucene.search.Sort getSort(SortBy sortBy, SortOrder sortOrder) {
-        
-        String fieldName = null;
-        
-        if (sortBy != null) {
-            fieldName = sortBy.getFieldName();
-        }
-        
-        if (fieldName == null) {
-            fieldName = SortBy.POST_TIME.getFieldName();
-        }
-        
-        boolean reverse = false;
-        
-        if (sortOrder == SortOrder.DESC) {
-            reverse = true;
-        }
-        
-        org.apache.lucene.search.Sort sort = new org.apache.lucene.search.Sort(new SortField(fieldName, reverse));
-        
-        return sort;
-    }
-    
-    protected void addPostTimeQuery(BooleanQuery query, TimePeriod period) {
-        
-        if (period != TimePeriod.ALL) {
-            Calendar calendar = Calendar.getInstance();
-
-            Date startDate = null;
-            Date endDate = calendar.getTime();
-            
-            switch(period) {
-                case DAY:
-                    calendar.add(Calendar.DATE, -1);
-                    startDate = calendar.getTime();
-                    
-                    break;
-                case SEVEN_DAYS:
-                    calendar.add(Calendar.DATE, -7);
-                    startDate = calendar.getTime();
-                    
-                    break;
-                case TWO_WEEKS:
-                    calendar.add(Calendar.DATE, -14);
-                    startDate = calendar.getTime();
-                    
-                    break;
-                case MONTH:
-                    calendar.add(Calendar.MONTH, -1);
-                    startDate = calendar.getTime();
-                    
-                    break;
-                case THREE_MONTHS:
-                    calendar.add(Calendar.MONTH, -3);
-                    startDate = calendar.getTime();
-                    
-                    break;
-                case SIX_MONTHS:
-                    calendar.add(Calendar.MONTH, -6);
-                    startDate = calendar.getTime();
-                    
-                    break;
-                case YEAR:
-                    calendar.add(Calendar.YEAR, -1);
-                    startDate = calendar.getTime();
-                    
-                    break;
-            }
-            
-            if (startDate != null) {
-                Term start = new Term("createDate", DateTools.dateToString(startDate, 
-                        Resolution.MINUTE));
-                Term end = new Term("createDate", DateTools.dateToString(endDate, 
-                        Resolution.MINUTE));
-                
-                query.add(new RangeQuery(start, end, true), Occur.MUST);
-            }
-        }
-    }
-    
-    protected Session getSession() {
-    	Session session = factory.getCurrentSession();
-    	
-    	return session;
-    }
-    
-}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ForumsSearchModuleImpl.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,222 @@
+package org.jboss.portlet.forums.search;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.log4j.Logger;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.document.DateTools;
+import org.apache.lucene.document.DateTools.Resolution;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.queryParser.MultiFieldQueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.RangeQuery;
+import org.apache.lucene.search.SortField;
+import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.search.WildcardQuery;
+import org.apache.lucene.search.BooleanClause.Occur;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.search.FullTextQuery;
+import org.hibernate.search.FullTextSession;
+import org.hibernate.search.Search;
+import org.jboss.portal.core.modules.AbstractModule;
+import org.jboss.portal.core.modules.ModuleException;
+import org.jboss.portal.jems.hibernate.HibernateProvider;
+import org.jboss.portlet.forums.impl.PostImpl;
+import org.jboss.portlet.forums.model.Post;
+
+public class ForumsSearchModuleImpl extends AbstractModule implements ForumsSearchModule {
+
+    private final Logger log = Logger.getLogger(getClass());
+
+    private HibernateProvider hibernate;
+
+    private SessionFactory factory;
+
+    protected void startService() throws Exception {
+        super.startService();
+
+        factory = hibernate.getSessionFactory();
+    }
+
+    /**
+     * @jmx.managed-attribute
+     */
+    public HibernateProvider getHibernate() {
+        return hibernate;
+    }
+
+    /**
+     * @jmx.managed-attribute
+     */
+    public void setHibernate(HibernateProvider hibernate)
+    {
+        this.hibernate = hibernate;
+    }
+	
+    @SuppressWarnings("unchecked")
+    public ResultPage<Post> findPosts(SearchCriteria criteria) throws ModuleException {
+        if (criteria != null) {
+            try {
+                Session session = getSession();
+                FullTextSession fullTextSession = Search.createFullTextSession(session);
+		  
+                BooleanQuery query = new BooleanQuery();
+                
+                String keywords = criteria.getKeywords();
+                if (keywords != null && keywords.length() != 0) {
+                    String[] fields = null;
+                    
+                    Searching searching = Searching.valueOf(criteria.getSearching());
+                    switch(searching) {
+                        case TITLE_MSG:
+                            fields = new String[] { "message", "subject" };
+                            
+                            break;
+                        case MSG:
+                            fields = new String[] { "message" };
+                            
+                            break;
+                    }
+                    
+                    MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
+                    query.add(parser.parse(keywords), Occur.MUST);
+                }
+                
+                String forumId = criteria.getForum();
+                if (forumId != null && forumId.length() != 0) {
+                    query.add(new TermQuery(new Term("forumId", forumId)), Occur.MUST);
+                }
+                
+                String categoryId = criteria.getCategory();
+                if (categoryId != null && categoryId.length() != 0) {
+                    query.add(new TermQuery(new Term("categoryId", categoryId)), Occur.MUST);
+                }
+                
+                String userName = criteria.getAuthor();
+                if (userName != null && userName.length() != 0) {
+                    //query.add(new TermQuery(new Term("userName", userName)), Occur.MUST);
+                    //QueryParser parser = new QueryParser(userName, new StandardAnalyzer());
+                    query.add(new WildcardQuery(new Term("userName", userName)), Occur.MUST);
+                }
+                
+                String timePeriod = criteria.getTimePeriod();
+                if (timePeriod != null && timePeriod.length() != 0) {
+                    addPostTimeQuery(query, TimePeriod.valueOf(timePeriod));
+                }
+                
+                FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(query, PostImpl.class);
+
+                SortOrder sortOrder = SortOrder.valueOf(criteria.getSortOrder());
+                SortBy sortBy = SortBy.valueOf(criteria.getSortBy());
+                fullTextQuery.setSort(getSort(sortBy, sortOrder));
+                
+                fullTextQuery.setFirstResult(criteria.getPageSize() * criteria.getPageNumber() + 1);
+                fullTextQuery.setMaxResults(criteria.getPageSize());
+                
+                ResultPage<Post> resultPage = new ResultPage<Post>();
+                resultPage.setPage(fullTextQuery.list());
+                resultPage.setResultSize(fullTextQuery.getResultSize());
+                
+                return resultPage;
+            } catch (ParseException e) {
+                
+                return null;
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                throw new ModuleException(e.getMessage(), e);
+            }
+        } else {
+            throw new IllegalArgumentException("criteria cannot be null");
+        }
+    }
+	
+    protected org.apache.lucene.search.Sort getSort(SortBy sortBy, SortOrder sortOrder) {
+        
+        String fieldName = null;
+        
+        if (sortBy != null) {
+            fieldName = sortBy.getFieldName();
+        }
+        
+        if (fieldName == null) {
+            fieldName = SortBy.POST_TIME.getFieldName();
+        }
+        
+        boolean reverse = false;
+        
+        if (sortOrder == SortOrder.DESC) {
+            reverse = true;
+        }
+        
+        org.apache.lucene.search.Sort sort = new org.apache.lucene.search.Sort(new SortField(fieldName, reverse));
+        
+        return sort;
+    }
+    
+    protected void addPostTimeQuery(BooleanQuery query, TimePeriod period) {
+        
+        if (period != TimePeriod.ALL) {
+            Calendar calendar = Calendar.getInstance();
+
+            Date startDate = null;
+            Date endDate = calendar.getTime();
+            
+            switch(period) {
+                case DAY:
+                    calendar.add(Calendar.DATE, -1);
+                    startDate = calendar.getTime();
+                    
+                    break;
+                case SEVEN_DAYS:
+                    calendar.add(Calendar.DATE, -7);
+                    startDate = calendar.getTime();
+                    
+                    break;
+                case TWO_WEEKS:
+                    calendar.add(Calendar.DATE, -14);
+                    startDate = calendar.getTime();
+                    
+                    break;
+                case MONTH:
+                    calendar.add(Calendar.MONTH, -1);
+                    startDate = calendar.getTime();
+                    
+                    break;
+                case THREE_MONTHS:
+                    calendar.add(Calendar.MONTH, -3);
+                    startDate = calendar.getTime();
+                    
+                    break;
+                case SIX_MONTHS:
+                    calendar.add(Calendar.MONTH, -6);
+                    startDate = calendar.getTime();
+                    
+                    break;
+                case YEAR:
+                    calendar.add(Calendar.YEAR, -1);
+                    startDate = calendar.getTime();
+                    
+                    break;
+            }
+            
+            if (startDate != null) {
+                Term start = new Term("createDate", DateTools.dateToString(startDate, 
+                        Resolution.MINUTE));
+                Term end = new Term("createDate", DateTools.dateToString(endDate, 
+                        Resolution.MINUTE));
+                
+                query.add(new RangeQuery(start, end, true), Occur.MUST);
+            }
+        }
+    }
+    
+    protected Session getSession() {
+    	Session session = factory.getCurrentSession();
+    	
+    	return session;
+    }
+    
+}

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ResultPage.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/ResultPage.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ResultPage.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,30 +0,0 @@
-package org.jboss.portlet.forums.search;
-
-import java.io.Serializable;
-import java.util.List;
-
-public class ResultPage<T> implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-    
-    private List<T> page;
-
-    private int resultSize;
-
-    public List<T> getPage() {
-        return page;
-    }
-
-    public void setPage(List<T> page) {
-        this.page = page;
-    }
-
-    public int getResultSize() {
-        return resultSize;
-    }
-
-    public void setResultSize(int resultSize) {
-        this.resultSize = resultSize;
-    }
-    
-}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ResultPage.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/ResultPage.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ResultPage.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/ResultPage.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,30 @@
+package org.jboss.portlet.forums.search;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class ResultPage<T> implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    
+    private List<T> page;
+
+    private int resultSize;
+
+    public List<T> getPage() {
+        return page;
+    }
+
+    public void setPage(List<T> page) {
+        this.page = page;
+    }
+
+    public int getResultSize() {
+        return resultSize;
+    }
+
+    public void setResultSize(int resultSize) {
+        this.resultSize = resultSize;
+    }
+    
+}

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,116 +0,0 @@
-package org.jboss.portlet.forums.search;
-
-import java.io.Serializable;
-
-public class SearchCriteria implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-    
-	private String keywords;
-	
-	private String author;
-	
-	private String category;
-	
-	private String forum;
-	
-	private String timePeriod;
-	
-	private String searching;
-	
-	private String sortBy;
-	
-	private String sortOrder;
-	
-	private int pageSize;
-	
-	private int pageNumber;
-
-	public String getKeywords() {
-		return keywords;
-	}
-
-	public void setKeywords(String keywords) {
-		this.keywords = keywords;
-	}
-
-	public String getAuthor() {
-		return author;
-	}
-
-	public void setAuthor(String author) {
-		this.author = author;
-	}
-
-	public String getCategory() {
-		return category;
-	}
-
-	public void setCategory(String category) {
-		this.category = category;
-	}
-
-	public String getForum() {
-		return forum;
-	}
-
-	public void setForum(String forum) {
-		this.forum = forum;
-	}
-
-	public String getTimePeriod() {
-		return timePeriod;
-	}
-
-	public void setTimePeriod(String timePeriod) {
-		this.timePeriod = timePeriod;
-	}
-
-	public String getSearching() {
-		if (searching == null || searching.length() == 0)
-			searching = Searching.TITLE_MSG.name();
-		
-		return searching;
-	}
-
-	public void setSearching(String searching) {
-		this.searching = searching;
-	}
-
-	public String getSortBy() {
-		return sortBy;
-	}
-
-	public void setSortBy(String sortBy) {
-		this.sortBy = sortBy;
-	}
-
-	public String getSortOrder() {
-		if (sortOrder == null || sortOrder.length() == 0)
-			sortOrder = SortOrder.ASC.name();
-		
-		return sortOrder;
-	}
-
-	public void setSortOrder(String sortOrder) {
-		this.sortOrder = sortOrder;
-	}
-
-    public int getPageSize() {
-        return pageSize;
-    }
-
-    public void setPageSize(int pageSize) {
-        this.pageSize = pageSize;
-    }
-
-    public int getPageNumber() {
-        return pageNumber;
-    }
-
-    public void setPageNumber(int pageNumber) {
-        this.pageNumber = pageNumber;
-    }
-	
-}
-   
\ No newline at end of file

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SearchCriteria.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,116 @@
+package org.jboss.portlet.forums.search;
+
+import java.io.Serializable;
+
+public class SearchCriteria implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    
+	private String keywords;
+	
+	private String author;
+	
+	private String category;
+	
+	private String forum;
+	
+	private String timePeriod;
+	
+	private String searching;
+	
+	private String sortBy;
+	
+	private String sortOrder;
+	
+	private int pageSize;
+	
+	private int pageNumber;
+
+	public String getKeywords() {
+		return keywords;
+	}
+
+	public void setKeywords(String keywords) {
+		this.keywords = keywords;
+	}
+
+	public String getAuthor() {
+		return author;
+	}
+
+	public void setAuthor(String author) {
+		this.author = author;
+	}
+
+	public String getCategory() {
+		return category;
+	}
+
+	public void setCategory(String category) {
+		this.category = category;
+	}
+
+	public String getForum() {
+		return forum;
+	}
+
+	public void setForum(String forum) {
+		this.forum = forum;
+	}
+
+	public String getTimePeriod() {
+		return timePeriod;
+	}
+
+	public void setTimePeriod(String timePeriod) {
+		this.timePeriod = timePeriod;
+	}
+
+	public String getSearching() {
+		if (searching == null || searching.length() == 0)
+			searching = Searching.TITLE_MSG.name();
+		
+		return searching;
+	}
+
+	public void setSearching(String searching) {
+		this.searching = searching;
+	}
+
+	public String getSortBy() {
+		return sortBy;
+	}
+
+	public void setSortBy(String sortBy) {
+		this.sortBy = sortBy;
+	}
+
+	public String getSortOrder() {
+		if (sortOrder == null || sortOrder.length() == 0)
+			sortOrder = SortOrder.ASC.name();
+		
+		return sortOrder;
+	}
+
+	public void setSortOrder(String sortOrder) {
+		this.sortOrder = sortOrder;
+	}
+
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(int pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public int getPageNumber() {
+        return pageNumber;
+    }
+
+    public void setPageNumber(int pageNumber) {
+        this.pageNumber = pageNumber;
+    }
+	
+}
+   
\ No newline at end of file

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/Searching.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/Searching.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/Searching.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,17 +0,0 @@
-package org.jboss.portlet.forums.search;
-
-public enum Searching {
-
-    TITLE_MSG("titlemessage"), MSG("message");
-    
-    private String name;
-    
-    private Searching(String name) {
-        this.name = name;
-    }
-    
-    public String getName() {
-        return name;
-    }
-    
-}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/Searching.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/Searching.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/Searching.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/Searching.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,17 @@
+package org.jboss.portlet.forums.search;
+
+public enum Searching {
+
+    TITLE_MSG("titlemessage"), MSG("message");
+    
+    private String name;
+    
+    private Searching(String name) {
+        this.name = name;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+}

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortBy.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/SortBy.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortBy.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,20 +0,0 @@
-package org.jboss.portlet.forums.search;
-
-public enum SortBy {
-
-	POST_TIME("createDate"),
-	POST_SUBJECT("subject_forSort"), 
-	AUTHOR("userName"), 
-	FORUM("forumId");
-	
-	private String fieldName;
-	
-	private SortBy(String fieldName) {
-		this.fieldName = fieldName;
-	}
-	
-	public String getFieldName() {
-		return fieldName;
-	}
-	
-}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortBy.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/SortBy.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortBy.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortBy.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,20 @@
+package org.jboss.portlet.forums.search;
+
+public enum SortBy {
+
+	POST_TIME("createDate"),
+	POST_SUBJECT("subject_forSort"), 
+	AUTHOR("userName"), 
+	FORUM("forumId");
+	
+	private String fieldName;
+	
+	private SortBy(String fieldName) {
+		this.fieldName = fieldName;
+	}
+	
+	public String getFieldName() {
+		return fieldName;
+	}
+	
+}

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortOrder.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/SortOrder.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortOrder.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,7 +0,0 @@
-package org.jboss.portlet.forums.search;
-
-public enum SortOrder {
-    
-    ASC, DESC;
-
-}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortOrder.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/SortOrder.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortOrder.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/SortOrder.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,7 @@
+package org.jboss.portlet.forums.search;
+
+public enum SortOrder {
+    
+    ASC, DESC;
+
+}

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/TimePeriod.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/TimePeriod.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/TimePeriod.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,7 +0,0 @@
-package org.jboss.portlet.forums.search;
-
-public enum TimePeriod {
-
-	ALL, DAY, SEVEN_DAYS, TWO_WEEKS, MONTH, THREE_MONTHS, SIX_MONTHS, YEAR;
-
-}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/TimePeriod.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/TimePeriod.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/TimePeriod.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/TimePeriod.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,7 @@
+package org.jboss.portlet.forums.search;
+
+public enum TimePeriod {
+
+	ALL, DAY, SEVEN_DAYS, TWO_WEEKS, MONTH, THREE_MONTHS, SIX_MONTHS, YEAR;
+
+}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge)

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/CategoryIdBridge.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/CategoryIdBridge.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/CategoryIdBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,16 +0,0 @@
-package org.jboss.portlet.forums.search.bridge;
-
-import org.hibernate.search.bridge.builtin.StringBridge;
-import org.jboss.portlet.forums.model.Topic;
-
-public class CategoryIdBridge extends StringBridge {
-
-	@Override
-	public String objectToString(Object object) {
-		Topic topic = (Topic) object;
-		
-		return topic.getForum().getCategory().getId().toString();
-	}
-	
-}
- 
\ No newline at end of file

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/CategoryIdBridge.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/CategoryIdBridge.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/CategoryIdBridge.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/CategoryIdBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,16 @@
+package org.jboss.portlet.forums.search.bridge;
+
+import org.hibernate.search.bridge.builtin.StringBridge;
+import org.jboss.portlet.forums.model.Topic;
+
+public class CategoryIdBridge extends StringBridge {
+
+	@Override
+	public String objectToString(Object object) {
+		Topic topic = (Topic) object;
+		
+		return topic.getForum().getCategory().getId().toString();
+	}
+	
+}
+ 
\ No newline at end of file

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumIdBridge.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumIdBridge.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumIdBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,15 +0,0 @@
-package org.jboss.portlet.forums.search.bridge;
-
-import org.hibernate.search.bridge.builtin.StringBridge;
-import org.jboss.portlet.forums.model.Topic;
-
-public class ForumIdBridge extends StringBridge {
-
-	@Override
-	public String objectToString(Object object) {
-		Topic topic = (Topic) object;
-		
-		return topic.getForum().getId().toString();
-	}
-
-}

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumIdBridge.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumIdBridge.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumIdBridge.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumIdBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,15 @@
+package org.jboss.portlet.forums.search.bridge;
+
+import org.hibernate.search.bridge.builtin.StringBridge;
+import org.jboss.portlet.forums.model.Topic;
+
+public class ForumIdBridge extends StringBridge {
+
+	@Override
+	public String objectToString(Object object) {
+		Topic topic = (Topic) object;
+		
+		return topic.getForum().getId().toString();
+	}
+
+}

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumNameBridge.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumNameBridge.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumNameBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,17 +0,0 @@
-package org.jboss.portlet.forums.search.bridge;
-
-import org.hibernate.search.bridge.builtin.StringBridge;
-import org.jboss.portlet.forums.model.Topic;
-
-public class ForumNameBridge extends StringBridge {
-
-	@Override
-	public String objectToString(Object object) {
-		Topic topic = (Topic) object;
-		
-		return topic.getForum().getName();
-	}
-
-}
-
- 
\ No newline at end of file

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumNameBridge.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumNameBridge.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumNameBridge.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/ForumNameBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,17 @@
+package org.jboss.portlet.forums.search.bridge;
+
+import org.hibernate.search.bridge.builtin.StringBridge;
+import org.jboss.portlet.forums.model.Topic;
+
+public class ForumNameBridge extends StringBridge {
+
+	@Override
+	public String objectToString(Object object) {
+		Topic topic = (Topic) object;
+		
+		return topic.getForum().getName();
+	}
+
+}
+
+ 
\ No newline at end of file

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/MessageTextBridge.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/MessageTextBridge.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/MessageTextBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,16 +0,0 @@
-package org.jboss.portlet.forums.search.bridge;
-
-import org.hibernate.search.bridge.builtin.StringBridge;
-import org.jboss.portlet.forums.model.Message;
-
-public class MessageTextBridge extends StringBridge {
-
-	@Override
-	public String objectToString(Object object) {
-		Message message = (Message) object;
-		
-		return message.getText();
-	}
-
-}
-

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/MessageTextBridge.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/MessageTextBridge.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/MessageTextBridge.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/MessageTextBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,16 @@
+package org.jboss.portlet.forums.search.bridge;
+
+import org.hibernate.search.bridge.builtin.StringBridge;
+import org.jboss.portlet.forums.model.Message;
+
+public class MessageTextBridge extends StringBridge {
+
+	@Override
+	public String objectToString(Object object) {
+		Message message = (Message) object;
+		
+		return message.getText();
+	}
+
+}
+

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/TopicSubjectBridge.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/TopicSubjectBridge.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/TopicSubjectBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,15 +0,0 @@
-package org.jboss.portlet.forums.search.bridge;
-
-import org.hibernate.search.bridge.builtin.StringBridge;
-import org.jboss.portlet.forums.model.Topic;
-
-public class TopicSubjectBridge extends StringBridge {
-
-	@Override
-	public String objectToString(Object object) {
-		Topic topic = (Topic) object;
-		
-		return topic.getSubject();
-	}
-	
-}
\ No newline at end of file

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/TopicSubjectBridge.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/TopicSubjectBridge.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/TopicSubjectBridge.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/TopicSubjectBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,15 @@
+package org.jboss.portlet.forums.search.bridge;
+
+import org.hibernate.search.bridge.builtin.StringBridge;
+import org.jboss.portlet.forums.model.Topic;
+
+public class TopicSubjectBridge extends StringBridge {
+
+	@Override
+	public String objectToString(Object object) {
+		Topic topic = (Topic) object;
+		
+		return topic.getSubject();
+	}
+	
+}
\ No newline at end of file

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,41 +0,0 @@
-package org.jboss.portlet.forums.search.bridge;
-
-import javax.naming.InitialContext;
-
-import org.apache.log4j.Logger;
-import org.hibernate.search.bridge.builtin.StringBridge;
-import org.jboss.portal.core.modules.ModuleConstants;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.UserModule;
-import org.jboss.portlet.forums.model.Poster;
-import org.jboss.portlet.forums.ui.PortalUtil;
-
-public class UserNameTextBridge extends StringBridge {
-
-    private final Logger log = Logger.getLogger(getClass());
-    
-	@Override
-	public String objectToString(Object object) {
-
-	    if (object != null) {	            
-	        Poster poster = (Poster) object; 
-		
-    		try {
-    		    String id = poster.getUserId();
-
-    		    UserModule userModule = (UserModule)new InitialContext().lookup(ModuleConstants.USERMODULE_JNDINAME);
-    		    User user = userModule.findUserById(id);
-    		    
-  		        if (user != null) {
-   		            return user.getUserName();
-   		        }
-    		} catch (Throwable t) {
-    		    log.error(t.getMessage(), t);
-            }
-	    }
-		
-		return PortalUtil.getUserNA().getUserName();
-	}
-
-}
- 
\ No newline at end of file

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,41 @@
+package org.jboss.portlet.forums.search.bridge;
+
+import javax.naming.InitialContext;
+
+import org.apache.log4j.Logger;
+import org.hibernate.search.bridge.builtin.StringBridge;
+import org.jboss.portal.core.modules.ModuleConstants;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portlet.forums.model.Poster;
+import org.jboss.portlet.forums.ui.PortalUtil;
+
+public class UserNameTextBridge extends StringBridge {
+
+    private final Logger log = Logger.getLogger(getClass());
+    
+	@Override
+	public String objectToString(Object object) {
+
+	    if (object != null) {	            
+	        Poster poster = (Poster) object; 
+		
+    		try {
+    		    String id = poster.getUserId();
+
+    		    UserModule userModule = (UserModule)new InitialContext().lookup(ModuleConstants.USERMODULE_JNDINAME);
+    		    User user = userModule.findUserById(id);
+    		    
+  		        if (user != null) {
+   		            return user.getUserName();
+   		        }
+    		} catch (Throwable t) {
+    		    log.error(t.getMessage(), t);
+            }
+	    }
+		
+		return PortalUtil.getUserNA().getUserName();
+	}
+
+}
+ 
\ No newline at end of file

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/BaseController.java
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/BaseController.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/BaseController.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -30,6 +30,7 @@
 
 //jboss portal
 import org.jboss.portlet.forums.ForumsModule;
+import org.jboss.portlet.forums.search.ForumsSearchModule;
 
 /**
  * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
@@ -39,6 +40,8 @@
 {
     private static ForumsModule singleton = null;    
     
+    private static ForumsSearchModule searchModule = null;
+    
     private String mainPageName = ""; //bean=level configuration supplied by the forums-config.xml
     private Map links = null;
     
@@ -105,5 +108,15 @@
             BaseController.singleton = (ForumsModule)new InitialContext().lookup("java:portal/ForumsModule");
         }
         return BaseController.singleton;
-    }     
+    }
+    
+    public static ForumsSearchModule getSearchModule() throws Exception
+    {
+    	if (BaseController.searchModule == null)
+    	{
+    		BaseController.searchModule = (ForumsSearchModule) new InitialContext().lookup("java:portal/ForumsSearchModule");
+    	}
+    	
+    	return BaseController.searchModule;
+    }
 }

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -217,6 +217,16 @@
         TEMP_VIEW_ID_TO_NAME.put("me","/views/myforums/myforums_editforums.jsf");
         TEMP_VIEW_NAME_TO_ID.put("/views/myforums/myforums_editforums.jsf","me");
         
+        // Search views
+        TEMP_VIEW_ID_TO_NAME.put("se","/views/search/viewsearch_body.jsf");
+        TEMP_VIEW_NAME_TO_ID.put("/views/search/viewsearch_body.jsf","se");
+        
+        TEMP_VIEW_ID_TO_NAME.put("sr","/views/search/viewsearch_results.jsf");
+        TEMP_VIEW_NAME_TO_ID.put("/views/search/viewsearch_results.jsf","sr");
+        
+        //TEMP_VIEW_ID_TO_NAME.put("sr","/views/search/myforums_viewall.jsf");
+        //TEMP_VIEW_NAME_TO_ID.put("/views/search/myforums_viewall.jsf","sa");
+        
         VIEW_ID_TO_NAME = Collections.unmodifiableSortedMap(TEMP_VIEW_ID_TO_NAME);
         VIEW_NAME_TO_ID = Collections.unmodifiableSortedMap(TEMP_VIEW_NAME_TO_ID);
 

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/action/Search.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,108 @@
+package org.jboss.portlet.forums.ui.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.faces.model.SelectItem;
+
+import org.jboss.portlet.forums.model.Category;
+import org.jboss.portlet.forums.model.Forum;
+import org.jboss.portlet.forums.search.SearchCriteria;
+import org.jboss.portlet.forums.ui.BaseController;
+import org.jboss.portlet.forums.ui.JSFUtil;
+
+public class Search extends ActionController {
+
+    private static final long serialVersionUID = 1L;
+    
+    private SearchCriteria searchCriteria = new SearchCriteria();
+
+    public SearchCriteria getSearchCriteria()
+    {
+        return searchCriteria;
+    }
+
+    public void setSearchCriteria(SearchCriteria searchCriteria)
+    {
+        this.searchCriteria = searchCriteria;
+    }
+
+    public boolean isInitialized()
+    {
+        boolean initialized = false;
+        
+        try
+        { 
+            this.execute();
+            initialized = true;
+        }
+        catch(Exception e)
+        {
+            JSFUtil.handleException(e);
+        }
+        
+        return initialized;
+    }
+	
+	@SuppressWarnings("unchecked")
+    public Collection<SelectItem> getCategoriesItems()
+    {
+        Collection<SelectItem> categories = new ArrayList<SelectItem>();
+        
+        categories.add(new SelectItem("", "Search All Categories"));
+        
+        try {
+            List<Category> c = BaseController.getForumsModule().findCategories();
+            
+            if (c != null) {
+                for (Category category : c) {
+                    categories.add(new SelectItem(category.getId().toString(), category.getTitle()));
+                }
+            }
+            
+        } catch (Exception e) {
+            JSFUtil.handleException(e);
+        }
+        
+        return categories;
+    }
+    
+	@SuppressWarnings("unchecked")
+    public Collection<SelectItem> getForumsItems()
+    {
+        Collection<SelectItem> forums = new ArrayList<SelectItem>();
+        
+        forums.add(new SelectItem("", "Search All Forums"));
+        
+        try {
+            List<Forum> f = BaseController.getForumsModule().findForums();
+            
+            if (f != null) {
+                for (Forum forum : f) {
+                    forums.add(new SelectItem(forum.getId().toString(), forum.getName()));
+                }
+            }
+
+        } catch (Exception e) {
+            JSFUtil.handleException(e);
+        }
+        
+        return forums;
+    }
+	
+	public String search()
+	{
+		return "success";
+	}
+	
+    private void execute() throws Exception
+    {
+        searchCriteria = new SearchCriteria();
+    }
+
+}
+
+
+
+  
\ No newline at end of file

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewSearch.java	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,154 @@
+package org.jboss.portlet.forums.ui.view;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.portlet.forums.model.Post;
+import org.jboss.portlet.forums.search.ResultPage;
+import org.jboss.portlet.forums.search.SearchCriteria;
+import org.jboss.portlet.forums.ui.BaseController;
+import org.jboss.portlet.forums.ui.Constants;
+import org.jboss.portlet.forums.ui.ForumUtil;
+import org.jboss.portlet.forums.ui.JSFUtil;
+import org.jboss.portlet.forums.ui.action.PreferenceController;
+import org.jboss.portlet.forums.ui.action.Search;
+
+public class ViewSearch extends BaseController {
+
+    private static final long serialVersionUID = 1L;
+    
+    /**
+     * user preference related data
+     */
+    private PreferenceController userPreferences = null;
+    
+    private List<Post> posts;
+    
+    private Search search;
+    
+    private PageNavigator pageNavigator = null;
+    
+	public List<Post> getPosts()
+	{
+        return posts;
+    }
+
+    public Search getSearch()
+    {
+        return search;
+    }
+
+    public void setSearch(Search search)
+    {
+        this.search = search;
+    }
+    
+    public PageNavigator getPageNavigator()
+    {
+        return this.pageNavigator;
+    }
+    
+    //------------user preferences-------------------------------------------------------------------------------------------------------------
+    /**
+     * @return Returns the userPreferences.
+     */
+    public PreferenceController getUserPreferences() 
+    {
+        return userPreferences;
+    }
+    /**
+     * @param userPreferences The userPreferences to set.
+     */
+    public void setUserPreferences(PreferenceController userPreferences) 
+    {
+        this.userPreferences = userPreferences;    
+    }      
+    //-------------------------------------------------------------------------------------------------------------------------------------                
+
+    public boolean isInitialized()
+    {
+       boolean initialized = false;
+       try
+       { 
+           this.execute();
+           initialized = true;
+       }
+       catch(Exception e)
+       {
+           JSFUtil.handleException(e);
+       }
+       return initialized;
+    }
+
+    @SuppressWarnings("unchecked")
+    private void execute() throws Exception
+    {
+        
+        String page = ForumUtil.getParameter(Constants.p_page);
+        
+        int currentPage = 0;
+        if (page != null && page.trim().length() > 0) {
+            //setup the page data
+            currentPage = Integer.parseInt(page);
+        }
+        
+        SearchCriteria criteria = search.getSearchCriteria();
+        
+        if (criteria != null) {
+            criteria.setPageSize(Integer.valueOf(this.userPreferences.getPreference(Constants.POSTS_TOPIC_KEY)));
+            criteria.setPageNumber(currentPage);
+            
+            ResultPage<Post> resultPage = BaseController.getSearchModule().findPosts(criteria);
+            
+            if (resultPage != null) {
+                posts = resultPage.getPage();
+            
+                if (posts.isEmpty())
+                    posts = null;
+                
+                this.pageNavigator =
+                    new PageNavigator(resultPage.getResultSize(),
+                                      criteria.getPageSize(),
+                                      currentPage) {
+    
+                        protected Collection<Post> initializePage() {
+                        
+                            int beginIndex = this.getBeginIndex();
+                            int totalEntries = this.getNumberOfEntries();
+                            
+                            //reset the page navigation if the start cursor is outside the range (both forward and backward)
+                            if(beginIndex >= totalEntries || beginIndex < 0)
+                            {
+                                this.setCurrentPage(0); //go to the first page
+                                beginIndex = this.getBeginIndex();
+                            }
+                            
+                            return getPosts();
+                        }
+                    };
+            } else {
+                this.pageNavigator =
+                    new PageNavigator(0,
+                                      criteria.getPageSize(),
+                                      currentPage) {
+    
+                        protected Collection<Post> initializePage() {
+                        
+                            int beginIndex = this.getBeginIndex();
+                            int totalEntries = this.getNumberOfEntries();
+                            
+                            //reset the page navigation if the start cursor is outside the range (both forward and backward)
+                            if(beginIndex >= totalEntries || beginIndex < 0)
+                            {
+                                this.setCurrentPage(0); //go to the first page
+                                beginIndex = this.getBeginIndex();
+                            }
+                            
+                            return getPosts();
+                        }
+                    };
+            }
+        }
+    }
+	
+}

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-ear/META-INF/application.xml
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-ear/META-INF/application.xml	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-ear/META-INF/application.xml	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <application>
    <display-name>JBoss Forums</display-name>
-   <module>
-           <java>portal-forums-ui.jar</java>
+   <module>
+           <java>portal-forums-ui.jar</java>
    </module>
    <module>
 	   <java>jsf-facelets.jar</java>
@@ -22,7 +22,21 @@
    <module>
 	   <java>myfaces-api.jar</java>
    </module>
+   
    <module>
+       <java>lucene-core.jar</java>
+   </module>
+   <module>
+       <java>hibernate-search.jar</java>
+   </module>
+   <module>
+       <java>ejb3-persistence.jar</java>
+   </module>
+   <module>
+       <java>hibernate-commons-annotations.jar</java>
+   </module>
+   
+   <module>
 	   <java>commons-collections.jar</java>
    </module>
    <module>

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-sar/META-INF/jboss-service.xml
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-sar/META-INF/jboss-service.xml	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-sar/META-INF/jboss-service.xml	2008-03-11 12:28:50 UTC (rev 18823)
@@ -26,6 +26,21 @@
       <attribute name="JNDIName">java:portal/ForumsModule</attribute>
       <depends optional-attribute-name="Hibernate" proxy-type="attribute">portal.forums:service=Hibernate</depends>
    </mbean>
+   <mbean
+      code="org.jboss.portlet.forums.search.ForumsSearchModuleImpl"
+      name="portal.forums:service=Module,type=Search"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+      <attribute name="JNDIName">java:portal/ForumsSearchModule</attribute>
+      <depends optional-attribute-name="Hibernate" proxy-type="attribute">portal.forums:service=Hibernate</depends>
+   </mbean>
+   <mbean
+      code="org.jboss.portlet.forums.search.ForumsIndexBuilder"
+      name="portal.forums:service=Module,type=IndexBuilder">
+      <xmbean/>
+      <depends optional-attribute-name="Hibernate" proxy-type="attribute">portal.forums:service=Hibernate</depends>
+   </mbean>
 <!-- configure the AuthorizationContext for this application -->
 <mbean name="portal.forums:service=AuthorizationContext"
        code="org.jboss.portlet.forums.auth.AuthorizationContextImpl" 	

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-sar/conf/hibernate/hibernate.cfg.xml
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-sar/conf/hibernate/hibernate.cfg.xml	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-sar/conf/hibernate/hibernate.cfg.xml	2008-03-11 12:28:50 UTC (rev 18823)
@@ -18,13 +18,20 @@
       <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
       <property name="hibernate.cache.use_query_cache">true</property>
       <property name="hibernate.cache.use_second_level_cache">true</property>
-      <property name="hibernate.generate_statistics">true</property>
+      <property name="hibernate.generate_statistics">true</property>
       <property name="hibernate.cache.use_structured_entries">true</property>
       <!-- Force the dialect instead of using autodetection -->
       <!--
       <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
       -->
 
+      <property name="hibernate.search.autoregister_listeners">false</property>
+      <property name="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</property>
+      <property name="hibernate.search.default.indexBase">/Users/dejp/lucene/indexes</property>
+      <property name="hibernate.search.default.optimizer.operation_limit.max">2000</property>
+      
+      <property name="org.hibernate.worker.batch_size">2000</property>
+
       <!-- Mapping files -->
       <!-- Luca Stancapiano - I add ForumInstanceImpl to use with hibernate -->
       <mapping resource="org/jboss/portlet/forums/impl/ForumInstanceImpl.hbm.xml"/>
@@ -36,7 +43,18 @@
       <mapping resource="org/jboss/portlet/forums/impl/TopicImpl.hbm.xml"/>
       <mapping resource="org/jboss/portlet/forums/impl/WatchImpl.hbm.xml"/>
       <mapping resource="org/jboss/portlet/forums/impl/AttachmentImpl.hbm.xml"/>
+
       <!-- Luca Stancapiano - I add Queries to put off queries inside java code -->
       <mapping resource="org/jboss/portlet/forums/impl/Queries.hbm.xml"/>
+      
+      <event type="post-update">
+        <listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
+      </event>
+      <event type="post-insert">
+        <listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
+      </event>
+      <event type="post-delete">
+        <listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
+      </event>
    </session-factory>
 </hibernate-configuration>

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties	2008-03-11 12:28:50 UTC (rev 18823)
@@ -469,3 +469,34 @@
 Category_delete=Delete Category
 
 topiclockederr=This topic is locked. Modifying any posts or replying to this topic is not allowed
+
+Search_keywords=Keywords
+Search_keywords_note=You can use AND to define words which must be in the results, OR to define words which may be in the result and NOT to define words which should not be in the result. Use quotes to search for a specific phrase. Use * as a wildcard for partial matches.
+Search_author=Author
+Search_author_note=Use * as a wildcard for partial matches.
+Search_advanced=Advanced Search
+Search_category=Limit search within a specific Category:
+Search_forum=Limit search within a specific Forum:
+Search_time_period=Limit search to a time period:
+Search_all_posts=All Posts
+Search_1_day=1 Day
+Search_7_days=7 Days
+Search_2_weeks=2 Weeks
+Search_1_month=1 Month
+Search_3_months=3 Months
+Search_6_months=6 Months
+Search_1_year=1 Year
+Search_searching=Searching titles and message text:
+Search_title_message=Search topic title and message text
+Search_message=Search message text only
+Search_sort=Sort search results by:
+Search_post_time=Post Time
+Search_post_subject=Post Subject
+Search_author=Author
+Search_forum=Forum
+Search_ascending=Ascending
+Search_descending=Descending
+Search_search=Search
+Search_reset=Reset
+Search_found=Search found {0} matches
+Search_not_found=No posts found

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml	2008-03-11 12:28:50 UTC (rev 18823)
@@ -141,6 +141,14 @@
                  <key>myForumsEdit</key>
                  <value>/views/myforums/myforums_editforums.jsf</value>
                 </map-entry>
+                <map-entry>
+                 <key>search</key>
+                 <value>/views/search/viewsearch_body.jsf</value>
+                </map-entry>
+                <map-entry>
+                 <key>searchResults</key>
+                 <value>/views/search/viewsearch_results.jsf</value>
+                </map-entry>
              </map-entries>                
 	    </managed-property>	    	    
 	</managed-bean>		
@@ -621,4 +629,34 @@
             <to-view-id>/views/myforums/myforums_editforums.xhtml</to-view-id>
         </navigation-case>
      </navigation-rule>
+
+     <managed-bean>
+        <managed-bean-name>search</managed-bean-name>
+        <managed-bean-class>org.jboss.portlet.forums.ui.action.Search</managed-bean-class>
+        <managed-bean-scope>session</managed-bean-scope>
+     </managed-bean>
+     <managed-bean>
+        <managed-bean-name>viewSearch</managed-bean-name>
+        <managed-bean-class>org.jboss.portlet.forums.ui.view.ViewSearch</managed-bean-class>
+        <managed-bean-scope>request</managed-bean-scope>
+        <managed-property>
+            <property-name>userPreferences</property-name>
+            <property-class>org.jboss.portlet.forums.ui.action.PreferenceController</property-class>
+            <value>#{prefController}</value>
+        </managed-property>
+        <managed-property>
+            <property-name>search</property-name>
+            <property-class>org.jboss.portlet.forums.ui.action.Search</property-class>
+            <value>#{search}</value>
+        </managed-property>
+     </managed-bean>     
+
+     <navigation-rule>
+        <from-view-id>/views/search/viewsearch_body.xhtml</from-view-id>    
+        <navigation-case>
+            <from-outcome>success</from-outcome>
+            <to-view-id>/views/search/viewsearch_results.xhtml</to-view-id>
+        </navigation-case>
+     </navigation-rule>
+     
 </faces-config>

Modified: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/common/common.xhtml
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/common/common.xhtml	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/common/common.xhtml	2008-03-11 12:28:50 UTC (rev 18823)
@@ -48,6 +48,11 @@
                 ${resource.Home}
             </h:outputLink>
         </li>
+
+        <li>
+            &#160;&#160;|&#160;&#160;
+            <h:outputLink value="#{forums:outputLink(shared.links['search'],true)}">Search </h:outputLink>
+        </li>
         
         <c:if test="#{shared.anonymous==false &amp;&amp; forums:isRunningInPortal()==false}">
         <li>

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/resources/portal-forums-war/views/search)

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,173 +0,0 @@
-<!--
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
--->
-
-<div  xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:ui="http://java.sun.com/jsf/facelets"
-      xmlns:c="http://java.sun.com/jstl/core"
-      xmlns:h="http://java.sun.com/jsf/html"
-      xmlns:f="http://java.sun.com/jsf/core"
-      xmlns:forums="http://www.jboss.com/products/jbossportal/forums"
-      class="forumscontainer">
-
-<ui:composition template="/views/common/common.xhtml">
-    <ui:define name="mainContent">
-    
-        <c:choose>
-    
-        <c:when test="#{search.initialized}">    
-    
-        <div class="forumbread">
-            <ul>
-                <li class="first">
-                
-                    <h:outputLink value="#{forums:outputLink(shared.links['category'],true)}">
-                        <h:outputText value="#{shared.mainPageName}"/>
-                    </h:outputLink>
-                    
-                </li>
-
-            </ul>
-        </div>
-
-        <h:form>
-        <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
-        
-            <tr class="header">
-                <td class="forumheaderfirst" colspan="2">Search</td>
-            </tr>
-            
-            <tr class="oddRow">
-                <td class="rowlinefirst" style="width:40%;">
-                    <strong>${resource.Search_keywords}</strong><br />
-                    <span class="note">${resource.Search_keywords_note}</span>
-                </td>
-                <td class="rowline" style="width:60%;">
-                    <h:inputText value="#{search.searchCriteria.keywords}" required="true" style="width:275px;"></h:inputText>
-                </td>
-            </tr>
-
-            <tr class="evenRow">
-                <td class="rowlinefirst">
-                    <strong>${resource.Search_author}</strong><br />
-                    <span class="note">${resource.Search_author_note}</span>
-                </td>
-                <td class="rowline">
-                    <span id=""></span>
-
-                    <h:inputText value="#{search.searchCriteria.author}" style="width:275px;"></h:inputText>
-                </td>
-            </tr>
-        
-            <tr class="header">
-                <td class="forumheaderfirst" colspan="2">${resource.Search_advanced}</td>
-            </tr>
-        
-            <tr class="oddRow">
-                <td class="rowlinefirst">${resource.Search_category}</td>
-    
-                <td class="rowline">
-                    <span id=""></span>
-                    
-                    <h:selectOneMenu value="#{search.searchCriteria.category}">
-                        <f:selectItems value="#{search.categoriesItems}"></f:selectItems>
-                    </h:selectOneMenu>
-                </td>
-            </tr>
-        
-            <tr class="evenRow">
-                <td class="rowlinefirst">${resource.Search_forum}</td>
-                <td class="rowline">
-               
-                    <h:selectOneMenu value="#{search.searchCriteria.forum}">
-                        <f:selectItems value="#{search.forumsItems}"></f:selectItems>
-                    </h:selectOneMenu>
-                </td>
-            </tr>
-            
-            <tr class="oddRow">
-                <td class="rowlinefirst">
-                    ${resource.Search_time_period}<br />           
-                </td>
-               
-                <td class="rowline">
-                    <h:selectOneMenu value="#{search.searchCriteria.timePeriod}">
-                        <f:selectItem itemValue="ALL" itemLabel="#{resource.Search_all_posts}" />
-                        <f:selectItem itemValue="DAY" itemLabel="#{resource.Search_1_day}" />
-                        <f:selectItem itemValue="SEVEN_DAYS" itemLabel="#{resource.Search_7_days}" />
-                        <f:selectItem itemValue="TWO_WEEKS" itemLabel="#{resource.Search_2_weeks}" />
-                        <f:selectItem itemValue="MONTH" itemLabel="#{resource.Search_1_month}" />
-                        <f:selectItem itemValue="THREE_MONTHS" itemLabel="#{resource.Search_3_months}" />
-                        <f:selectItem itemValue="SIX_MONTHS" itemLabel="#{resource.Search_6_months}" />
-                        <f:selectItem itemValue="YEAR" itemLabel="#{resource.Search_1_year}" />
-                    </h:selectOneMenu>
-                </td>
-            </tr>
-            
-            <tr class="evenRow">
-                <td class="rowlinefirst">${resource.Search_searching}</td>
-                <td class="rowline">
-                
-                    <h:selectOneRadio value="#{search.searchCriteria.searching}" required="true" layout="pageDirection">
-                        <f:selectItem itemValue="TITLE_MSG" itemLabel="#{resource.Search_title_message}" />
-                        <f:selectItem itemValue="MSG" itemLabel="#{resource.Search_message}" />
-                    </h:selectOneRadio>                
-                
-                </td>
-            </tr>
-        
-            <tr class="evenRow">
-                <td class="rowlinefirst">${resource.Search_sort}</td>
-                <td class="rowline">
-                    <h:selectOneMenu value="#{search.searchCriteria.sortBy}">
-                        <f:selectItem itemValue="POST_TIME" itemLabel="#{resource.Search_post_time}" />
-                        <f:selectItem itemValue="POST_SUBJECT" itemLabel="#{resource.Search_post_subject}" />
-                        <f:selectItem itemValue="AUTHOR" itemLabel="#{resource.Search_author}" />
-                        <f:selectItem itemValue="FORUM" itemLabel="#{resource.Search_forum}" />
-                    </h:selectOneMenu><br />
-               
-                    <h:selectOneRadio value="#{search.searchCriteria.sortOrder}" required="true" layout="pageDirection">
-                        <f:selectItem itemValue="ASC" itemLabel="#{resource.Search_ascending}" />
-                        <f:selectItem itemValue="DESC" itemLabel="#{resource.Search_descending}" />
-                    </h:selectOneRadio>
-                </td>
-            </tr>
-        
-            <tr>
-                <td class="forumformbuttonrow" colspan="2" style="border:0px;">
-                    <h:commandButton type="submit" action="#{search.search}" value="#{resource.Search_search}" styleClass="buttonMed"></h:commandButton>
-                    <h:commandButton type="reset" value="#{resource.Search_reset}" styleClass="buttonMed"></h:commandButton>
-                </td>
-            </tr>
-
-        </table>
-        </h:form>
-        
-        </c:when>
-        
-        </c:choose>
-    
-    </ui:define>
-</ui:composition>
-
-</div>

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_body.xhtml	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,173 @@
+<!--
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+-->
+
+<div  xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:c="http://java.sun.com/jstl/core"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:forums="http://www.jboss.com/products/jbossportal/forums"
+      class="forumscontainer">
+
+<ui:composition template="/views/common/common.xhtml">
+    <ui:define name="mainContent">
+    
+        <c:choose>
+    
+        <c:when test="#{search.initialized}">    
+    
+        <div class="forumbread">
+            <ul>
+                <li class="first">
+                
+                    <h:outputLink value="#{forums:outputLink(shared.links['category'],true)}">
+                        <h:outputText value="#{shared.mainPageName}"/>
+                    </h:outputLink>
+                    
+                </li>
+
+            </ul>
+        </div>
+
+        <h:form>
+        <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
+        
+            <tr class="header">
+                <td class="forumheaderfirst" colspan="2">Search</td>
+            </tr>
+            
+            <tr class="oddRow">
+                <td class="rowlinefirst" style="width:40%;">
+                    <strong>${resource.Search_keywords}</strong><br />
+                    <span class="note">${resource.Search_keywords_note}</span>
+                </td>
+                <td class="rowline" style="width:60%;">
+                    <h:inputText value="#{search.searchCriteria.keywords}" required="true" style="width:275px;"></h:inputText>
+                </td>
+            </tr>
+
+            <tr class="evenRow">
+                <td class="rowlinefirst">
+                    <strong>${resource.Search_author}</strong><br />
+                    <span class="note">${resource.Search_author_note}</span>
+                </td>
+                <td class="rowline">
+                    <span id=""></span>
+
+                    <h:inputText value="#{search.searchCriteria.author}" style="width:275px;"></h:inputText>
+                </td>
+            </tr>
+        
+            <tr class="header">
+                <td class="forumheaderfirst" colspan="2">${resource.Search_advanced}</td>
+            </tr>
+        
+            <tr class="oddRow">
+                <td class="rowlinefirst">${resource.Search_category}</td>
+    
+                <td class="rowline">
+                    <span id=""></span>
+                    
+                    <h:selectOneMenu value="#{search.searchCriteria.category}">
+                        <f:selectItems value="#{search.categoriesItems}"></f:selectItems>
+                    </h:selectOneMenu>
+                </td>
+            </tr>
+        
+            <tr class="evenRow">
+                <td class="rowlinefirst">${resource.Search_forum}</td>
+                <td class="rowline">
+               
+                    <h:selectOneMenu value="#{search.searchCriteria.forum}">
+                        <f:selectItems value="#{search.forumsItems}"></f:selectItems>
+                    </h:selectOneMenu>
+                </td>
+            </tr>
+            
+            <tr class="oddRow">
+                <td class="rowlinefirst">
+                    ${resource.Search_time_period}<br />           
+                </td>
+               
+                <td class="rowline">
+                    <h:selectOneMenu value="#{search.searchCriteria.timePeriod}">
+                        <f:selectItem itemValue="ALL" itemLabel="#{resource.Search_all_posts}" />
+                        <f:selectItem itemValue="DAY" itemLabel="#{resource.Search_1_day}" />
+                        <f:selectItem itemValue="SEVEN_DAYS" itemLabel="#{resource.Search_7_days}" />
+                        <f:selectItem itemValue="TWO_WEEKS" itemLabel="#{resource.Search_2_weeks}" />
+                        <f:selectItem itemValue="MONTH" itemLabel="#{resource.Search_1_month}" />
+                        <f:selectItem itemValue="THREE_MONTHS" itemLabel="#{resource.Search_3_months}" />
+                        <f:selectItem itemValue="SIX_MONTHS" itemLabel="#{resource.Search_6_months}" />
+                        <f:selectItem itemValue="YEAR" itemLabel="#{resource.Search_1_year}" />
+                    </h:selectOneMenu>
+                </td>
+            </tr>
+            
+            <tr class="evenRow">
+                <td class="rowlinefirst">${resource.Search_searching}</td>
+                <td class="rowline">
+                
+                    <h:selectOneRadio value="#{search.searchCriteria.searching}" required="true" layout="pageDirection">
+                        <f:selectItem itemValue="TITLE_MSG" itemLabel="#{resource.Search_title_message}" />
+                        <f:selectItem itemValue="MSG" itemLabel="#{resource.Search_message}" />
+                    </h:selectOneRadio>                
+                
+                </td>
+            </tr>
+        
+            <tr class="evenRow">
+                <td class="rowlinefirst">${resource.Search_sort}</td>
+                <td class="rowline">
+                    <h:selectOneMenu value="#{search.searchCriteria.sortBy}">
+                        <f:selectItem itemValue="POST_TIME" itemLabel="#{resource.Search_post_time}" />
+                        <f:selectItem itemValue="POST_SUBJECT" itemLabel="#{resource.Search_post_subject}" />
+                        <f:selectItem itemValue="AUTHOR" itemLabel="#{resource.Search_author}" />
+                        <f:selectItem itemValue="FORUM" itemLabel="#{resource.Search_forum}" />
+                    </h:selectOneMenu><br />
+               
+                    <h:selectOneRadio value="#{search.searchCriteria.sortOrder}" required="true" layout="pageDirection">
+                        <f:selectItem itemValue="ASC" itemLabel="#{resource.Search_ascending}" />
+                        <f:selectItem itemValue="DESC" itemLabel="#{resource.Search_descending}" />
+                    </h:selectOneRadio>
+                </td>
+            </tr>
+        
+            <tr>
+                <td class="forumformbuttonrow" colspan="2" style="border:0px;">
+                    <h:commandButton type="submit" action="#{search.search}" value="#{resource.Search_search}" styleClass="buttonMed"></h:commandButton>
+                    <h:commandButton type="reset" value="#{resource.Search_reset}" styleClass="buttonMed"></h:commandButton>
+                </td>
+            </tr>
+
+        </table>
+        </h:form>
+        
+        </c:when>
+        
+        </c:choose>
+    
+    </ui:define>
+</ui:composition>
+
+</div>

Deleted: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml
===================================================================
--- labs/jbossforums/branches/forums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml	2008-03-11 12:28:50 UTC (rev 18823)
@@ -1,440 +0,0 @@
-<!--
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
--->
-
-<div  xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:ui="http://java.sun.com/jsf/facelets"
-      xmlns:c="http://java.sun.com/jstl/core"
-      xmlns:h="http://java.sun.com/jsf/html"
-      xmlns:f="http://java.sun.com/jsf/core"
-      xmlns:forums="http://www.jboss.com/products/jbossportal/forums"
-      class="forumscontainer">
-
-<ui:composition template="/views/common/common.xhtml">
-    <ui:define name="mainContent">
-    
-        <c:choose>
-    
-            <c:when test="#{viewSearch.initialized &amp;&amp; viewSearch.posts != null}">
-
-                <a name="top" />
-
-                <div class="forumtitletext">
-                    <h4>
-                        <h:outputFormat value="#{resource.Search_found}">
-                            <f:param value="#{viewSearch.pageNavigator.numberOfEntries}" />
-                        </h:outputFormat>
-                    </h4>
-                </div>
-	    
-			    <!-- PAGINATION -->
-			    <c:if test="#{viewSearch.pageNavigator.totalPages gt 1}">
-			    <div class="forumpagination">
-			        <ul>
-			            <li class="disablepage">
-			                <h:outputFormat value="#{resource.PageNumber}">
-			                    <f:param value="${viewSearch.pageNavigator.pageNumber}"/>
-			                    <f:param value="${viewSearch.pageNavigator.totalPages}"/>
-			                </h:outputFormat>
-			            </li>
-			            
-			            <c:choose>
-			                <c:when test="#{viewSearch.pageNavigator.currentPage eq 0}">
-			                    <li class="disablepage">
-			                        ${resource.First}
-			                    </li>
-			                    <li class="disablepage">
-			                        &#60; ${resource.Previous}
-			                    </li>
-			                </c:when>
-			                <c:otherwise>
-			                    <li>
-			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                            <f:param name="page" value="0"/>
-			                            <h:outputText value="${resource.First}"/>
-			                        </h:outputLink>    
-			                    </li>
-			                    <li>
-			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                            <f:param name="page" value="${viewSearch.pageNavigator.currentPage-1}"/>
-			                            <h:outputText value="&#60; ${resource.Previous}"/>
-			                        </h:outputLink>    
-			                    </li>
-			                </c:otherwise>
-			            </c:choose>
-			            
-			            <c:forEach items="#{viewSearch.pageNavigator.currentPaginationLeft}" var="pageNumber">
-			                <li>
-			                    <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                        <f:param name="page" value="${pageNumber-1}"/>
-			                        <h:outputText value="${pageNumber}"/>
-			                    </h:outputLink>  
-			                </li>
-			            </c:forEach>
-			            
-			            <li class="currentpage">
-			                ${viewSearch.pageNavigator.currentPage+1}
-			            </li>
-			            
-			            <c:forEach items="#{viewSearch.pageNavigator.currentPaginationRight}" var="pageNumber">
-			                <li>
-			                    <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                        <f:param name="page" value="${pageNumber-1}"/>
-			                        <h:outputText value="${pageNumber}"/>
-			                    </h:outputLink>  
-			                </li>
-			            </c:forEach>
-			            
-			            <c:choose>
-			                <c:when test="#{viewSearch.pageNavigator.currentPage eq (viewSearch.pageNavigator.totalPages-1) }">
-			                    <li class="disablepage">
-			                        ${resource.Next} &#62;
-			                    </li>
-			                    <li class="disablepage">
-			                        ${resource.Last}
-			                    </li>
-			                </c:when>
-			                <c:otherwise>
-			                    <li>
-			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                            <f:param name="page" value="${viewSearch.pageNavigator.currentPage+1}"/>
-			                            <h:outputText value="${resource.Next} &#62;"/>
-			                        </h:outputLink>
-			                    </li>
-			                    <li>
-			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                            <f:param name="page" value="${viewSearch.pageNavigator.totalPages-1}"/>
-			                            <h:outputText value="${resource.Last}"/>
-			                        </h:outputLink>
-			                    </li>
-			                </c:otherwise>
-			            </c:choose>
-			        </ul>
-			    </div>
-			    </c:if>
-
-	            <h:form>
-			        <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
-
-				        <tr class="header">
-				            <td class="forumheaderfirst">${resource.Author}</td>
-				            <td class="forumheaderopen">${resource.Message}</td>
-				        </tr>
-			        
-				        <c:forEach items="#{viewSearch.posts}" var="postrow" varStatus="status">
-				        <tr class="oddRow">
-				            <td class="forumpostleftcolumn">
-				                <c:choose>
-				                    
-				                    <c:when test="#{category.anonymous}">
-				                        ${postrow.poster.user.userName}
-				                    </c:when>
-				                    
-				                    <c:otherwise>
-				                        <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
-				                            <f:param name="uid" value="${postrow.poster.user.id}"/>
-				                            <h:outputText value="${postrow.poster.user.userName}"/>
-				                        </h:outputLink>
-				                    </c:otherwise>
-				                    
-				                </c:choose>
-				            </td>
-				            <td class="forumpostspacer">
-				            
-				                <a name="${postrow.id}" />
-				                
-				                <div class="forumpostinfo">
-				                    <ul>
-				                        <li>
-				                            <a name="${postrow.id}" />
-				                            <h:outputLink value="#{forums:postPermlink(postrow.id)}" style="text-decoration: none;">
-				                                <f:verbatim>
-				                                    <h:outputText value="${resource.Permalink}"/>
-				                                </f:verbatim>
-				                            </h:outputLink>
-				                        </li>
-				                        <li>${resource.Posted}:&#160;#{forums:dateStr(postrow.createDate)}</li>
-				                        <li>${resource.Post_subject}:&#160;${postrow.message.subject}</li>
-				                    </ul>
-				                </div>
-				            </td>
-				        </tr>
-				        <tr>
-				            <td class="forumpostleftcolumn">&#160;</td>
-				            <td class="forumpostcontent">
-				
-				                <p>
-				                    <h:outputText value="#{forums:formatMessage(postrow.message.text,false)}" escape="false" />
-				                    <br /><br />
-				                    ${forums:userProperty(postrow.poster.user,'INFO_USER_SIGNATURE')}
-				                </p>
-				
-				                <!-- show the attachments of this post here -->
-				                <p>
-				                    <c:if test="#{postrow.attachments!=null}">
-				                        <ui:include src="/views/topics/attachmentsview.xhtml">
-				                            <ui:param name="attachments" value="#{postrow.attachments}"/>
-				                        </ui:include>
-				                    </c:if>
-				                </p>
-				
-				                <c:if test="${postrow.editCount gt 0}">
-				                <p>
-				                    <em>
-				                        <c:choose>
-				                            <c:when test="${postrow.editCount eq 1}">
-				                                <h:outputFormat value="#{resource.Edited_time_total}">
-				                                    <f:param value="${postrow.poster.user.userName}"/>
-				                                    <f:param value="${postrow.editDate}"/>
-				                                    <f:param value="${postrow.editCount}"/>
-				                                </h:outputFormat>
-				                            </c:when>
-				                            <c:otherwise>
-				                                <h:outputFormat value="#{resource.Edited_times_total}">
-				                                    <f:param value="${postrow.poster.user.userName}"/>
-				                                    <f:param value="${postrow.editDate}"/>
-				                                    <f:param value="${postrow.editCount}"/>
-				                                </h:outputFormat>
-				                            </c:otherwise>
-				                        </c:choose>
-				                    </em>
-				                </p>
-				                </c:if>
-				                
-				            </td>
-				        </tr>
-				        <tr>
-				            <td class="forumpostleftcolumn">
-				                <a href="#top">${resource.Back_to_top}</a>
-				            </td>
-				            <td class="forumthreaduserinfo">
-				                <ul>
-				                    <li>
-				                        <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
-				                            <f:param name="uid"
-				                                     value="#{postrow.poster.user.id}"/>
-				                            <f:verbatim>
-				                                <img border="0"
-				                                     src="#{forums:themeURL('resourceIconProfileURL')}"
-				                                     alt="${resource.Read_profile}"/>
-				                            </f:verbatim>
-				                        </h:outputLink>
-				                    </li>
-				                    				                    
-				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_EMAIL_FAKE') ne null}">
-				                        <li>
-				                            <a href="mailto:${forums:userProperty(postrow.poster.user,'INFO_USER_EMAIL_FAKE')}">
-				                                <img border="0"
-				                                     src="#{forums:themeURL('resourceIconEmailURL')}"
-				                                     alt="${resource.Send_email}"/>
-				                            </a>
-				                        </li>
-				                    </c:if>
-				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_HOMEPAGE') ne null}">
-				                        <li>
-				                            <a href="${forums:userProperty(postrow.poster.user,'INFO_USER_HOMEPAGE')}">
-				                                <img border="0"
-				                                     src="#{forums:themeURL('resourceIconWWWURL')}"
-				                                     alt="${resource.Visit_website}"/>
-				                            </a>
-				                        </li>
-				                    </c:if>
-				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_AIM') ne null}">
-				                        <li>
-				                            <a href="aim:goim?screenname=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_AIM')}&amp;message=Hello+Are+you+there?">
-				                                <img border="0"
-				                                     src="#{forums:themeURL('resourceIconAIMURL')}"
-				                                     alt="${resource.AIM}"/>
-				                            </a>
-				                        </li>
-				                    </c:if>
-				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_YIM') ne null}">
-				                        <li>
-				                            <a href="http://edit.yahoo.com/config/send_webmesg?.target=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_YIM')}&amp;.src=pg">
-				                                <img border="0"
-				                                     src="#{forums:themeURL('resourceIconYIMURL')}"
-				                                     alt="${resource.YIM}"/>
-				                            </a>
-				                        </li>
-				                    </c:if>
-				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_SKYPE') ne null}">
-				                        <li>
-				                            <!-- TODO: some more functionality may be added. Like automatic skype instalation and status checker.-->
-				                            <a href="skype:#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_SKYPE')}?add">
-				                                <img border="0"
-				                                     src="#{forums:themeURL('resourceIconSkypeURL')}"
-				                                     alt="${resource.L_SKYPE}"/>
-				                            </a>
-				                        </li>
-				                    </c:if>
-				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_MSNM') ne null}">
-				                        <li>
-				                            <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
-				                                <f:param name="uid"
-				                                         value="#{postrow.poster.user.id}"/>
-				                                <f:verbatim>
-				                                    <img border="0"
-				                                         src="#{forums:themeURL('resourceIconMSNMURL')}"
-				                                         alt="${resource.Read_profile}"/>
-				                                </f:verbatim>
-				                            </h:outputLink>
-				                         </li>
-				                    </c:if>
-				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_ICQ') ne null}">
-				                        <li>
-				                            <a href="http://www.icq.com/scripts/search.dll?to=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_ICQ')}">
-				                                <img border="0"
-				                                     src="#{forums:themeURL('resourceIconICQURL')}"
-				                                     alt="${resource.ICQ}"/>
-				                            </a>
-				                        </li>
-				                    </c:if>
-				                    
-				                </ul>
-				            </td>
-				        </tr> 
-				        <tr>
-				            <td colspan="2" class="forumthreadfooter">
-				                <img src="#{forums:themeURL('resourceSpacerURL')}" />
-				            </td>
-				        </tr>
-				        </c:forEach>
-			
-			        </table>
-	            </h:form>
-
-			    <!-- PAGINATION -->
-			    <c:if test="#{viewSearch.pageNavigator.totalPages gt 1}">
-			    <div class="forumpagination">
-			        <ul>
-			            <li class="disablepage">
-			                <h:outputFormat value="#{resource.PageNumber}">
-			                    <f:param value="${viewSearch.pageNavigator.pageNumber}"/>
-			                    <f:param value="${viewSearch.pageNavigator.totalPages}"/>
-			                </h:outputFormat>
-			            </li>
-			            
-			            <c:choose>
-			                <c:when test="#{viewSearch.pageNavigator.currentPage eq 0}">
-			                    <li class="disablepage">
-			                        ${resource.First}
-			                    </li>
-			                    <li class="disablepage">
-			                        &#60; ${resource.Previous}
-			                    </li>
-			                </c:when>
-			                <c:otherwise>
-			                    <li>
-			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                            <f:param name="page" value="0"/>
-			                            <h:outputText value="${resource.First}"/>
-			                        </h:outputLink>    
-			                    </li>
-			                    <li>
-			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                            <f:param name="page" value="${viewSearch.pageNavigator.currentPage-1}"/>
-			                            <h:outputText value="&#60; ${resource.Previous}"/>
-			                        </h:outputLink>    
-			                    </li>
-			                </c:otherwise>
-			            </c:choose>
-			            
-			            <c:forEach items="#{viewSearch.pageNavigator.currentPaginationLeft}" var="pageNumber">
-			                <li>
-			                    <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                        <f:param name="page" value="${pageNumber-1}"/>
-			                        <h:outputText value="${pageNumber}"/>
-			                    </h:outputLink>  
-			                </li>
-			            </c:forEach>
-			            
-			            <li class="currentpage">
-			                ${viewSearch.pageNavigator.currentPage+1}
-			            </li>
-			            
-			            <c:forEach items="#{viewSearch.pageNavigator.currentPaginationRight}" var="pageNumber">
-			                <li>
-			                    <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                        <f:param name="page" value="${pageNumber-1}"/>
-			                        <h:outputText value="${pageNumber}"/>
-			                    </h:outputLink>  
-			                </li>
-			            </c:forEach>
-			            
-			            <c:choose>
-			                <c:when test="#{viewSearch.pageNavigator.currentPage eq (viewSearch.pageNavigator.totalPages-1) }">
-			                    <li class="disablepage">
-			                        ${resource.Next} &#62;
-			                    </li>
-			                    <li class="disablepage">
-			                        ${resource.Last}
-			                    </li>
-			                </c:when>
-			                <c:otherwise>
-			                    <li>
-			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                            <f:param name="page" value="${viewSearch.pageNavigator.currentPage+1}"/>
-			                            <h:outputText value="${resource.Next} &#62;"/>
-			                        </h:outputLink>
-			                    </li>
-			                    <li>
-			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
-			                            <f:param name="page" value="${viewSearch.pageNavigator.totalPages-1}"/>
-			                            <h:outputText value="${resource.Last}"/>
-			                        </h:outputLink>
-			                    </li>
-			                </c:otherwise>
-			            </c:choose>
-			        </ul>
-			    </div>
-			    </c:if>
-	
-            </c:when>
-	
-		    <c:otherwise>
-		        <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
-		            <tr>
-		                <td>
-		                    <table width="100%" cellspacing="0" cellpadding="1" border="0">
-		                        <tr>
-		                            <td>&#160;</td>
-		                        </tr>
-		                        <tr>
-		                            <td align="center">
-		                                ${resource.Search_not_found}
-		                            </td>
-		                        </tr>
-		                        <tr>
-		                            <td>&#160;</td>
-		                        </tr>
-		                    </table>
-		                </td>
-		            </tr>
-		        </table>
-		    </c:otherwise>
-        </c:choose>
-    
-    </ui:define>
-</ui:composition>
-
-</div>

Copied: labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml (from rev 18822, labs/jbossforums/branches/forums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml)
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml	                        (rev 0)
+++ labs/jbossforums/branches/multipleforums110P26/forums/src/resources/portal-forums-war/views/search/viewsearch_results.xhtml	2008-03-11 12:28:50 UTC (rev 18823)
@@ -0,0 +1,440 @@
+<!--
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+-->
+
+<div  xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:c="http://java.sun.com/jstl/core"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:forums="http://www.jboss.com/products/jbossportal/forums"
+      class="forumscontainer">
+
+<ui:composition template="/views/common/common.xhtml">
+    <ui:define name="mainContent">
+    
+        <c:choose>
+    
+            <c:when test="#{viewSearch.initialized &amp;&amp; viewSearch.posts != null}">
+
+                <a name="top" />
+
+                <div class="forumtitletext">
+                    <h4>
+                        <h:outputFormat value="#{resource.Search_found}">
+                            <f:param value="#{viewSearch.pageNavigator.numberOfEntries}" />
+                        </h:outputFormat>
+                    </h4>
+                </div>
+	    
+			    <!-- PAGINATION -->
+			    <c:if test="#{viewSearch.pageNavigator.totalPages gt 1}">
+			    <div class="forumpagination">
+			        <ul>
+			            <li class="disablepage">
+			                <h:outputFormat value="#{resource.PageNumber}">
+			                    <f:param value="${viewSearch.pageNavigator.pageNumber}"/>
+			                    <f:param value="${viewSearch.pageNavigator.totalPages}"/>
+			                </h:outputFormat>
+			            </li>
+			            
+			            <c:choose>
+			                <c:when test="#{viewSearch.pageNavigator.currentPage eq 0}">
+			                    <li class="disablepage">
+			                        ${resource.First}
+			                    </li>
+			                    <li class="disablepage">
+			                        &#60; ${resource.Previous}
+			                    </li>
+			                </c:when>
+			                <c:otherwise>
+			                    <li>
+			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                            <f:param name="page" value="0"/>
+			                            <h:outputText value="${resource.First}"/>
+			                        </h:outputLink>    
+			                    </li>
+			                    <li>
+			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                            <f:param name="page" value="${viewSearch.pageNavigator.currentPage-1}"/>
+			                            <h:outputText value="&#60; ${resource.Previous}"/>
+			                        </h:outputLink>    
+			                    </li>
+			                </c:otherwise>
+			            </c:choose>
+			            
+			            <c:forEach items="#{viewSearch.pageNavigator.currentPaginationLeft}" var="pageNumber">
+			                <li>
+			                    <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                        <f:param name="page" value="${pageNumber-1}"/>
+			                        <h:outputText value="${pageNumber}"/>
+			                    </h:outputLink>  
+			                </li>
+			            </c:forEach>
+			            
+			            <li class="currentpage">
+			                ${viewSearch.pageNavigator.currentPage+1}
+			            </li>
+			            
+			            <c:forEach items="#{viewSearch.pageNavigator.currentPaginationRight}" var="pageNumber">
+			                <li>
+			                    <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                        <f:param name="page" value="${pageNumber-1}"/>
+			                        <h:outputText value="${pageNumber}"/>
+			                    </h:outputLink>  
+			                </li>
+			            </c:forEach>
+			            
+			            <c:choose>
+			                <c:when test="#{viewSearch.pageNavigator.currentPage eq (viewSearch.pageNavigator.totalPages-1) }">
+			                    <li class="disablepage">
+			                        ${resource.Next} &#62;
+			                    </li>
+			                    <li class="disablepage">
+			                        ${resource.Last}
+			                    </li>
+			                </c:when>
+			                <c:otherwise>
+			                    <li>
+			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                            <f:param name="page" value="${viewSearch.pageNavigator.currentPage+1}"/>
+			                            <h:outputText value="${resource.Next} &#62;"/>
+			                        </h:outputLink>
+			                    </li>
+			                    <li>
+			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                            <f:param name="page" value="${viewSearch.pageNavigator.totalPages-1}"/>
+			                            <h:outputText value="${resource.Last}"/>
+			                        </h:outputLink>
+			                    </li>
+			                </c:otherwise>
+			            </c:choose>
+			        </ul>
+			    </div>
+			    </c:if>
+
+	            <h:form>
+			        <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
+
+				        <tr class="header">
+				            <td class="forumheaderfirst">${resource.Author}</td>
+				            <td class="forumheaderopen">${resource.Message}</td>
+				        </tr>
+			        
+				        <c:forEach items="#{viewSearch.posts}" var="postrow" varStatus="status">
+				        <tr class="oddRow">
+				            <td class="forumpostleftcolumn">
+				                <c:choose>
+				                    
+				                    <c:when test="#{category.anonymous}">
+				                        ${postrow.poster.user.userName}
+				                    </c:when>
+				                    
+				                    <c:otherwise>
+				                        <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
+				                            <f:param name="uid" value="${postrow.poster.user.id}"/>
+				                            <h:outputText value="${postrow.poster.user.userName}"/>
+				                        </h:outputLink>
+				                    </c:otherwise>
+				                    
+				                </c:choose>
+				            </td>
+				            <td class="forumpostspacer">
+				            
+				                <a name="${postrow.id}" />
+				                
+				                <div class="forumpostinfo">
+				                    <ul>
+				                        <li>
+				                            <a name="${postrow.id}" />
+				                            <h:outputLink value="#{forums:postPermlink(postrow.id)}" style="text-decoration: none;">
+				                                <f:verbatim>
+				                                    <h:outputText value="${resource.Permalink}"/>
+				                                </f:verbatim>
+				                            </h:outputLink>
+				                        </li>
+				                        <li>${resource.Posted}:&#160;#{forums:dateStr(postrow.createDate)}</li>
+				                        <li>${resource.Post_subject}:&#160;${postrow.message.subject}</li>
+				                    </ul>
+				                </div>
+				            </td>
+				        </tr>
+				        <tr>
+				            <td class="forumpostleftcolumn">&#160;</td>
+				            <td class="forumpostcontent">
+				
+				                <p>
+				                    <h:outputText value="#{forums:formatMessage(postrow.message.text,false)}" escape="false" />
+				                    <br /><br />
+				                    ${forums:userProperty(postrow.poster.user,'INFO_USER_SIGNATURE')}
+				                </p>
+				
+				                <!-- show the attachments of this post here -->
+				                <p>
+				                    <c:if test="#{postrow.attachments!=null}">
+				                        <ui:include src="/views/topics/attachmentsview.xhtml">
+				                            <ui:param name="attachments" value="#{postrow.attachments}"/>
+				                        </ui:include>
+				                    </c:if>
+				                </p>
+				
+				                <c:if test="${postrow.editCount gt 0}">
+				                <p>
+				                    <em>
+				                        <c:choose>
+				                            <c:when test="${postrow.editCount eq 1}">
+				                                <h:outputFormat value="#{resource.Edited_time_total}">
+				                                    <f:param value="${postrow.poster.user.userName}"/>
+				                                    <f:param value="${postrow.editDate}"/>
+				                                    <f:param value="${postrow.editCount}"/>
+				                                </h:outputFormat>
+				                            </c:when>
+				                            <c:otherwise>
+				                                <h:outputFormat value="#{resource.Edited_times_total}">
+				                                    <f:param value="${postrow.poster.user.userName}"/>
+				                                    <f:param value="${postrow.editDate}"/>
+				                                    <f:param value="${postrow.editCount}"/>
+				                                </h:outputFormat>
+				                            </c:otherwise>
+				                        </c:choose>
+				                    </em>
+				                </p>
+				                </c:if>
+				                
+				            </td>
+				        </tr>
+				        <tr>
+				            <td class="forumpostleftcolumn">
+				                <a href="#top">${resource.Back_to_top}</a>
+				            </td>
+				            <td class="forumthreaduserinfo">
+				                <ul>
+				                    <li>
+				                        <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
+				                            <f:param name="uid"
+				                                     value="#{postrow.poster.user.id}"/>
+				                            <f:verbatim>
+				                                <img border="0"
+				                                     src="#{forums:themeURL('resourceIconProfileURL')}"
+				                                     alt="${resource.Read_profile}"/>
+				                            </f:verbatim>
+				                        </h:outputLink>
+				                    </li>
+				                    				                    
+				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_EMAIL_FAKE') ne null}">
+				                        <li>
+				                            <a href="mailto:${forums:userProperty(postrow.poster.user,'INFO_USER_EMAIL_FAKE')}">
+				                                <img border="0"
+				                                     src="#{forums:themeURL('resourceIconEmailURL')}"
+				                                     alt="${resource.Send_email}"/>
+				                            </a>
+				                        </li>
+				                    </c:if>
+				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_HOMEPAGE') ne null}">
+				                        <li>
+				                            <a href="${forums:userProperty(postrow.poster.user,'INFO_USER_HOMEPAGE')}">
+				                                <img border="0"
+				                                     src="#{forums:themeURL('resourceIconWWWURL')}"
+				                                     alt="${resource.Visit_website}"/>
+				                            </a>
+				                        </li>
+				                    </c:if>
+				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_AIM') ne null}">
+				                        <li>
+				                            <a href="aim:goim?screenname=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_AIM')}&amp;message=Hello+Are+you+there?">
+				                                <img border="0"
+				                                     src="#{forums:themeURL('resourceIconAIMURL')}"
+				                                     alt="${resource.AIM}"/>
+				                            </a>
+				                        </li>
+				                    </c:if>
+				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_YIM') ne null}">
+				                        <li>
+				                            <a href="http://edit.yahoo.com/config/send_webmesg?.target=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_YIM')}&amp;.src=pg">
+				                                <img border="0"
+				                                     src="#{forums:themeURL('resourceIconYIMURL')}"
+				                                     alt="${resource.YIM}"/>
+				                            </a>
+				                        </li>
+				                    </c:if>
+				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_SKYPE') ne null}">
+				                        <li>
+				                            <!-- TODO: some more functionality may be added. Like automatic skype instalation and status checker.-->
+				                            <a href="skype:#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_SKYPE')}?add">
+				                                <img border="0"
+				                                     src="#{forums:themeURL('resourceIconSkypeURL')}"
+				                                     alt="${resource.L_SKYPE}"/>
+				                            </a>
+				                        </li>
+				                    </c:if>
+				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_MSNM') ne null}">
+				                        <li>
+				                            <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
+				                                <f:param name="uid"
+				                                         value="#{postrow.poster.user.id}"/>
+				                                <f:verbatim>
+				                                    <img border="0"
+				                                         src="#{forums:themeURL('resourceIconMSNMURL')}"
+				                                         alt="${resource.Read_profile}"/>
+				                                </f:verbatim>
+				                            </h:outputLink>
+				                         </li>
+				                    </c:if>
+				                    <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_ICQ') ne null}">
+				                        <li>
+				                            <a href="http://www.icq.com/scripts/search.dll?to=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_ICQ')}">
+				                                <img border="0"
+				                                     src="#{forums:themeURL('resourceIconICQURL')}"
+				                                     alt="${resource.ICQ}"/>
+				                            </a>
+				                        </li>
+				                    </c:if>
+				                    
+				                </ul>
+				            </td>
+				        </tr> 
+				        <tr>
+				            <td colspan="2" class="forumthreadfooter">
+				                <img src="#{forums:themeURL('resourceSpacerURL')}" />
+				            </td>
+				        </tr>
+				        </c:forEach>
+			
+			        </table>
+	            </h:form>
+
+			    <!-- PAGINATION -->
+			    <c:if test="#{viewSearch.pageNavigator.totalPages gt 1}">
+			    <div class="forumpagination">
+			        <ul>
+			            <li class="disablepage">
+			                <h:outputFormat value="#{resource.PageNumber}">
+			                    <f:param value="${viewSearch.pageNavigator.pageNumber}"/>
+			                    <f:param value="${viewSearch.pageNavigator.totalPages}"/>
+			                </h:outputFormat>
+			            </li>
+			            
+			            <c:choose>
+			                <c:when test="#{viewSearch.pageNavigator.currentPage eq 0}">
+			                    <li class="disablepage">
+			                        ${resource.First}
+			                    </li>
+			                    <li class="disablepage">
+			                        &#60; ${resource.Previous}
+			                    </li>
+			                </c:when>
+			                <c:otherwise>
+			                    <li>
+			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                            <f:param name="page" value="0"/>
+			                            <h:outputText value="${resource.First}"/>
+			                        </h:outputLink>    
+			                    </li>
+			                    <li>
+			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                            <f:param name="page" value="${viewSearch.pageNavigator.currentPage-1}"/>
+			                            <h:outputText value="&#60; ${resource.Previous}"/>
+			                        </h:outputLink>    
+			                    </li>
+			                </c:otherwise>
+			            </c:choose>
+			            
+			            <c:forEach items="#{viewSearch.pageNavigator.currentPaginationLeft}" var="pageNumber">
+			                <li>
+			                    <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                        <f:param name="page" value="${pageNumber-1}"/>
+			                        <h:outputText value="${pageNumber}"/>
+			                    </h:outputLink>  
+			                </li>
+			            </c:forEach>
+			            
+			            <li class="currentpage">
+			                ${viewSearch.pageNavigator.currentPage+1}
+			            </li>
+			            
+			            <c:forEach items="#{viewSearch.pageNavigator.currentPaginationRight}" var="pageNumber">
+			                <li>
+			                    <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                        <f:param name="page" value="${pageNumber-1}"/>
+			                        <h:outputText value="${pageNumber}"/>
+			                    </h:outputLink>  
+			                </li>
+			            </c:forEach>
+			            
+			            <c:choose>
+			                <c:when test="#{viewSearch.pageNavigator.currentPage eq (viewSearch.pageNavigator.totalPages-1) }">
+			                    <li class="disablepage">
+			                        ${resource.Next} &#62;
+			                    </li>
+			                    <li class="disablepage">
+			                        ${resource.Last}
+			                    </li>
+			                </c:when>
+			                <c:otherwise>
+			                    <li>
+			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                            <f:param name="page" value="${viewSearch.pageNavigator.currentPage+1}"/>
+			                            <h:outputText value="${resource.Next} &#62;"/>
+			                        </h:outputLink>
+			                    </li>
+			                    <li>
+			                        <h:outputLink value="#{forums:outputLink(shared.links['searchResults'],true)}">
+			                            <f:param name="page" value="${viewSearch.pageNavigator.totalPages-1}"/>
+			                            <h:outputText value="${resource.Last}"/>
+			                        </h:outputLink>
+			                    </li>
+			                </c:otherwise>
+			            </c:choose>
+			        </ul>
+			    </div>
+			    </c:if>
+	
+            </c:when>
+	
+		    <c:otherwise>
+		        <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
+		            <tr>
+		                <td>
+		                    <table width="100%" cellspacing="0" cellpadding="1" border="0">
+		                        <tr>
+		                            <td>&#160;</td>
+		                        </tr>
+		                        <tr>
+		                            <td align="center">
+		                                ${resource.Search_not_found}
+		                            </td>
+		                        </tr>
+		                        <tr>
+		                            <td>&#160;</td>
+		                        </tr>
+		                    </table>
+		                </td>
+		            </tr>
+		        </table>
+		    </c:otherwise>
+        </c:choose>
+    
+    </ui:define>
+</ui:composition>
+
+</div>

Copied: labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate/lib/ejb3-persistence.jar (from rev 18822, labs/jbossforums/branches/forums110P26/thirdparty/jboss-hibernate/lib/ejb3-persistence.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate/lib/hibernate-commons-annotations.jar (from rev 18822, labs/jbossforums/branches/forums110P26/thirdparty/jboss-hibernate/lib/hibernate-commons-annotations.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search (from rev 18822, labs/jbossforums/branches/forums110P26/thirdparty/jboss-hibernate-search)

Copied: labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib (from rev 18822, labs/jbossforums/branches/forums110P26/thirdparty/jboss-hibernate-search/lib)

Deleted: labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib/hibernate-search.jar
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib/hibernate-search.jar (from rev 18822, labs/jbossforums/branches/forums110P26/thirdparty/jboss-hibernate-search/lib/hibernate-search.jar)
===================================================================
(Binary files differ)

Deleted: labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib/lucene-core.jar
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/multipleforums110P26/thirdparty/jboss-hibernate-search/lib/lucene-core.jar (from rev 18822, labs/jbossforums/branches/forums110P26/thirdparty/jboss-hibernate-search/lib/lucene-core.jar)
===================================================================
(Binary files differ)

Modified: labs/jbossforums/branches/multipleforums110P26/thirdparty/xdoclet-xdoclet/lib/xdoclet-xjavadoc.jar
===================================================================
(Binary files differ)

Modified: labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/defaults.ent
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/defaults.ent	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/defaults.ent	2008-03-11 12:28:50 UTC (rev 18823)
@@ -118,8 +118,8 @@
   <property name="javac.depend.cachedir" value="${build.cache}/depends"/>
 
 
-  <property name="javac.source" value="1.4"/>
-  <property name="javac.target" value="1.4"/>
+  <property name="javac.source" value="1.5"/>
+  <property name="javac.target" value="1.5"/>
   <property name="rmic.stubVersion" value="1.2"/>
 
   <!-- classpath and local.classpath must have a value using with a path -->

Modified: labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/libraries.ent
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/libraries.ent	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/libraries.ent	2008-03-11 12:28:50 UTC (rev 18823)
@@ -148,8 +148,18 @@
     <filelist dir="${jboss.hibernate.lib}" files="commons-logging.jar"/>
     <filelist dir="${jboss.hibernate.lib}" files="hibernate3.jar"/>
     <filelist dir="${jboss.hibernate.lib}" files="odmg.jar"/>
+    <filelist dir="${jboss.hibernate.lib}" files="hibernate-commons-annotations.jar"/>
+    <filelist dir="${jboss.hibernate.lib}" files="ejb3-persistence.jar"/>
   </path>
 
+  <!-- Hibernate Search -->
+  <property name="jboss.hibernate.search.root" value="${project.thirdparty}/jboss-hibernate-search"/>
+  <property name="jboss.hibernate.search.lib" value="${jboss.hibernate.search.root}/lib"/>
+  <path id="jboss.hibernate.search.classpath">
+    <filelist dir="${jboss.hibernate.search.lib}" files="hibernate-search.jar"/>
+    <filelist dir="${jboss.hibernate.search.lib}" files="lucene-core.jar"/>
+  </path>
+
   <!-- JBoss Portal Core dependency -->
   <property name="jbportal.root" value="${project.thirdparty}/jbportal"/>
   <property name="jbportal.lib" value="${jbportal.root}/lib"/>

Modified: labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/task.properties
===================================================================
--- labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/task.properties	2008-03-11 12:21:49 UTC (rev 18822)
+++ labs/jbossforums/branches/multipleforums110P26/tools/etc/buildfragments/task.properties	2008-03-11 12:28:50 UTC (rev 18823)
@@ -21,7 +21,7 @@
 javac.target=1.2
 javac.verbose=off
 javac.depend=off
-javac.source=1.3
+javac.source=1.5
 
 javac.include.ant.runtime=no
 javac.include.java.runtime=no




More information about the jboss-svn-commits mailing list