public function onAfterWrite() {
		if (!self::$indexing) return;

		// No longer doing the 'ischanged' check to avoid problems with multivalue field NOT being indexed
		//$changes = $this->owner->getChangedFields(true, 2);
			
		$stage = null;
		// if it's being written and a versionable, then save only in the draft
		// repository. 
		if ($this->owner->hasMethod('canBeVersioned') && $this->owner->canBeVersioned($this->owner->baseTable())) {
            $stage = Versioned::current_stage();
		}

		if ($this->canShowInSearch()) {
            // DataObject::write() does _not_ set LastEdited until _after_ onAfterWrite completes
            $this->owner->LastEdited = date('Y-m-d H:i:s');
			$this->reindex($stage);
		}
	}
public function onAfterWrite() {
		if (!self::$indexing) return;

		// No longer doing the 'ischanged' check to avoid problems with multivalue field NOT being indexed
		//$changes = $this->owner->getChangedFields(true, 2);
			
		$stage = null;
		// if it's being written and a versionable, then save only in the draft
		// repository. 
		if ($this->owner->hasMethod('canBeVersioned') && $this->owner->canBeVersioned($this->owner->baseTable())) {
            $stage = Versioned::current_stage();
		}

		if ($this->canShowInSearch()) {
            // DataObject::write() does _not_ set LastEdited until _after_ onAfterWrite completes
            $this->owner->LastEdited = date('Y-m-d H:i:s');
			$this->reindex($stage);
		}
	}
public function onAfterWrite ( ) { if ( ! self :: $ indexing ) return ; // No longer doing the 'ischanged' check to avoid problems with multivalue field NOT being indexed //$changes = $this->owner->getChangedFields(true, 2); $ stage = null ; // if it's being written and a versionable, then save only in the draft // repository.  if ( $ this -> owner -> hasMethod ( 'canBeVersioned' ) && $ this -> owner -> canBeVersioned ( $ this -> owner -> baseTable ( ) ) ) { $ stage = Versioned :: current_stage ( ) ; } if ( $ this -> canShowInSearch ( ) ) { // DataObject::write() does _not_ set LastEdited until _after_ onAfterWrite completes $ this -> owner -> LastEdited = date ( 'Y-m-d H:i:s' ) ; $ this -> reindex ( $ stage ) ; } }
Index after every write; this lets us search on Draft data as well as live data
Index after every write ; this lets us search on Draft data as well as live data