Author: epbernard
Date: 2007-07-30 20:04:27 -0400 (Mon, 30 Jul 2007)
New Revision: 12855
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/FullTextQuery.java
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java
Log:
HSEARCH-89
Modified: trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java
===================================================================
--- trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java 2007-07-31
00:03:48 UTC (rev 12854)
+++ trunk/HibernateExt/search/src/java/org/hibernate/search/FullTextQuery.java 2007-07-31
00:04:27 UTC (rev 12855)
@@ -69,6 +69,7 @@
FullTextQuery setProjection(String... fields);
/**
+ * Will be removed in the near future
* @deprecated Use #setProjection
*
*/
Modified: trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/FullTextQuery.java
===================================================================
---
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/FullTextQuery.java 2007-07-31
00:03:48 UTC (rev 12854)
+++
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/FullTextQuery.java 2007-07-31
00:04:27 UTC (rev 12855)
@@ -4,8 +4,10 @@
import javax.persistence.Query;
import org.apache.lucene.search.Sort;
+import org.apache.lucene.search.Filter;
import org.hibernate.Criteria;
import org.hibernate.search.ProjectionConstants;
+import org.hibernate.search.FullTextFilter;
/**
* The base interface for lucene powered searches.
@@ -29,6 +31,15 @@
FullTextQuery setSort(Sort sort);
/**
+ * Allows to use lucene filters.
+ * Semi-deprecated? a preferred way is to use the @FullTextFilterDef approach
+ *
+ * @param filter The lucene filter.
+ * @return this for method chaining
+ */
+ FullTextQuery setFilter(Filter filter);
+
+ /**
* Returns the number of hits for this search
*
* Caution:
@@ -60,4 +71,14 @@
*
*/
FullTextQuery setProjection(String... fields);
+
+ /**
+ * Enable a given filter by its name. Returns a FullTextFilter object that allows filter
parameter injection
+ */
+ FullTextFilter enableFullTextFilter(String name);
+
+ /**
+ * Disable a given filter by its name
+ */
+ void disableFullTextFilter(String name);
}
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java
===================================================================
---
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java 2007-07-31
00:03:48 UTC (rev 12854)
+++
trunk/HibernateExt/search/src/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java 2007-07-31
00:04:27 UTC (rev 12855)
@@ -19,6 +19,7 @@
import org.hibernate.search.jpa.FullTextQuery;
import org.hibernate.search.SearchException;
+import org.hibernate.search.FullTextFilter;
import org.hibernate.Criteria;
import org.hibernate.TypeMismatchException;
import org.hibernate.HibernateException;
@@ -33,6 +34,7 @@
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.hql.QueryExecutionRequestException;
import org.apache.lucene.search.Sort;
+import org.apache.lucene.search.Filter;
/**
* @author Emmanuel Bernard
@@ -51,6 +53,11 @@
return this;
}
+ public FullTextQuery setFilter(Filter filter) {
+ query.setFilter( filter );
+ return this;
+ }
+
public int getResultSize() {
return query.getResultSize();
}
@@ -65,6 +72,14 @@
return this;
}
+ public FullTextFilter enableFullTextFilter(String name) {
+ return query.enableFullTextFilter( name );
+ }
+
+ public void disableFullTextFilter(String name) {
+ query.disableFullTextFilter( name );
+ }
+
public List getResultList() {
try {
return query.list();
Show replies by date