diff --git a/portal-impl/src/com/liferay/portlet/wiki/util/WikiPageIndexer.java b/portal-impl/src/com/liferay/portlet/wiki/util/WikiPageIndexer.java
index 6171dd176a4d50c106949a03590ba150fff2f3e4..804d2ad267d9edee4d04e4d83a633c3f99f35f8b 100644
--- a/portal-impl/src/com/liferay/portlet/wiki/util/WikiPageIndexer.java
+++ b/portal-impl/src/com/liferay/portlet/wiki/util/WikiPageIndexer.java
@@ -18,9 +18,11 @@ import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
 import com.liferay.portal.kernel.dao.orm.Property;
 import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
-import com.liferay.portal.kernel.dao.orm.QueryUtil;
 import com.liferay.portal.kernel.exception.PortalException;
 import com.liferay.portal.kernel.exception.SystemException;
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
+import com.liferay.portal.kernel.repository.model.FileEntry;
 import com.liferay.portal.kernel.search.BaseIndexer;
 import com.liferay.portal.kernel.search.BooleanClauseOccur;
 import com.liferay.portal.kernel.search.BooleanQuery;
@@ -28,7 +30,8 @@ import com.liferay.portal.kernel.search.BooleanQueryFactoryUtil;
 import com.liferay.portal.kernel.search.Document;
 import com.liferay.portal.kernel.search.DocumentImpl;
 import com.liferay.portal.kernel.search.Field;
-import com.liferay.portal.kernel.search.Hits;
+import com.liferay.portal.kernel.search.Indexer;
+import com.liferay.portal.kernel.search.IndexerRegistryUtil;
 import com.liferay.portal.kernel.search.SearchContext;
 import com.liferay.portal.kernel.search.SearchEngineUtil;
 import com.liferay.portal.kernel.search.Summary;
@@ -42,6 +45,7 @@ import com.liferay.portal.util.PortalUtil;
 import com.liferay.portal.util.PortletKeys;
 import com.liferay.portlet.documentlibrary.model.DLFileEntry;
 import com.liferay.portlet.messageboards.model.MBMessage;
+import com.liferay.portlet.trash.util.TrashUtil;
 import com.liferay.portlet.wiki.model.WikiNode;
 import com.liferay.portlet.wiki.model.WikiPage;
 import com.liferay.portlet.wiki.service.WikiNodeServiceUtil;
@@ -77,21 +81,26 @@ public class WikiPageIndexer extends BaseIndexer {
 
 		WikiPage page = null;
 
-		if (obj instanceof DLFileEntry) {
-			DLFileEntry dlFileEntry = (DLFileEntry)obj;
+		try {
+			if (obj instanceof DLFileEntry) {
+				DLFileEntry dlFileEntry = (DLFileEntry)obj;
 
-			page = WikiPageAttachmentsUtil.getPage(
-				dlFileEntry.getFileEntryId());
+				page = WikiPageAttachmentsUtil.getPage(
+					dlFileEntry.getFileEntryId());
 
-			document.addKeyword(
-				Field.CLASS_NAME_ID,
-				PortalUtil.getClassNameId(WikiPage.class.getName()));
-			document.addKeyword(Field.CLASS_PK, page.getResourcePrimKey());
-		}
-		else if (obj instanceof MBMessage) {
-			MBMessage message = (MBMessage)obj;
+				document.addKeyword(
+					Field.CLASS_NAME_ID,
+					PortalUtil.getClassNameId(WikiPage.class.getName()));
+				document.addKeyword(Field.CLASS_PK, page.getResourcePrimKey());
+			}
+			else if (obj instanceof MBMessage) {
+				MBMessage message = (MBMessage)obj;
 
-			page = WikiPageLocalServiceUtil.getPage(message.getClassPK());
+				page = WikiPageLocalServiceUtil.getPage(message.getClassPK());
+			}
+		}
+		catch (Exception e) {
+			return;
 		}
 
 		document.addKeyword(Field.NODE_ID, page.getNodeId());
@@ -120,6 +129,13 @@ public class WikiPageIndexer extends BaseIndexer {
 			permissionChecker, page, ActionKeys.VIEW);
 	}
 
+	@Override
+	public boolean isVisible(long classPK, int status) throws Exception {
+		WikiPage page = WikiPageLocalServiceUtil.getPage(classPK);
+
+		return isVisible(page.getStatus(), status);
+	}
+
 	@Override
 	public void postProcessContextQuery(
 			BooleanQuery contextQuery, SearchContext searchContext)
@@ -138,6 +154,10 @@ public class WikiPageIndexer extends BaseIndexer {
 					WikiNodeServiceUtil.getNode(nodeId);
 				}
 				catch (Exception e) {
+					if (_log.isDebugEnabled()) {
+						_log.debug("Unable to get wiki node " + nodeId, e);
+					}
+
 					continue;
 				}
 
@@ -168,38 +188,10 @@ public class WikiPageIndexer extends BaseIndexer {
 			SearchEngineUtil.deleteDocument(
 				getSearchEngineId(), companyId, document.get(Field.UID));
 		}
-		else if (obj instanceof WikiNode) {
-			WikiNode node = (WikiNode)obj;
-
-			BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(
-				searchContext);
-
-			booleanQuery.addRequiredTerm(Field.PORTLET_ID, PORTLET_ID);
-
-			booleanQuery.addRequiredTerm("nodeId", node.getNodeId());
-
-			Hits hits = SearchEngineUtil.search(
-				getSearchEngineId(), node.getCompanyId(), booleanQuery,
-				QueryUtil.ALL_POS, QueryUtil.ALL_POS);
-
-			for (int i = 0; i < hits.getLength(); i++) {
-				Document document = hits.doc(i);
-
-				SearchEngineUtil.deleteDocument(
-					getSearchEngineId(), node.getCompanyId(),
-					document.get(Field.UID));
-			}
-		}
 		else if (obj instanceof WikiPage) {
 			WikiPage page = (WikiPage)obj;
 
-			Document document = new DocumentImpl();
-
-			document.addUID(PORTLET_ID, page.getNodeId(), page.getTitle());
-
-			SearchEngineUtil.deleteDocument(
-				getSearchEngineId(), page.getCompanyId(),
-				document.get(Field.UID));
+			deleteDocument(page.getCompanyId(), page.getResourcePrimKey());
 		}
 	}
 
@@ -209,15 +201,20 @@ public class WikiPageIndexer extends BaseIndexer {
 
 		Document document = getBaseModelDocument(PORTLET_ID, page);
 
-		document.addUID(PORTLET_ID, page.getNodeId(), page.getTitle());
-
 		String content = HtmlUtil.extractText(
 			WikiUtil.convert(page, null, null, null));
 
 		document.addText(Field.CONTENT, content);
 
 		document.addKeyword(Field.NODE_ID, page.getNodeId());
-		document.addText(Field.TITLE, page.getTitle());
+
+		String title = page.getTitle();
+
+		if (page.isInTrash()) {
+			title = TrashUtil.getOriginalTitle(title);
+		}
+
+		document.addText(Field.TITLE, title);
 
 		return document;
 	}
@@ -246,7 +243,7 @@ public class WikiPageIndexer extends BaseIndexer {
 	protected void doReindex(Object obj) throws Exception {
 		WikiPage page = (WikiPage)obj;
 
-		if (!page.isApproved() && !page.isInTrash()) {
+		if (!page.isHead() || (!page.isApproved() && !page.isInTrash())) {
 			return;
 		}
 
@@ -258,11 +255,17 @@ public class WikiPageIndexer extends BaseIndexer {
 
 		SearchEngineUtil.updateDocument(
 			getSearchEngineId(), page.getCompanyId(), document);
+
+		reindexAttachments(page);
 	}
 
 	@Override
 	protected void doReindex(String className, long classPK) throws Exception {
-		WikiPage page = WikiPageLocalServiceUtil.getPage(classPK);
+		WikiPage page = WikiPageLocalServiceUtil.fetchWikiPage(classPK);
+
+		if (page == null) {
+			page = WikiPageLocalServiceUtil.getPage(classPK, (Boolean)null);
+		}
 
 		doReindex(page);
 	}
@@ -279,6 +282,19 @@ public class WikiPageIndexer extends BaseIndexer {
 		return PORTLET_ID;
 	}
 
+	protected void reindexAttachments(WikiPage page)
+		throws PortalException, SystemException {
+
+		Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(
+			DLFileEntry.class);
+
+		for (FileEntry attachmentsFileEntry :
+				page.getAttachmentsFileEntries()) {
+
+			indexer.reindex((DLFileEntry)attachmentsFileEntry.getModel());
+		}
+	}
+
 	protected void reindexNodes(final long companyId)
 		throws PortalException, SystemException {
 
@@ -319,12 +335,21 @@ public class WikiPageIndexer extends BaseIndexer {
 			}
 
 			@Override
-			protected void performAction(Object object) throws PortalException {
+			protected void performAction(Object object) {
 				WikiPage page = (WikiPage)object;
 
-				Document document = getDocument(page);
+				try {
+					Document document = getDocument(page);
 
-				addDocument(document);
+					addDocument(document);
+				}
+				catch (PortalException pe) {
+					if (_log.isWarnEnabled()) {
+						_log.warn(
+							"Unable to index wiki page " + page.getPageId(),
+							pe);
+					}
+				}
 			}
 
 		};
@@ -336,4 +361,6 @@ public class WikiPageIndexer extends BaseIndexer {
 		actionableDynamicQuery.performActions();
 	}
 
+	private static Log _log = LogFactoryUtil.getLog(WikiPageIndexer.class);
+
 }
\ No newline at end of file
