[hibernate-commits] Hibernate SVN: r20826 - in search/trunk/hibernate-search/src/main/java/org/hibernate/search: engine and 1 other directory.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Wed Oct 13 10:31:48 EDT 2010
Author: epbernard
Date: 2010-10-13 10:31:48 -0400 (Wed, 13 Oct 2010)
New Revision: 20826
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/FieldBridge.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/LuceneOptions.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LuceneOptionsImpl.java
Log:
\HSEARCH-572 Do not deprecate LuceneOptions.get*()
After consideration, no longer deprecate getStore, getIndex etc
but heavily recommend the use of #addFieldToDocument in lieue of these.
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/FieldBridge.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/FieldBridge.java 2010-10-13 13:35:28 UTC (rev 20825)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/FieldBridge.java 2010-10-13 14:31:48 UTC (rev 20826)
@@ -42,6 +42,11 @@
* A common implementation is to add a Field with the given {@code name} to {@code document} following
* the parameters {@code luceneOptions} if the {@code value} is not {@code null}.
*
+ * {code}
+ * String fieldValue = convertToString(value);
+ * luceneOptions.addFieldToDocument(name, fieldValue, document);
+ * {code}
+ *
* @param name The field to add to the Lucene document
* @param value The actual value to index
* @param document The Lucene document into which we want to index the value.
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/LuceneOptions.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/LuceneOptions.java 2010-10-13 13:35:28 UTC (rev 20825)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/bridge/LuceneOptions.java 2010-10-13 14:31:48 UTC (rev 20826)
@@ -27,8 +27,17 @@
import org.apache.lucene.document.Field;
/**
+ * A helper class for building Field objects and associating them to Documents.
* A wrapper class for Lucene parameters needed for indexing.
*
+ * The recommended approach to index is to use {@link #addFieldToDocument(String, String, org.apache.lucene.document.Document)}
+ * as all the options delcared by the user are transparently carried over. Compression is also provided transparently.
+
+ * {code}
+ * String fieldValue = convertToString(value);
+ * luceneOptions.addFieldToDocument(name, fieldValue, document);
+ * {code}
+ *
* @author Emmanuel Bernard
* @author Sanne Grinovero
* @author Hardy Ferentschik
@@ -38,7 +47,14 @@
/**
* Add a new field with the name {@code fieldName} to the Lucene Document {@code document} using the value
* {@code indexedString}.
+ * If the indexedString is null then the field is not added to the document.
*
+ * The field options are following the user declaration:
+ * - stored or not
+ * - compressed or not
+ * - what type of indexing strategy
+ * - what type of term vector strategy
+ *
* @param fieldName The field name
* @param indexedString The value to index
* @param document the document to which to add the the new field
@@ -46,33 +62,56 @@
void addFieldToDocument(String fieldName, String indexedString, Document document);
/**
- * @return {@code true} if the field value is compressed, {@code false} otherwise.
+ * Prefer the use of {@link #addFieldToDocument(String, String, org.apache.lucene.document.Document)}
+ * over manually building your Field objects and adding them to the Document.
+ *
+ * To use compression either use #addFieldToDocument or refer
+ * to Lucene documentation to implement your own compression
+ * strategy.
+ *
+ * @return the compression strategy declared by the user {@code true} if the field value is compressed, {@code false} otherwise.
*/
boolean isCompressed();
/**
- * Might be removed in version 3.3 to better support Lucene 3
- * which is missing COMPRESS Store Type.
+ * Prefer the use of {@link #addFieldToDocument(String, String, org.apache.lucene.document.Document)}
+ * over manually building your Field objects and adding them to the Document.
+ *
+ * Return the storage strategy declared by the user
+ * {@code org.apache.lucene.document.Field.Store.YES} if the field is stored
+ * {@code org.apache.lucene.document.Field.Store.NO} otherwise.
+ *
+ * To determine if the field must be compressed, use {@link #isCompressed()}.
+ *
+ * Starting from version 3.3, Store.COMPRESS is no longer returned, use {@link #isCompressed()}
+ *
* To use compression either use #addFieldToDocument or refer
* to Lucene documentation to implement your own compression
* strategy.
- *
- * @deprecated use addToDocument to add fields to the Document if possible
*/
Field.Store getStore();
/**
- * @deprecated likely to be removed in version 3.3, use #addFieldToDocument
+ * Prefer the use of {@link #addFieldToDocument(String, String, org.apache.lucene.document.Document)}
+ * over manually building your Field objects and adding them to the Document.
+ *
+ * Return the indexing strategy declared by the user
*/
Field.Index getIndex();
/**
- * @deprecated likely to be removed in version 3.3, use #addFieldToDocument
+ * Prefer the use of {@link #addFieldToDocument(String, String, org.apache.lucene.document.Document)}
+ * over manually building your Field objects and adding them to the Document.
+ *
+ * Return the term vector strategy declared by the user
*/
Field.TermVector getTermVector();
/**
- * @deprecated likely to be removed in version 3.3, use #addFieldToDocument
+ * Prefer the use of {@link #addFieldToDocument(String, String, org.apache.lucene.document.Document)}
+ * over manually building your Field objects and adding them to the Document.
+ *
+ * Return the boost factor declared by the user
*/
Float getBoost();
}
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LuceneOptionsImpl.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LuceneOptionsImpl.java 2010-10-13 13:35:28 UTC (rev 20825)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LuceneOptionsImpl.java 2010-10-13 14:31:48 UTC (rev 20826)
@@ -103,9 +103,6 @@
return this.indexMode;
}
- /**
- * @deprecated likely to be removed in 3.3
- */
public org.apache.lucene.document.Field.Store getStore() {
if ( storeUncompressed || storeCompressed ) {
return org.apache.lucene.document.Field.Store.YES;
More information about the hibernate-commits
mailing list