knguyen 2004/10/01 18:00:29 CEST
Modified files: (Branch: JAHIA-4-0-BRANCH)
src/java/org/jahia/services/fields ContentField.java
Log:
- re-index Active value only at activation, else just re-index Staging value for
other update operations
Revision Changes Path
1.113.2.8 +23 -10 jahia/src/java/org/jahia/services/fields/ContentField.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/fields/ContentField.java.diff?r1=1.113.2.7&r2=1.113.2.8&f=h
Index: ContentField.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/services/fields/Attic/ContentField.java,v
retrieving revision 1.113.2.7
retrieving revision 1.113.2.8
diff -u -r1.113.2.7 -r1.113.2.8
--- ContentField.java 23 Sep 2004 16:31:23 -0000 1.113.2.7
+++ ContentField.java 1 Oct 2004 16:00:28 -0000 1.113.2.8
@@ -611,7 +611,8 @@
if (!this.willBeCompletelyDeleted (null, null)) {
/** Update search engine */
ServicesRegistry.getInstance ()
- .getJahiaSearchService ().indexField (this.getID (), jParams);
+ .getJahiaSearchService ().indexField (this.getID (), false,
+ jParams);
}
if (stateModified) {
@@ -764,8 +765,8 @@
.getJahiaSearchService ().removeFieldFromSearchEngine (this);
// update the search index
- ServicesRegistry.getInstance ().getJahiaSearchService ()
- .indexField(this.getID(),Jahia.getThreadParamBean());
+ ServicesRegistry.getInstance().getJahiaSearchService()
+ .indexField(this.getID(),true,Jahia.getThreadParamBean());
}
/**
@@ -1264,6 +1265,23 @@
}
/**
+ * Returns true if the field has staging entry of given language.
+ *
+ * @return true if the field has staging entry of given language.
+ */
+ public boolean hasStagingEntryIgnoreCase (String languageCode) {
+ for (int i = 0; i < activeAndStagingEntryStates.size (); i++) {
+ ContentObjectEntryState thisEntryState = (ContentObjectEntryState)
activeAndStagingEntryStates.get (
+ i);
+ if (thisEntryState.isStaging () && thisEntryState.getLanguageCode
().equalsIgnoreCase(
+ languageCode)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Returns the workflow state of all the languages contained in this field.
* This returns the state of both the active and staged languages, the
* staging version taking priority over the active for a given language.
@@ -1688,13 +1706,8 @@
if (result.getStatus() !=
RestoreVersionTestResults.FAILED_OPERATION_STATUS ){
try {
- /** Remove field from search engine */
- ServicesRegistry.getInstance ()
- .getJahiaSearchService ().removeFieldFromSearchEngine (this);
- if ( !this.isMarkedForDelete() && this.hasStagingEntries() ){
- ServicesRegistry.getInstance().getJahiaSearchService()
- .indexField(this.getID(),Jahia.getThreadParamBean());
- }
+ ServicesRegistry.getInstance().getJahiaSearchService()
+ .indexField(this.getID(),true,Jahia.getThreadParamBean());
} catch ( Throwable t ){
logger.debug("Error re-indexing the field " + this.getID()
+ " after restore version operation.",t);