diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -482,6 +482,7 @@ 'DifferentialRevisionDependsOnRevisionEdgeType' => 'applications/differential/edge/DifferentialRevisionDependsOnRevisionEdgeType.php', 'DifferentialRevisionDetailView' => 'applications/differential/view/DifferentialRevisionDetailView.php', 'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php', + 'DifferentialRevisionFulltextEngine' => 'applications/differential/search/DifferentialRevisionFulltextEngine.php', 'DifferentialRevisionHasCommitEdgeType' => 'applications/differential/edge/DifferentialRevisionHasCommitEdgeType.php', 'DifferentialRevisionHasReviewerEdgeType' => 'applications/differential/edge/DifferentialRevisionHasReviewerEdgeType.php', 'DifferentialRevisionHasTaskEdgeType' => 'applications/differential/edge/DifferentialRevisionHasTaskEdgeType.php', @@ -507,7 +508,6 @@ 'DifferentialRevisionUpdateHistoryView' => 'applications/differential/view/DifferentialRevisionUpdateHistoryView.php', 'DifferentialRevisionViewController' => 'applications/differential/controller/DifferentialRevisionViewController.php', 'DifferentialSchemaSpec' => 'applications/differential/storage/DifferentialSchemaSpec.php', - 'DifferentialSearchIndexer' => 'applications/differential/search/DifferentialSearchIndexer.php', 'DifferentialSetDiffPropertyConduitAPIMethod' => 'applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php', 'DifferentialStoredCustomField' => 'applications/differential/customfield/DifferentialStoredCustomField.php', 'DifferentialSubscribersField' => 'applications/differential/customfield/DifferentialSubscribersField.php', @@ -556,6 +556,7 @@ 'DiffusionCommitDiffContentRemovedHeraldField' => 'applications/diffusion/herald/DiffusionCommitDiffContentRemovedHeraldField.php', 'DiffusionCommitDiffEnormousHeraldField' => 'applications/diffusion/herald/DiffusionCommitDiffEnormousHeraldField.php', 'DiffusionCommitEditController' => 'applications/diffusion/controller/DiffusionCommitEditController.php', + 'DiffusionCommitFulltextEngine' => 'applications/repository/search/DiffusionCommitFulltextEngine.php', 'DiffusionCommitHasRevisionEdgeType' => 'applications/diffusion/edge/DiffusionCommitHasRevisionEdgeType.php', 'DiffusionCommitHasTaskEdgeType' => 'applications/diffusion/edge/DiffusionCommitHasTaskEdgeType.php', 'DiffusionCommitHash' => 'applications/diffusion/data/DiffusionCommitHash.php', @@ -770,7 +771,6 @@ 'DivinerAtomQuery' => 'applications/diviner/query/DivinerAtomQuery.php', 'DivinerAtomRef' => 'applications/diviner/atom/DivinerAtomRef.php', 'DivinerAtomSearchEngine' => 'applications/diviner/query/DivinerAtomSearchEngine.php', - 'DivinerAtomSearchIndexer' => 'applications/diviner/search/DivinerAtomSearchIndexer.php', 'DivinerAtomizeWorkflow' => 'applications/diviner/workflow/DivinerAtomizeWorkflow.php', 'DivinerAtomizer' => 'applications/diviner/atomizer/DivinerAtomizer.php', 'DivinerBookController' => 'applications/diviner/controller/DivinerBookController.php', @@ -779,7 +779,6 @@ 'DivinerBookItemView' => 'applications/diviner/view/DivinerBookItemView.php', 'DivinerBookPHIDType' => 'applications/diviner/phid/DivinerBookPHIDType.php', 'DivinerBookQuery' => 'applications/diviner/query/DivinerBookQuery.php', - 'DivinerBookSearchIndexer' => 'applications/diviner/search/DivinerBookSearchIndexer.php', 'DivinerController' => 'applications/diviner/controller/DivinerController.php', 'DivinerDAO' => 'applications/diviner/storage/DivinerDAO.php', 'DivinerDefaultEditCapability' => 'applications/diviner/capability/DivinerDefaultEditCapability.php', @@ -792,10 +791,12 @@ 'DivinerLiveAtom' => 'applications/diviner/storage/DivinerLiveAtom.php', 'DivinerLiveBook' => 'applications/diviner/storage/DivinerLiveBook.php', 'DivinerLiveBookEditor' => 'applications/diviner/editor/DivinerLiveBookEditor.php', + 'DivinerLiveBookFulltextEngine' => 'applications/diviner/search/DivinerLiveBookFulltextEngine.php', 'DivinerLiveBookTransaction' => 'applications/diviner/storage/DivinerLiveBookTransaction.php', 'DivinerLiveBookTransactionQuery' => 'applications/diviner/query/DivinerLiveBookTransactionQuery.php', 'DivinerLivePublisher' => 'applications/diviner/publisher/DivinerLivePublisher.php', 'DivinerLiveSymbol' => 'applications/diviner/storage/DivinerLiveSymbol.php', + 'DivinerLiveSymbolFulltextEngine' => 'applications/diviner/search/DivinerLiveSymbolFulltextEngine.php', 'DivinerMainController' => 'applications/diviner/controller/DivinerMainController.php', 'DivinerPHPAtomizer' => 'applications/diviner/atomizer/DivinerPHPAtomizer.php', 'DivinerParameterTableView' => 'applications/diviner/view/DivinerParameterTableView.php', @@ -986,7 +987,7 @@ 'FundInitiativeCloseController' => 'applications/fund/controller/FundInitiativeCloseController.php', 'FundInitiativeEditController' => 'applications/fund/controller/FundInitiativeEditController.php', 'FundInitiativeEditor' => 'applications/fund/editor/FundInitiativeEditor.php', - 'FundInitiativeIndexer' => 'applications/fund/search/FundInitiativeIndexer.php', + 'FundInitiativeFulltextEngine' => 'applications/fund/search/FundInitiativeFulltextEngine.php', 'FundInitiativeListController' => 'applications/fund/controller/FundInitiativeListController.php', 'FundInitiativePHIDType' => 'applications/fund/phid/FundInitiativePHIDType.php', 'FundInitiativeQuery' => 'applications/fund/query/FundInitiativeQuery.php', @@ -1304,7 +1305,6 @@ 'ManiphestReportController' => 'applications/maniphest/controller/ManiphestReportController.php', 'ManiphestSchemaSpec' => 'applications/maniphest/storage/ManiphestSchemaSpec.php', 'ManiphestSearchConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestSearchConduitAPIMethod.php', - 'ManiphestSearchIndexer' => 'applications/maniphest/search/ManiphestSearchIndexer.php', 'ManiphestStatusConfigOptionType' => 'applications/maniphest/config/ManiphestStatusConfigOptionType.php', 'ManiphestStatusEmailCommand' => 'applications/maniphest/command/ManiphestStatusEmailCommand.php', 'ManiphestSubpriorityController' => 'applications/maniphest/controller/ManiphestSubpriorityController.php', @@ -1322,6 +1322,7 @@ 'ManiphestTaskDetailController' => 'applications/maniphest/controller/ManiphestTaskDetailController.php', 'ManiphestTaskEditBulkJobType' => 'applications/maniphest/bulk/ManiphestTaskEditBulkJobType.php', 'ManiphestTaskEditController' => 'applications/maniphest/controller/ManiphestTaskEditController.php', + 'ManiphestTaskFulltextEngine' => 'applications/maniphest/search/ManiphestTaskFulltextEngine.php', 'ManiphestTaskHasCommitEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasCommitEdgeType.php', 'ManiphestTaskHasMockEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasMockEdgeType.php', 'ManiphestTaskHasRevisionEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasRevisionEdgeType.php', @@ -1536,6 +1537,7 @@ 'PassphraseCredentialCreateController' => 'applications/passphrase/controller/PassphraseCredentialCreateController.php', 'PassphraseCredentialDestroyController' => 'applications/passphrase/controller/PassphraseCredentialDestroyController.php', 'PassphraseCredentialEditController' => 'applications/passphrase/controller/PassphraseCredentialEditController.php', + 'PassphraseCredentialFulltextEngine' => 'applications/passphrase/search/PassphraseCredentialFulltextEngine.php', 'PassphraseCredentialListController' => 'applications/passphrase/controller/PassphraseCredentialListController.php', 'PassphraseCredentialLockController' => 'applications/passphrase/controller/PassphraseCredentialLockController.php', 'PassphraseCredentialPHIDType' => 'applications/passphrase/phid/PassphraseCredentialPHIDType.php', @@ -1563,7 +1565,6 @@ 'PassphraseSSHPrivateKeyFileCredentialType' => 'applications/passphrase/credentialtype/PassphraseSSHPrivateKeyFileCredentialType.php', 'PassphraseSSHPrivateKeyTextCredentialType' => 'applications/passphrase/credentialtype/PassphraseSSHPrivateKeyTextCredentialType.php', 'PassphraseSchemaSpec' => 'applications/passphrase/storage/PassphraseSchemaSpec.php', - 'PassphraseSearchIndexer' => 'applications/passphrase/search/PassphraseSearchIndexer.php', 'PassphraseSecret' => 'applications/passphrase/storage/PassphraseSecret.php', 'PasteConduitAPIMethod' => 'applications/paste/conduit/PasteConduitAPIMethod.php', 'PasteCreateConduitAPIMethod' => 'applications/paste/conduit/PasteCreateConduitAPIMethod.php', @@ -1840,6 +1841,7 @@ 'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php', 'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php', 'PhabricatorCalendarEventEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventEmailCommand.php', + 'PhabricatorCalendarEventFulltextEngine' => 'applications/calendar/search/PhabricatorCalendarEventFulltextEngine.php', 'PhabricatorCalendarEventInvitee' => 'applications/calendar/storage/PhabricatorCalendarEventInvitee.php', 'PhabricatorCalendarEventInviteeQuery' => 'applications/calendar/query/PhabricatorCalendarEventInviteeQuery.php', 'PhabricatorCalendarEventJoinController' => 'applications/calendar/controller/PhabricatorCalendarEventJoinController.php', @@ -1849,7 +1851,6 @@ 'PhabricatorCalendarEventQuery' => 'applications/calendar/query/PhabricatorCalendarEventQuery.php', 'PhabricatorCalendarEventRSVPEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventRSVPEmailCommand.php', 'PhabricatorCalendarEventSearchEngine' => 'applications/calendar/query/PhabricatorCalendarEventSearchEngine.php', - 'PhabricatorCalendarEventSearchIndexer' => 'applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php', 'PhabricatorCalendarEventTransaction' => 'applications/calendar/storage/PhabricatorCalendarEventTransaction.php', 'PhabricatorCalendarEventTransactionComment' => 'applications/calendar/storage/PhabricatorCalendarEventTransactionComment.php', 'PhabricatorCalendarEventTransactionQuery' => 'applications/calendar/query/PhabricatorCalendarEventTransactionQuery.php', @@ -2326,8 +2327,11 @@ 'PhabricatorFlaggableInterface' => 'applications/flag/interface/PhabricatorFlaggableInterface.php', 'PhabricatorFlagsApplication' => 'applications/flag/application/PhabricatorFlagsApplication.php', 'PhabricatorFlagsUIEventListener' => 'applications/flag/events/PhabricatorFlagsUIEventListener.php', + 'PhabricatorFulltextEngine' => 'applications/search/index/PhabricatorFulltextEngine.php', 'PhabricatorFulltextEngineExtension' => 'applications/search/index/PhabricatorFulltextEngineExtension.php', 'PhabricatorFulltextEngineExtensionModule' => 'applications/search/index/PhabricatorFulltextEngineExtensionModule.php', + 'PhabricatorFulltextIndexEngineExtension' => 'applications/search/engineextension/PhabricatorFulltextIndexEngineExtension.php', + 'PhabricatorFulltextInterface' => 'applications/search/interface/PhabricatorFulltextInterface.php', 'PhabricatorFundApplication' => 'applications/fund/application/PhabricatorFundApplication.php', 'PhabricatorGDSetupCheck' => 'applications/config/check/PhabricatorGDSetupCheck.php', 'PhabricatorGarbageCollector' => 'infrastructure/daemon/garbagecollector/PhabricatorGarbageCollector.php', @@ -2406,6 +2410,7 @@ 'PhabricatorLipsumManagementWorkflow' => 'applications/lipsum/management/PhabricatorLipsumManagementWorkflow.php', 'PhabricatorLipsumMondrianArtist' => 'applications/lipsum/image/PhabricatorLipsumMondrianArtist.php', 'PhabricatorLiskDAO' => 'infrastructure/storage/lisk/PhabricatorLiskDAO.php', + 'PhabricatorLiskFulltextEngineExtension' => 'applications/search/engineextension/PhabricatorLiskFulltextEngineExtension.php', 'PhabricatorLiskSearchEngineExtension' => 'applications/search/engineextension/PhabricatorLiskSearchEngineExtension.php', 'PhabricatorLiskSerializer' => 'infrastructure/storage/lisk/PhabricatorLiskSerializer.php', 'PhabricatorListFilterUIExample' => 'applications/uiexample/examples/PhabricatorListFilterUIExample.php', @@ -2830,6 +2835,7 @@ 'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php', 'PhabricatorProjectEditorTestCase' => 'applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php', 'PhabricatorProjectFeedController' => 'applications/project/controller/PhabricatorProjectFeedController.php', + 'PhabricatorProjectFulltextEngine' => 'applications/project/search/PhabricatorProjectFulltextEngine.php', 'PhabricatorProjectHeraldAction' => 'applications/project/herald/PhabricatorProjectHeraldAction.php', 'PhabricatorProjectIconSet' => 'applications/project/icon/PhabricatorProjectIconSet.php', 'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php', @@ -2858,7 +2864,6 @@ 'PhabricatorProjectSchemaSpec' => 'applications/project/storage/PhabricatorProjectSchemaSpec.php', 'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php', 'PhabricatorProjectSearchField' => 'applications/project/searchfield/PhabricatorProjectSearchField.php', - 'PhabricatorProjectSearchIndexer' => 'applications/project/search/PhabricatorProjectSearchIndexer.php', 'PhabricatorProjectSlug' => 'applications/project/storage/PhabricatorProjectSlug.php', 'PhabricatorProjectStandardCustomField' => 'applications/project/customfield/PhabricatorProjectStandardCustomField.php', 'PhabricatorProjectStatus' => 'applications/project/constants/PhabricatorProjectStatus.php', @@ -2912,7 +2917,6 @@ 'PhabricatorRepositoryCommitPHIDType' => 'applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php', 'PhabricatorRepositoryCommitParserWorker' => 'applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php', 'PhabricatorRepositoryCommitRef' => 'applications/repository/engine/PhabricatorRepositoryCommitRef.php', - 'PhabricatorRepositoryCommitSearchIndexer' => 'applications/repository/search/PhabricatorRepositoryCommitSearchIndexer.php', 'PhabricatorRepositoryConfigOptions' => 'applications/repository/config/PhabricatorRepositoryConfigOptions.php', 'PhabricatorRepositoryDAO' => 'applications/repository/storage/PhabricatorRepositoryDAO.php', 'PhabricatorRepositoryDiscoveryEngine' => 'applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php', @@ -3024,7 +3028,6 @@ 'PhabricatorSearchDocument' => 'applications/search/storage/document/PhabricatorSearchDocument.php', 'PhabricatorSearchDocumentField' => 'applications/search/storage/document/PhabricatorSearchDocumentField.php', 'PhabricatorSearchDocumentFieldType' => 'applications/search/constants/PhabricatorSearchDocumentFieldType.php', - 'PhabricatorSearchDocumentIndexer' => 'applications/search/index/PhabricatorSearchDocumentIndexer.php', 'PhabricatorSearchDocumentQuery' => 'applications/search/query/PhabricatorSearchDocumentQuery.php', 'PhabricatorSearchDocumentRelationship' => 'applications/search/storage/document/PhabricatorSearchDocumentRelationship.php', 'PhabricatorSearchDocumentTypeDatasource' => 'applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php', @@ -3283,6 +3286,7 @@ 'PhabricatorUserEditorTestCase' => 'applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php', 'PhabricatorUserEmail' => 'applications/people/storage/PhabricatorUserEmail.php', 'PhabricatorUserEmailTestCase' => 'applications/people/storage/__tests__/PhabricatorUserEmailTestCase.php', + 'PhabricatorUserFulltextEngine' => 'applications/people/search/PhabricatorUserFulltextEngine.php', 'PhabricatorUserLog' => 'applications/people/storage/PhabricatorUserLog.php', 'PhabricatorUserLogView' => 'applications/people/view/PhabricatorUserLogView.php', 'PhabricatorUserPHIDResolver' => 'applications/phid/resolver/PhabricatorUserPHIDResolver.php', @@ -3292,7 +3296,6 @@ 'PhabricatorUserRealNameField' => 'applications/people/customfield/PhabricatorUserRealNameField.php', 'PhabricatorUserRolesField' => 'applications/people/customfield/PhabricatorUserRolesField.php', 'PhabricatorUserSchemaSpec' => 'applications/people/storage/PhabricatorUserSchemaSpec.php', - 'PhabricatorUserSearchIndexer' => 'applications/people/search/PhabricatorUserSearchIndexer.php', 'PhabricatorUserSinceField' => 'applications/people/customfield/PhabricatorUserSinceField.php', 'PhabricatorUserStatusField' => 'applications/people/customfield/PhabricatorUserStatusField.php', 'PhabricatorUserTestCase' => 'applications/people/storage/__tests__/PhabricatorUserTestCase.php', @@ -3449,6 +3452,7 @@ 'PholioMockEditController' => 'applications/pholio/controller/PholioMockEditController.php', 'PholioMockEditor' => 'applications/pholio/editor/PholioMockEditor.php', 'PholioMockEmbedView' => 'applications/pholio/view/PholioMockEmbedView.php', + 'PholioMockFulltextEngine' => 'applications/pholio/search/PholioMockFulltextEngine.php', 'PholioMockHasTaskEdgeType' => 'applications/pholio/edge/PholioMockHasTaskEdgeType.php', 'PholioMockHeraldField' => 'applications/pholio/herald/PholioMockHeraldField.php', 'PholioMockHeraldFieldGroup' => 'applications/pholio/herald/PholioMockHeraldFieldGroup.php', @@ -3464,7 +3468,6 @@ 'PholioRemarkupRule' => 'applications/pholio/remarkup/PholioRemarkupRule.php', 'PholioReplyHandler' => 'applications/pholio/mail/PholioReplyHandler.php', 'PholioSchemaSpec' => 'applications/pholio/storage/PholioSchemaSpec.php', - 'PholioSearchIndexer' => 'applications/pholio/search/PholioSearchIndexer.php', 'PholioTransaction' => 'applications/pholio/storage/PholioTransaction.php', 'PholioTransactionComment' => 'applications/pholio/storage/PholioTransactionComment.php', 'PholioTransactionQuery' => 'applications/pholio/query/PholioTransactionQuery.php', @@ -3636,6 +3639,7 @@ 'PhrictionDocumentAuthorHeraldField' => 'applications/phriction/herald/PhrictionDocumentAuthorHeraldField.php', 'PhrictionDocumentContentHeraldField' => 'applications/phriction/herald/PhrictionDocumentContentHeraldField.php', 'PhrictionDocumentController' => 'applications/phriction/controller/PhrictionDocumentController.php', + 'PhrictionDocumentFulltextEngine' => 'applications/phriction/search/PhrictionDocumentFulltextEngine.php', 'PhrictionDocumentHeraldAdapter' => 'applications/phriction/herald/PhrictionDocumentHeraldAdapter.php', 'PhrictionDocumentHeraldField' => 'applications/phriction/herald/PhrictionDocumentHeraldField.php', 'PhrictionDocumentHeraldFieldGroup' => 'applications/phriction/herald/PhrictionDocumentHeraldFieldGroup.php', @@ -3656,7 +3660,6 @@ 'PhrictionReplyHandler' => 'applications/phriction/mail/PhrictionReplyHandler.php', 'PhrictionSchemaSpec' => 'applications/phriction/storage/PhrictionSchemaSpec.php', 'PhrictionSearchEngine' => 'applications/phriction/query/PhrictionSearchEngine.php', - 'PhrictionSearchIndexer' => 'applications/phriction/search/PhrictionSearchIndexer.php', 'PhrictionTransaction' => 'applications/phriction/storage/PhrictionTransaction.php', 'PhrictionTransactionComment' => 'applications/phriction/storage/PhrictionTransactionComment.php', 'PhrictionTransactionEditor' => 'applications/phriction/editor/PhrictionTransactionEditor.php', @@ -3691,6 +3694,7 @@ 'PonderQuestionCommentController' => 'applications/ponder/controller/PonderQuestionCommentController.php', 'PonderQuestionEditController' => 'applications/ponder/controller/PonderQuestionEditController.php', 'PonderQuestionEditor' => 'applications/ponder/editor/PonderQuestionEditor.php', + 'PonderQuestionFulltextEngine' => 'applications/ponder/search/PonderQuestionFulltextEngine.php', 'PonderQuestionHistoryController' => 'applications/ponder/controller/PonderQuestionHistoryController.php', 'PonderQuestionListController' => 'applications/ponder/controller/PonderQuestionListController.php', 'PonderQuestionMailReceiver' => 'applications/ponder/mail/PonderQuestionMailReceiver.php', @@ -3706,7 +3710,6 @@ 'PonderQuestionViewController' => 'applications/ponder/controller/PonderQuestionViewController.php', 'PonderRemarkupRule' => 'applications/ponder/remarkup/PonderRemarkupRule.php', 'PonderSchemaSpec' => 'applications/ponder/storage/PonderSchemaSpec.php', - 'PonderSearchIndexer' => 'applications/ponder/search/PonderSearchIndexer.php', 'PonderVotableInterface' => 'applications/ponder/storage/PonderVotableInterface.php', 'PonderVote' => 'applications/ponder/constants/PonderVote.php', 'PonderVoteEditor' => 'applications/ponder/editor/PonderVoteEditor.php', @@ -4396,6 +4399,7 @@ 'PhabricatorMentionableInterface', 'PhabricatorDestructibleInterface', 'PhabricatorProjectInterface', + 'PhabricatorFulltextInterface', ), 'DifferentialRevisionAffectedFilesHeraldField' => 'DifferentialRevisionHeraldField', 'DifferentialRevisionAuthorHeraldField' => 'DifferentialRevisionHeraldField', @@ -4409,6 +4413,7 @@ 'DifferentialRevisionDependsOnRevisionEdgeType' => 'PhabricatorEdgeType', 'DifferentialRevisionDetailView' => 'AphrontView', 'DifferentialRevisionEditController' => 'DifferentialController', + 'DifferentialRevisionFulltextEngine' => 'PhabricatorFulltextEngine', 'DifferentialRevisionHasCommitEdgeType' => 'PhabricatorEdgeType', 'DifferentialRevisionHasReviewerEdgeType' => 'PhabricatorEdgeType', 'DifferentialRevisionHasTaskEdgeType' => 'PhabricatorEdgeType', @@ -4434,7 +4439,6 @@ 'DifferentialRevisionUpdateHistoryView' => 'AphrontView', 'DifferentialRevisionViewController' => 'DifferentialController', 'DifferentialSchemaSpec' => 'PhabricatorConfigSchemaSpec', - 'DifferentialSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'DifferentialSetDiffPropertyConduitAPIMethod' => 'DifferentialConduitAPIMethod', 'DifferentialStoredCustomField' => 'DifferentialCustomField', 'DifferentialSubscribersField' => 'DifferentialCoreCustomField', @@ -4483,6 +4487,7 @@ 'DiffusionCommitDiffContentRemovedHeraldField' => 'DiffusionCommitHeraldField', 'DiffusionCommitDiffEnormousHeraldField' => 'DiffusionCommitHeraldField', 'DiffusionCommitEditController' => 'DiffusionController', + 'DiffusionCommitFulltextEngine' => 'PhabricatorFulltextEngine', 'DiffusionCommitHasRevisionEdgeType' => 'PhabricatorEdgeType', 'DiffusionCommitHasTaskEdgeType' => 'PhabricatorEdgeType', 'DiffusionCommitHash' => 'Phobject', @@ -4697,7 +4702,6 @@ 'DivinerAtomQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'DivinerAtomRef' => 'Phobject', 'DivinerAtomSearchEngine' => 'PhabricatorApplicationSearchEngine', - 'DivinerAtomSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'DivinerAtomizeWorkflow' => 'DivinerWorkflow', 'DivinerAtomizer' => 'Phobject', 'DivinerBookController' => 'DivinerController', @@ -4706,7 +4710,6 @@ 'DivinerBookItemView' => 'AphrontTagView', 'DivinerBookPHIDType' => 'PhabricatorPHIDType', 'DivinerBookQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'DivinerBookSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'DivinerController' => 'PhabricatorController', 'DivinerDAO' => 'PhabricatorLiskDAO', 'DivinerDefaultEditCapability' => 'PhabricatorPolicyCapability', @@ -4723,8 +4726,10 @@ 'PhabricatorProjectInterface', 'PhabricatorDestructibleInterface', 'PhabricatorApplicationTransactionInterface', + 'PhabricatorFulltextInterface', ), 'DivinerLiveBookEditor' => 'PhabricatorApplicationTransactionEditor', + 'DivinerLiveBookFulltextEngine' => 'PhabricatorFulltextEngine', 'DivinerLiveBookTransaction' => 'PhabricatorApplicationTransaction', 'DivinerLiveBookTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'DivinerLivePublisher' => 'DivinerPublisher', @@ -4733,7 +4738,9 @@ 'PhabricatorPolicyInterface', 'PhabricatorMarkupInterface', 'PhabricatorDestructibleInterface', + 'PhabricatorFulltextInterface', ), + 'DivinerLiveSymbolFulltextEngine' => 'PhabricatorFulltextEngine', 'DivinerMainController' => 'DivinerController', 'DivinerPHPAtomizer' => 'DivinerAtomizer', 'DivinerParameterTableView' => 'AphrontTagView', @@ -4962,12 +4969,13 @@ 'PhabricatorFlaggableInterface', 'PhabricatorTokenReceiverInterface', 'PhabricatorDestructibleInterface', + 'PhabricatorFulltextInterface', ), 'FundInitiativeBackController' => 'FundController', 'FundInitiativeCloseController' => 'FundController', 'FundInitiativeEditController' => 'FundController', 'FundInitiativeEditor' => 'PhabricatorApplicationTransactionEditor', - 'FundInitiativeIndexer' => 'PhabricatorSearchDocumentIndexer', + 'FundInitiativeFulltextEngine' => 'PhabricatorFulltextEngine', 'FundInitiativeListController' => 'FundController', 'FundInitiativePHIDType' => 'PhabricatorPHIDType', 'FundInitiativeQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -5349,7 +5357,6 @@ 'ManiphestReportController' => 'ManiphestController', 'ManiphestSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'ManiphestSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', - 'ManiphestSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'ManiphestStatusConfigOptionType' => 'PhabricatorConfigJSONOptionType', 'ManiphestStatusEmailCommand' => 'ManiphestEmailCommand', 'ManiphestSubpriorityController' => 'ManiphestController', @@ -5368,6 +5375,7 @@ 'PhabricatorProjectInterface', 'PhabricatorSpacesInterface', 'PhabricatorConduitResultInterface', + 'PhabricatorFulltextInterface', ), 'ManiphestTaskAssignHeraldAction' => 'HeraldAction', 'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction', @@ -5382,6 +5390,7 @@ 'ManiphestTaskDetailController' => 'ManiphestController', 'ManiphestTaskEditBulkJobType' => 'PhabricatorWorkerBulkJobType', 'ManiphestTaskEditController' => 'ManiphestController', + 'ManiphestTaskFulltextEngine' => 'PhabricatorFulltextEngine', 'ManiphestTaskHasCommitEdgeType' => 'PhabricatorEdgeType', 'ManiphestTaskHasMockEdgeType' => 'PhabricatorEdgeType', 'ManiphestTaskHasRevisionEdgeType' => 'PhabricatorEdgeType', @@ -5613,6 +5622,7 @@ 'PhabricatorSubscribableInterface', 'PhabricatorDestructibleInterface', 'PhabricatorSpacesInterface', + 'PhabricatorFulltextInterface', ), 'PassphraseCredentialAuthorPolicyRule' => 'PhabricatorPolicyRule', 'PassphraseCredentialConduitController' => 'PassphraseController', @@ -5620,6 +5630,7 @@ 'PassphraseCredentialCreateController' => 'PassphraseController', 'PassphraseCredentialDestroyController' => 'PassphraseController', 'PassphraseCredentialEditController' => 'PassphraseController', + 'PassphraseCredentialFulltextEngine' => 'PhabricatorFulltextEngine', 'PassphraseCredentialListController' => 'PassphraseController', 'PassphraseCredentialLockController' => 'PassphraseController', 'PassphraseCredentialPHIDType' => 'PhabricatorPHIDType', @@ -5647,7 +5658,6 @@ 'PassphraseSSHPrivateKeyFileCredentialType' => 'PassphraseSSHPrivateKeyCredentialType', 'PassphraseSSHPrivateKeyTextCredentialType' => 'PassphraseSSHPrivateKeyCredentialType', 'PassphraseSchemaSpec' => 'PhabricatorConfigSchemaSpec', - 'PassphraseSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'PassphraseSecret' => 'PassphraseDAO', 'PasteConduitAPIMethod' => 'ConduitAPIMethod', 'PasteCreateConduitAPIMethod' => 'PasteConduitAPIMethod', @@ -5968,6 +5978,7 @@ 'PhabricatorMentionableInterface', 'PhabricatorFlaggableInterface', 'PhabricatorSpacesInterface', + 'PhabricatorFulltextInterface', ), 'PhabricatorCalendarEventCancelController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController', @@ -5975,6 +5986,7 @@ 'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand', + 'PhabricatorCalendarEventFulltextEngine' => 'PhabricatorFulltextEngine', 'PhabricatorCalendarEventInvitee' => array( 'PhabricatorCalendarDAO', 'PhabricatorPolicyInterface', @@ -5987,7 +5999,6 @@ 'PhabricatorCalendarEventQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorCalendarEventRSVPEmailCommand' => 'PhabricatorCalendarEventEmailCommand', 'PhabricatorCalendarEventSearchEngine' => 'PhabricatorApplicationSearchEngine', - 'PhabricatorCalendarEventSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'PhabricatorCalendarEventTransaction' => 'PhabricatorApplicationTransaction', 'PhabricatorCalendarEventTransactionComment' => 'PhabricatorApplicationTransactionComment', 'PhabricatorCalendarEventTransactionQuery' => 'PhabricatorApplicationTransactionQuery', @@ -6549,8 +6560,10 @@ 'PhabricatorFlaggableInterface' => 'PhabricatorPHIDInterface', 'PhabricatorFlagsApplication' => 'PhabricatorApplication', 'PhabricatorFlagsUIEventListener' => 'PhabricatorEventListener', + 'PhabricatorFulltextEngine' => 'Phobject', 'PhabricatorFulltextEngineExtension' => 'Phobject', 'PhabricatorFulltextEngineExtensionModule' => 'PhabricatorConfigModule', + 'PhabricatorFulltextIndexEngineExtension' => 'PhabricatorIndexEngineExtension', 'PhabricatorFundApplication' => 'PhabricatorApplication', 'PhabricatorGDSetupCheck' => 'PhabricatorSetupCheck', 'PhabricatorGarbageCollector' => 'Phobject', @@ -6634,6 +6647,7 @@ 'PhabricatorLipsumManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorLipsumMondrianArtist' => 'PhabricatorLipsumArtist', 'PhabricatorLiskDAO' => 'LiskDAO', + 'PhabricatorLiskFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension', 'PhabricatorLiskSearchEngineExtension' => 'PhabricatorSearchEngineExtension', 'PhabricatorLiskSerializer' => 'Phobject', 'PhabricatorListFilterUIExample' => 'PhabricatorUIExample', @@ -7096,6 +7110,7 @@ 'PhabricatorSubscribableInterface', 'PhabricatorCustomFieldInterface', 'PhabricatorDestructibleInterface', + 'PhabricatorFulltextInterface', ), 'PhabricatorProjectAddHeraldAction' => 'PhabricatorProjectHeraldAction', 'PhabricatorProjectApplication' => 'PhabricatorApplication', @@ -7140,6 +7155,7 @@ 'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController', 'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase', 'PhabricatorProjectFeedController' => 'PhabricatorProjectController', + 'PhabricatorProjectFulltextEngine' => 'PhabricatorFulltextEngine', 'PhabricatorProjectHeraldAction' => 'HeraldAction', 'PhabricatorProjectIconSet' => 'PhabricatorIconSet', 'PhabricatorProjectListController' => 'PhabricatorProjectController', @@ -7167,7 +7183,6 @@ 'PhabricatorProjectSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorProjectSearchField' => 'PhabricatorSearchTokenizerField', - 'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'PhabricatorProjectSlug' => 'PhabricatorProjectDAO', 'PhabricatorProjectStandardCustomField' => array( 'PhabricatorProjectCustomField', @@ -7241,6 +7256,7 @@ 'HarbormasterBuildableInterface', 'PhabricatorCustomFieldInterface', 'PhabricatorApplicationTransactionInterface', + 'PhabricatorFulltextInterface', ), 'PhabricatorRepositoryCommitChangeParserWorker' => 'PhabricatorRepositoryCommitParserWorker', 'PhabricatorRepositoryCommitData' => 'PhabricatorRepositoryDAO', @@ -7250,7 +7266,6 @@ 'PhabricatorRepositoryCommitPHIDType' => 'PhabricatorPHIDType', 'PhabricatorRepositoryCommitParserWorker' => 'PhabricatorWorker', 'PhabricatorRepositoryCommitRef' => 'Phobject', - 'PhabricatorRepositoryCommitSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'PhabricatorRepositoryConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorRepositoryDAO' => 'PhabricatorLiskDAO', 'PhabricatorRepositoryDiscoveryEngine' => 'PhabricatorRepositoryEngine', @@ -7376,7 +7391,6 @@ 'PhabricatorSearchDocument' => 'PhabricatorSearchDAO', 'PhabricatorSearchDocumentField' => 'PhabricatorSearchDAO', 'PhabricatorSearchDocumentFieldType' => 'Phobject', - 'PhabricatorSearchDocumentIndexer' => 'Phobject', 'PhabricatorSearchDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorSearchDocumentRelationship' => 'PhabricatorSearchDAO', 'PhabricatorSearchDocumentTypeDatasource' => 'PhabricatorTypeaheadDatasource', @@ -7652,6 +7666,7 @@ 'PhabricatorSSHPublicKeyInterface', 'PhabricatorFlaggableInterface', 'PhabricatorApplicationTransactionInterface', + 'PhabricatorFulltextInterface', ), 'PhabricatorUserBlurbField' => 'PhabricatorUserCustomField', 'PhabricatorUserConfigOptions' => 'PhabricatorApplicationConfigOptions', @@ -7668,6 +7683,7 @@ 'PhabricatorUserEditorTestCase' => 'PhabricatorTestCase', 'PhabricatorUserEmail' => 'PhabricatorUserDAO', 'PhabricatorUserEmailTestCase' => 'PhabricatorTestCase', + 'PhabricatorUserFulltextEngine' => 'PhabricatorFulltextEngine', 'PhabricatorUserLog' => array( 'PhabricatorUserDAO', 'PhabricatorPolicyInterface', @@ -7680,7 +7696,6 @@ 'PhabricatorUserRealNameField' => 'PhabricatorUserCustomField', 'PhabricatorUserRolesField' => 'PhabricatorUserCustomField', 'PhabricatorUserSchemaSpec' => 'PhabricatorConfigSchemaSpec', - 'PhabricatorUserSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'PhabricatorUserSinceField' => 'PhabricatorUserCustomField', 'PhabricatorUserStatusField' => 'PhabricatorUserCustomField', 'PhabricatorUserTestCase' => 'PhabricatorTestCase', @@ -7879,6 +7894,7 @@ 'PhabricatorDestructibleInterface', 'PhabricatorSpacesInterface', 'PhabricatorMentionableInterface', + 'PhabricatorFulltextInterface', ), 'PholioMockArchiveController' => 'PholioController', 'PholioMockAuthorHeraldField' => 'PholioMockHeraldField', @@ -7887,6 +7903,7 @@ 'PholioMockEditController' => 'PholioController', 'PholioMockEditor' => 'PhabricatorApplicationTransactionEditor', 'PholioMockEmbedView' => 'AphrontView', + 'PholioMockFulltextEngine' => 'PhabricatorFulltextEngine', 'PholioMockHasTaskEdgeType' => 'PhabricatorEdgeType', 'PholioMockHeraldField' => 'HeraldField', 'PholioMockHeraldFieldGroup' => 'HeraldFieldGroup', @@ -7902,7 +7919,6 @@ 'PholioRemarkupRule' => 'PhabricatorObjectRemarkupRule', 'PholioReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 'PholioSchemaSpec' => 'PhabricatorConfigSchemaSpec', - 'PholioSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'PholioTransaction' => 'PhabricatorApplicationTransaction', 'PholioTransactionComment' => 'PhabricatorApplicationTransactionComment', 'PholioTransactionQuery' => 'PhabricatorApplicationTransactionQuery', @@ -8125,10 +8141,12 @@ 'PhabricatorTokenReceiverInterface', 'PhabricatorDestructibleInterface', 'PhabricatorApplicationTransactionInterface', + 'PhabricatorFulltextInterface', ), 'PhrictionDocumentAuthorHeraldField' => 'PhrictionDocumentHeraldField', 'PhrictionDocumentContentHeraldField' => 'PhrictionDocumentHeraldField', 'PhrictionDocumentController' => 'PhrictionController', + 'PhrictionDocumentFulltextEngine' => 'PhabricatorFulltextEngine', 'PhrictionDocumentHeraldAdapter' => 'HeraldAdapter', 'PhrictionDocumentHeraldField' => 'HeraldField', 'PhrictionDocumentHeraldFieldGroup' => 'HeraldFieldGroup', @@ -8149,7 +8167,6 @@ 'PhrictionReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 'PhrictionSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhrictionSearchEngine' => 'PhabricatorApplicationSearchEngine', - 'PhrictionSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'PhrictionTransaction' => 'PhabricatorApplicationTransaction', 'PhrictionTransactionComment' => 'PhabricatorApplicationTransactionComment', 'PhrictionTransactionEditor' => 'PhabricatorApplicationTransactionEditor', @@ -8200,10 +8217,12 @@ 'PhabricatorProjectInterface', 'PhabricatorDestructibleInterface', 'PhabricatorSpacesInterface', + 'PhabricatorFulltextInterface', ), 'PonderQuestionCommentController' => 'PonderController', 'PonderQuestionEditController' => 'PonderController', 'PonderQuestionEditor' => 'PonderEditor', + 'PonderQuestionFulltextEngine' => 'PhabricatorFulltextEngine', 'PonderQuestionHistoryController' => 'PonderController', 'PonderQuestionListController' => 'PonderController', 'PonderQuestionMailReceiver' => 'PhabricatorObjectMailReceiver', @@ -8219,7 +8238,6 @@ 'PonderQuestionViewController' => 'PonderController', 'PonderRemarkupRule' => 'PhabricatorObjectRemarkupRule', 'PonderSchemaSpec' => 'PhabricatorConfigSchemaSpec', - 'PonderSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'PonderVote' => 'PonderConstants', 'PonderVoteEditor' => 'PhabricatorEditor', 'PonderVotingUserHasAnswerEdgeType' => 'PhabricatorEdgeType', diff --git a/src/applications/calendar/search/PhabricatorCalendarEventFulltextEngine.php b/src/applications/calendar/search/PhabricatorCalendarEventFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/calendar/search/PhabricatorCalendarEventFulltextEngine.php @@ -0,0 +1,39 @@ +setDocumentTitle($event->getName()); + + $document->addField( + PhabricatorSearchDocumentFieldType::FIELD_BODY, + $event->getDescription()); + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, + $event->getUserPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + $event->getDateCreated()); + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_OWNER, + $event->getUserPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + $event->getDateCreated()); + + $document->addRelationship( + $event->getIsCancelled() + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, + $event->getPHID(), + PhabricatorCalendarEventPHIDType::TYPECONST, + PhabricatorTime::getNow()); + } + +} diff --git a/src/applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php b/src/applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php deleted file mode 100644 --- a/src/applications/calendar/search/PhabricatorCalendarEventSearchIndexer.php +++ /dev/null @@ -1,47 +0,0 @@ -loadDocumentByPHID($phid); - - $doc = new PhabricatorSearchAbstractDocument(); - $doc->setPHID($event->getPHID()); - $doc->setDocumentType(PhabricatorCalendarEventPHIDType::TYPECONST); - $doc->setDocumentTitle($event->getName()); - $doc->setDocumentCreated($event->getDateCreated()); - $doc->setDocumentModified($event->getDateModified()); - - $doc->addField( - PhabricatorSearchDocumentFieldType::FIELD_BODY, - $event->getDescription()); - - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, - $event->getUserPHID(), - PhabricatorPeopleUserPHIDType::TYPECONST, - $event->getDateCreated()); - - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_OWNER, - $event->getUserPHID(), - PhabricatorPeopleUserPHIDType::TYPECONST, - $event->getDateCreated()); - - $doc->addRelationship( - $event->getIsCancelled() - ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED - : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, - $event->getPHID(), - PhabricatorCalendarEventPHIDType::TYPECONST, - time()); - - return $doc; - } - -} diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -10,7 +10,8 @@ PhabricatorDestructibleInterface, PhabricatorMentionableInterface, PhabricatorFlaggableInterface, - PhabricatorSpacesInterface { + PhabricatorSpacesInterface, + PhabricatorFulltextInterface { protected $name; protected $userPHID; @@ -562,4 +563,13 @@ public function getSpacePHID() { return $this->spacePHID; } + + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new PhabricatorCalendarEventFulltextEngine(); + } + } diff --git a/src/applications/differential/search/DifferentialRevisionFulltextEngine.php b/src/applications/differential/search/DifferentialRevisionFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/differential/search/DifferentialRevisionFulltextEngine.php @@ -0,0 +1,64 @@ +setViewer($this->getViewer()) + ->withPHIDs(array($object->getPHID())) + ->needReviewerStatus(true) + ->executeOne(); + + // TODO: This isn't very clean, but custom fields currently rely on it. + $object->attachReviewerStatus($revision->getReviewerStatus()); + + $document->setDocumentTitle($revision->getTitle()); + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, + $revision->getAuthorPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + $revision->getDateCreated()); + + $document->addRelationship( + $revision->isClosed() + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, + $revision->getPHID(), + DifferentialRevisionPHIDType::TYPECONST, + PhabricatorTime::getNow()); + + // If a revision needs review, the owners are the reviewers. Otherwise, the + // owner is the author (e.g., accepted, rejected, closed). + $status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW; + if ($revision->getStatus() == $status_review) { + $reviewers = $revision->getReviewerStatus(); + $reviewers = mpull($reviewers, 'getReviewerPHID', 'getReviewerPHID'); + if ($reviewers) { + foreach ($reviewers as $phid) { + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_OWNER, + $phid, + PhabricatorPeopleUserPHIDType::TYPECONST, + $revision->getDateModified()); // Bogus timestamp. + } + } else { + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED, + $revision->getPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + $revision->getDateModified()); // Bogus timestamp. + } + } else { + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_OWNER, + $revision->getAuthorPHID(), + PhabricatorPHIDConstants::PHID_TYPE_VOID, + $revision->getDateCreated()); + } + } +} diff --git a/src/applications/differential/search/DifferentialSearchIndexer.php b/src/applications/differential/search/DifferentialSearchIndexer.php deleted file mode 100644 --- a/src/applications/differential/search/DifferentialSearchIndexer.php +++ /dev/null @@ -1,76 +0,0 @@ -setViewer($this->getViewer()) - ->withPHIDs(array($phid)) - ->needReviewerStatus(true) - ->executeOne(); - if (!$object) { - throw new Exception(pht("Unable to load object by PHID '%s'!", $phid)); - } - return $object; - } - - protected function buildAbstractDocumentByPHID($phid) { - $rev = $this->loadDocumentByPHID($phid); - - $doc = new PhabricatorSearchAbstractDocument(); - $doc->setPHID($rev->getPHID()); - $doc->setDocumentType(DifferentialRevisionPHIDType::TYPECONST); - $doc->setDocumentTitle($rev->getTitle()); - $doc->setDocumentCreated($rev->getDateCreated()); - $doc->setDocumentModified($rev->getDateModified()); - - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, - $rev->getAuthorPHID(), - PhabricatorPeopleUserPHIDType::TYPECONST, - $rev->getDateCreated()); - - $doc->addRelationship( - $rev->isClosed() - ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED - : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, - $rev->getPHID(), - DifferentialRevisionPHIDType::TYPECONST, - time()); - - // If a revision needs review, the owners are the reviewers. Otherwise, the - // owner is the author (e.g., accepted, rejected, closed). - if ($rev->getStatus() == ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) { - $reviewers = $rev->getReviewerStatus(); - $reviewers = mpull($reviewers, 'getReviewerPHID', 'getReviewerPHID'); - if ($reviewers) { - foreach ($reviewers as $phid) { - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_OWNER, - $phid, - PhabricatorPeopleUserPHIDType::TYPECONST, - $rev->getDateModified()); // Bogus timestamp. - } - } else { - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED, - $rev->getPHID(), - PhabricatorPeopleUserPHIDType::TYPECONST, - $rev->getDateModified()); // Bogus timestamp. - } - } else { - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_OWNER, - $rev->getAuthorPHID(), - PhabricatorPHIDConstants::PHID_TYPE_VOID, - $rev->getDateCreated()); - } - - return $doc; - } -} diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -13,7 +13,8 @@ PhabricatorApplicationTransactionInterface, PhabricatorMentionableInterface, PhabricatorDestructibleInterface, - PhabricatorProjectInterface { + PhabricatorProjectInterface, + PhabricatorFulltextInterface { protected $title = ''; protected $originalTitle; @@ -629,4 +630,13 @@ $this->saveTransaction(); } + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new DifferentialRevisionFulltextEngine(); + } + + } diff --git a/src/applications/diviner/search/DivinerBookSearchIndexer.php b/src/applications/diviner/search/DivinerBookSearchIndexer.php deleted file mode 100644 --- a/src/applications/diviner/search/DivinerBookSearchIndexer.php +++ /dev/null @@ -1,31 +0,0 @@ -loadDocumentByPHID($phid); - - $doc = $this->newDocument($phid) - ->setDocumentTitle($book->getTitle()) - ->setDocumentCreated($book->getDateCreated()) - ->setDocumentModified($book->getDateModified()); - - $doc->addField( - PhabricatorSearchDocumentFieldType::FIELD_BODY, - $book->getPreface()); - - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, - $book->getRepositoryPHID(), - PhabricatorRepositoryRepositoryPHIDType::TYPECONST, - $book->getDateCreated()); - - return $doc; - } - - -} diff --git a/src/applications/diviner/search/DivinerLiveBookFulltextEngine.php b/src/applications/diviner/search/DivinerLiveBookFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/diviner/search/DivinerLiveBookFulltextEngine.php @@ -0,0 +1,26 @@ +setDocumentTitle($book->getTitle()); + + $document->addField( + PhabricatorSearchDocumentFieldType::FIELD_BODY, + $book->getPreface()); + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, + $book->getRepositoryPHID(), + PhabricatorRepositoryRepositoryPHIDType::TYPECONST, + $book->getDateCreated()); + } + + +} diff --git a/src/applications/diviner/search/DivinerAtomSearchIndexer.php b/src/applications/diviner/search/DivinerLiveSymbolFulltextEngine.php rename from src/applications/diviner/search/DivinerAtomSearchIndexer.php rename to src/applications/diviner/search/DivinerLiveSymbolFulltextEngine.php --- a/src/applications/diviner/search/DivinerAtomSearchIndexer.php +++ b/src/applications/diviner/search/DivinerLiveSymbolFulltextEngine.php @@ -1,49 +1,43 @@ loadDocumentByPHID($phid); + $atom = $object; $book = $atom->getBook(); - if (!$atom->getIsDocumentable()) { - return null; - } - - $doc = $this->newDocument($phid) + $document ->setDocumentTitle($atom->getTitle()) ->setDocumentCreated($book->getDateCreated()) ->setDocumentModified($book->getDateModified()); - $doc->addField( + $document->addField( PhabricatorSearchDocumentFieldType::FIELD_BODY, $atom->getSummary()); - $doc->addRelationship( + $document->addRelationship( PhabricatorSearchRelationship::RELATIONSHIP_BOOK, $atom->getBookPHID(), DivinerBookPHIDType::TYPECONST, PhabricatorTime::getNow()); - $doc->addRelationship( + $document->addRelationship( PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, $atom->getRepositoryPHID(), PhabricatorRepositoryRepositoryPHIDType::TYPECONST, PhabricatorTime::getNow()); - $doc->addRelationship( + $document->addRelationship( $atom->getGraphHash() ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $atom->getBookPHID(), DivinerBookPHIDType::TYPECONST, PhabricatorTime::getNow()); - - return $doc; } } diff --git a/src/applications/diviner/storage/DivinerLiveBook.php b/src/applications/diviner/storage/DivinerLiveBook.php --- a/src/applications/diviner/storage/DivinerLiveBook.php +++ b/src/applications/diviner/storage/DivinerLiveBook.php @@ -5,7 +5,8 @@ PhabricatorPolicyInterface, PhabricatorProjectInterface, PhabricatorDestructibleInterface, - PhabricatorApplicationTransactionInterface { + PhabricatorApplicationTransactionInterface, + PhabricatorFulltextInterface { protected $name; protected $repositoryPHID; @@ -161,4 +162,12 @@ return $timeline; } +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new DivinerLiveBookFulltextEngine(); + } + + } diff --git a/src/applications/diviner/storage/DivinerLiveSymbol.php b/src/applications/diviner/storage/DivinerLiveSymbol.php --- a/src/applications/diviner/storage/DivinerLiveSymbol.php +++ b/src/applications/diviner/storage/DivinerLiveSymbol.php @@ -4,7 +4,8 @@ implements PhabricatorPolicyInterface, PhabricatorMarkupInterface, - PhabricatorDestructibleInterface { + PhabricatorDestructibleInterface, + PhabricatorFulltextInterface { protected $bookPHID; protected $repositoryPHID; @@ -280,4 +281,16 @@ $this->saveTransaction(); } + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + if (!$this->getIsDocumentable()) { + return null; + } + + return new DivinerLiveSymbolFulltextEngine(); + } + } diff --git a/src/applications/fund/search/FundInitiativeFulltextEngine.php b/src/applications/fund/search/FundInitiativeFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/fund/search/FundInitiativeFulltextEngine.php @@ -0,0 +1,34 @@ +setDocumentTitle($initiative->getName()); + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, + $initiative->getOwnerPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + $initiative->getDateCreated()); + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_OWNER, + $initiative->getOwnerPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + $initiative->getDateCreated()); + + $document->addRelationship( + $initiative->isClosed() + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, + $initiative->getPHID(), + FundInitiativePHIDType::TYPECONST, + PhabricatorTime::getNow()); + } +} diff --git a/src/applications/fund/search/FundInitiativeIndexer.php b/src/applications/fund/search/FundInitiativeIndexer.php deleted file mode 100644 --- a/src/applications/fund/search/FundInitiativeIndexer.php +++ /dev/null @@ -1,56 +0,0 @@ -setViewer($this->getViewer()) - ->withPHIDs(array($phid)) - ->executeOne(); - if (!$object) { - throw new Exception( - pht( - "Unable to load object by PHID '%s'!", - $phid)); - } - return $object; - } - - protected function buildAbstractDocumentByPHID($phid) { - $initiative = $this->loadDocumentByPHID($phid); - - $doc = id(new PhabricatorSearchAbstractDocument()) - ->setPHID($initiative->getPHID()) - ->setDocumentType(FundInitiativePHIDType::TYPECONST) - ->setDocumentTitle($initiative->getName()) - ->setDocumentCreated($initiative->getDateCreated()) - ->setDocumentModified($initiative->getDateModified()); - - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, - $initiative->getOwnerPHID(), - PhabricatorPeopleUserPHIDType::TYPECONST, - $initiative->getDateCreated()); - - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_OWNER, - $initiative->getOwnerPHID(), - PhabricatorPeopleUserPHIDType::TYPECONST, - $initiative->getDateCreated()); - - $doc->addRelationship( - $initiative->isClosed() - ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED - : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, - $initiative->getPHID(), - FundInitiativePHIDType::TYPECONST, - time()); - - return $doc; - } -} diff --git a/src/applications/fund/storage/FundInitiative.php b/src/applications/fund/storage/FundInitiative.php --- a/src/applications/fund/storage/FundInitiative.php +++ b/src/applications/fund/storage/FundInitiative.php @@ -9,7 +9,8 @@ PhabricatorMentionableInterface, PhabricatorFlaggableInterface, PhabricatorTokenReceiverInterface, - PhabricatorDestructibleInterface { + PhabricatorDestructibleInterface, + PhabricatorFulltextInterface { protected $name; protected $ownerPHID; @@ -207,4 +208,12 @@ $this->saveTransaction(); } + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new FundInitiativeFulltextEngine(); + } + } diff --git a/src/applications/maniphest/search/ManiphestSearchIndexer.php b/src/applications/maniphest/search/ManiphestTaskFulltextEngine.php rename from src/applications/maniphest/search/ManiphestSearchIndexer.php rename to src/applications/maniphest/search/ManiphestTaskFulltextEngine.php --- a/src/applications/maniphest/search/ManiphestSearchIndexer.php +++ b/src/applications/maniphest/search/ManiphestTaskFulltextEngine.php @@ -1,55 +1,48 @@ loadDocumentByPHID($phid); + $task = $object; - $doc = new PhabricatorSearchAbstractDocument(); - $doc->setPHID($task->getPHID()); - $doc->setDocumentType(ManiphestTaskPHIDType::TYPECONST); - $doc->setDocumentTitle($task->getTitle()); - $doc->setDocumentCreated($task->getDateCreated()); - $doc->setDocumentModified($task->getDateModified()); + $document->setDocumentTitle($task->getTitle()); - $doc->addField( + $document->addField( PhabricatorSearchDocumentFieldType::FIELD_BODY, $task->getDescription()); - $doc->addRelationship( + $document->addRelationship( PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $task->getAuthorPHID(), PhabricatorPeopleUserPHIDType::TYPECONST, $task->getDateCreated()); - $doc->addRelationship( + $document->addRelationship( $task->isClosed() ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $task->getPHID(), ManiphestTaskPHIDType::TYPECONST, - time()); + PhabricatorTime::getNow()); $owner = $task->getOwnerPHID(); if ($owner) { - $doc->addRelationship( + $document->addRelationship( PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $owner, PhabricatorPeopleUserPHIDType::TYPECONST, time()); } else { - $doc->addRelationship( + $document->addRelationship( PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED, $task->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_VOID, $task->getDateCreated()); } - - return $doc; } } diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -14,7 +14,8 @@ PhabricatorApplicationTransactionInterface, PhabricatorProjectInterface, PhabricatorSpacesInterface, - PhabricatorConduitResultInterface { + PhabricatorConduitResultInterface, + PhabricatorFulltextInterface { const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; @@ -452,4 +453,12 @@ return array(); } + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new ManiphestTaskFulltextEngine(); + } + } diff --git a/src/applications/passphrase/search/PassphraseCredentialFulltextEngine.php b/src/applications/passphrase/search/PassphraseCredentialFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/passphrase/search/PassphraseCredentialFulltextEngine.php @@ -0,0 +1,27 @@ +setDocumentTitle($credential->getName()); + + $document->addField( + PhabricatorSearchDocumentFieldType::FIELD_BODY, + $credential->getDescription()); + + $document->addRelationship( + $credential->getIsDestroyed() + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, + $credential->getPHID(), + PassphraseCredentialPHIDType::TYPECONST, + PhabricatorTime::getNow()); + } + +} diff --git a/src/applications/passphrase/search/PassphraseSearchIndexer.php b/src/applications/passphrase/search/PassphraseSearchIndexer.php deleted file mode 100644 --- a/src/applications/passphrase/search/PassphraseSearchIndexer.php +++ /dev/null @@ -1,34 +0,0 @@ -loadDocumentByPHID($phid); - - $doc = new PhabricatorSearchAbstractDocument(); - $doc->setPHID($credential->getPHID()); - $doc->setDocumentType(PassphraseCredentialPHIDType::TYPECONST); - $doc->setDocumentTitle($credential->getName()); - $doc->setDocumentCreated($credential->getDateCreated()); - $doc->setDocumentModified($credential->getDateModified()); - - $doc->addField( - PhabricatorSearchDocumentFieldType::FIELD_BODY, - $credential->getDescription()); - - $doc->addRelationship( - $credential->getIsDestroyed() - ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED - : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, - $credential->getPHID(), - PassphraseCredentialPHIDType::TYPECONST, - time()); - - return $doc; - } - -} diff --git a/src/applications/passphrase/storage/PassphraseCredential.php b/src/applications/passphrase/storage/PassphraseCredential.php --- a/src/applications/passphrase/storage/PassphraseCredential.php +++ b/src/applications/passphrase/storage/PassphraseCredential.php @@ -7,7 +7,8 @@ PhabricatorFlaggableInterface, PhabricatorSubscribableInterface, PhabricatorDestructibleInterface, - PhabricatorSpacesInterface { + PhabricatorSpacesInterface, + PhabricatorFulltextInterface { protected $name; protected $credentialType; @@ -189,4 +190,13 @@ return $this->spacePHID; } + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new PassphraseCredentialFulltextEngine(); + } + + } diff --git a/src/applications/people/search/PhabricatorUserFulltextEngine.php b/src/applications/people/search/PhabricatorUserFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/people/search/PhabricatorUserFulltextEngine.php @@ -0,0 +1,22 @@ +setDocumentTitle($user->getFullName()); + + $document->addRelationship( + $user->isUserActivated() + ? PhabricatorSearchRelationship::RELATIONSHIP_OPEN + : PhabricatorSearchRelationship::RELATIONSHIP_CLOSED, + $user->getPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + PhabricatorTime::getNow()); + } +} diff --git a/src/applications/people/search/PhabricatorUserSearchIndexer.php b/src/applications/people/search/PhabricatorUserSearchIndexer.php deleted file mode 100644 --- a/src/applications/people/search/PhabricatorUserSearchIndexer.php +++ /dev/null @@ -1,30 +0,0 @@ -loadDocumentByPHID($phid); - - $doc = new PhabricatorSearchAbstractDocument(); - $doc->setPHID($user->getPHID()); - $doc->setDocumentType(PhabricatorPeopleUserPHIDType::TYPECONST); - $doc->setDocumentTitle($user->getFullName()); - $doc->setDocumentCreated($user->getDateCreated()); - $doc->setDocumentModified($user->getDateModified()); - - $doc->addRelationship( - $user->isUserActivated() - ? PhabricatorSearchRelationship::RELATIONSHIP_OPEN - : PhabricatorSearchRelationship::RELATIONSHIP_CLOSED, - $user->getPHID(), - PhabricatorPeopleUserPHIDType::TYPECONST, - time()); - - return $doc; - } -} diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -15,7 +15,8 @@ PhabricatorDestructibleInterface, PhabricatorSSHPublicKeyInterface, PhabricatorFlaggableInterface, - PhabricatorApplicationTransactionInterface { + PhabricatorApplicationTransactionInterface, + PhabricatorFulltextInterface { const SESSION_TABLE = 'phabricator_session'; const NAMETOKEN_TABLE = 'user_nametoken'; @@ -1308,4 +1309,12 @@ return $timeline; } + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new PhabricatorUserFulltextEngine(); + } + } diff --git a/src/applications/pholio/search/PholioMockFulltextEngine.php b/src/applications/pholio/search/PholioMockFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/pholio/search/PholioMockFulltextEngine.php @@ -0,0 +1,25 @@ +setDocumentTitle($mock->getName()); + + $document->addField( + PhabricatorSearchDocumentFieldType::FIELD_BODY, + $mock->getDescription()); + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, + $mock->getAuthorPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + $mock->getDateCreated()); + } + +} diff --git a/src/applications/pholio/search/PholioSearchIndexer.php b/src/applications/pholio/search/PholioSearchIndexer.php deleted file mode 100644 --- a/src/applications/pholio/search/PholioSearchIndexer.php +++ /dev/null @@ -1,30 +0,0 @@ -loadDocumentByPHID($phid); - - $doc = $this->newDocument($phid) - ->setDocumentTitle($mock->getName()) - ->setDocumentCreated($mock->getDateCreated()) - ->setDocumentModified($mock->getDateModified()); - - $doc->addField( - PhabricatorSearchDocumentFieldType::FIELD_BODY, - $mock->getDescription()); - - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, - $mock->getAuthorPHID(), - PhabricatorPeopleUserPHIDType::TYPECONST, - $mock->getDateCreated()); - - return $doc; - } - -} diff --git a/src/applications/pholio/storage/PholioMock.php b/src/applications/pholio/storage/PholioMock.php --- a/src/applications/pholio/storage/PholioMock.php +++ b/src/applications/pholio/storage/PholioMock.php @@ -11,7 +11,8 @@ PhabricatorProjectInterface, PhabricatorDestructibleInterface, PhabricatorSpacesInterface, - PhabricatorMentionableInterface { + PhabricatorMentionableInterface, + PhabricatorFulltextInterface { const MARKUP_FIELD_DESCRIPTION = 'markup:description'; @@ -321,4 +322,12 @@ } +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new PholioMockFulltextEngine(); + } + + } diff --git a/src/applications/phriction/search/PhrictionDocumentFulltextEngine.php b/src/applications/phriction/search/PhrictionDocumentFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/phriction/search/PhrictionDocumentFulltextEngine.php @@ -0,0 +1,44 @@ +setViewer($this->getViewer()) + ->withPHIDs(array($document->getPHID())) + ->needContent(true) + ->executeOne(); + + $content = $wiki->getContent(); + + $document->setDocumentTitle($content->getTitle()); + + // TODO: These are not quite correct, but we don't currently store the + // proper dates in a way that's easy to get to. + $document + ->setDocumentCreated($content->getDateCreated()) + ->setDocumentModified($content->getDateModified()); + + $document->addField( + PhabricatorSearchDocumentFieldType::FIELD_BODY, + $content->getContent()); + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, + $content->getAuthorPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + $content->getDateCreated()); + + $document->addRelationship( + ($wiki->getStatus() == PhrictionDocumentStatus::STATUS_EXISTS) + ? PhabricatorSearchRelationship::RELATIONSHIP_OPEN + : PhabricatorSearchRelationship::RELATIONSHIP_CLOSED, + $wiki->getPHID(), + PhrictionDocumentPHIDType::TYPECONST, + PhabricatorTime::getNow()); + } +} diff --git a/src/applications/phriction/search/PhrictionSearchIndexer.php b/src/applications/phriction/search/PhrictionSearchIndexer.php deleted file mode 100644 --- a/src/applications/phriction/search/PhrictionSearchIndexer.php +++ /dev/null @@ -1,47 +0,0 @@ -loadDocumentByPHID($phid); - - $content = id(new PhrictionContent())->load($document->getContentID()); - $document->attachContent($content); - - $content = $document->getContent(); - - $doc = new PhabricatorSearchAbstractDocument(); - $doc->setPHID($document->getPHID()); - $doc->setDocumentType(PhrictionDocumentPHIDType::TYPECONST); - $doc->setDocumentTitle($content->getTitle()); - - // TODO: This isn't precisely correct, denormalize into the Document table? - $doc->setDocumentCreated($content->getDateCreated()); - $doc->setDocumentModified($content->getDateModified()); - - $doc->addField( - PhabricatorSearchDocumentFieldType::FIELD_BODY, - $content->getContent()); - - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, - $content->getAuthorPHID(), - PhabricatorPeopleUserPHIDType::TYPECONST, - $content->getDateCreated()); - - $doc->addRelationship( - ($document->getStatus() == PhrictionDocumentStatus::STATUS_EXISTS) - ? PhabricatorSearchRelationship::RELATIONSHIP_OPEN - : PhabricatorSearchRelationship::RELATIONSHIP_CLOSED, - $document->getPHID(), - PhrictionDocumentPHIDType::TYPECONST, - time()); - - return $doc; - } -} diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php --- a/src/applications/phriction/storage/PhrictionDocument.php +++ b/src/applications/phriction/storage/PhrictionDocument.php @@ -7,7 +7,8 @@ PhabricatorFlaggableInterface, PhabricatorTokenReceiverInterface, PhabricatorDestructibleInterface, - PhabricatorApplicationTransactionInterface { + PhabricatorApplicationTransactionInterface, + PhabricatorFulltextInterface { protected $slug; protected $depth; @@ -252,4 +253,12 @@ $this->saveTransaction(); } + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new PhrictionDocumentFulltextEngine(); + } + } diff --git a/src/applications/ponder/search/PonderQuestionFulltextEngine.php b/src/applications/ponder/search/PonderQuestionFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/ponder/search/PonderQuestionFulltextEngine.php @@ -0,0 +1,24 @@ +setDocumentTitle($question->getTitle()); + + $document->addField( + PhabricatorSearchDocumentFieldType::FIELD_BODY, + $question->getContent()); + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, + $question->getAuthorPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + $question->getDateCreated()); + } +} diff --git a/src/applications/ponder/search/PonderSearchIndexer.php b/src/applications/ponder/search/PonderSearchIndexer.php deleted file mode 100644 --- a/src/applications/ponder/search/PonderSearchIndexer.php +++ /dev/null @@ -1,42 +0,0 @@ -loadDocumentByPHID($phid); - - $doc = $this->newDocument($phid) - ->setDocumentTitle($question->getTitle()) - ->setDocumentCreated($question->getDateCreated()) - ->setDocumentModified($question->getDateModified()); - - $doc->addField( - PhabricatorSearchDocumentFieldType::FIELD_BODY, - $question->getContent()); - - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, - $question->getAuthorPHID(), - PhabricatorPeopleUserPHIDType::TYPECONST, - $question->getDateCreated()); - - $answers = id(new PonderAnswerQuery()) - ->setViewer($this->getViewer()) - ->withQuestionIDs(array($question->getID())) - ->execute(); - foreach ($answers as $answer) { - if (strlen($answer->getContent())) { - $doc->addField( - PhabricatorSearchDocumentFieldType::FIELD_COMMENT, - $answer->getContent()); - } - } - - return $doc; - } -} diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php --- a/src/applications/ponder/storage/PonderQuestion.php +++ b/src/applications/ponder/storage/PonderQuestion.php @@ -10,7 +10,8 @@ PhabricatorTokenReceiverInterface, PhabricatorProjectInterface, PhabricatorDestructibleInterface, - PhabricatorSpacesInterface { + PhabricatorSpacesInterface, + PhabricatorFulltextInterface { const MARKUP_FIELD_CONTENT = 'markup:content'; @@ -291,4 +292,12 @@ return $this->spacePHID; } + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new PonderQuestionFulltextEngine(); + } + } diff --git a/src/applications/project/search/PhabricatorProjectFulltextEngine.php b/src/applications/project/search/PhabricatorProjectFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/project/search/PhabricatorProjectFulltextEngine.php @@ -0,0 +1,24 @@ +updateDatasourceTokens(); + + $document->setDocumentTitle($project->getName()); + + $document->addRelationship( + $project->isArchived() + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, + $project->getPHID(), + PhabricatorProjectProjectPHIDType::TYPECONST, + PhabricatorTime::getNow()); + } + +} diff --git a/src/applications/project/search/PhabricatorProjectSearchIndexer.php b/src/applications/project/search/PhabricatorProjectSearchIndexer.php deleted file mode 100644 --- a/src/applications/project/search/PhabricatorProjectSearchIndexer.php +++ /dev/null @@ -1,35 +0,0 @@ -loadDocumentByPHID($phid); - $project->updateDatasourceTokens(); - - $doc = new PhabricatorSearchAbstractDocument(); - $doc->setPHID($project->getPHID()); - $doc->setDocumentType(PhabricatorProjectProjectPHIDType::TYPECONST); - $doc->setDocumentTitle($project->getName()); - $doc->setDocumentCreated($project->getDateCreated()); - $doc->setDocumentModified($project->getDateModified()); - - $doc->addRelationship( - $project->isArchived() - ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED - : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, - $project->getPHID(), - PhabricatorProjectProjectPHIDType::TYPECONST, - time()); - - // NOTE: This could be more full-featured, but for now we're mostly - // interested in the side effects of indexing. - - return $doc; - } - -} diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -7,7 +7,8 @@ PhabricatorPolicyInterface, PhabricatorSubscribableInterface, PhabricatorCustomFieldInterface, - PhabricatorDestructibleInterface { + PhabricatorDestructibleInterface, + PhabricatorFulltextInterface { protected $name; protected $status = PhabricatorProjectStatus::STATUS_ACTIVE; @@ -387,6 +388,7 @@ /* -( PhabricatorDestructibleInterface )----------------------------------- */ + public function destroyObjectPermanently( PhabricatorDestructionEngine $engine) { @@ -408,4 +410,12 @@ $this->saveTransaction(); } + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new PhabricatorProjectFulltextEngine(); + } + } diff --git a/src/applications/repository/search/DiffusionCommitFulltextEngine.php b/src/applications/repository/search/DiffusionCommitFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/repository/search/DiffusionCommitFulltextEngine.php @@ -0,0 +1,49 @@ +setViewer($this->getViewer()) + ->withPHIDs(array($object->getPHID())) + ->needCommitData(true) + ->executeOne(); + + $repository = $commit->getRepository(); + $commit_data = $commit->getCommitData(); + + $date_created = $commit->getEpoch(); + $commit_message = $commit_data->getCommitMessage(); + $author_phid = $commit_data->getCommitDetail('authorPHID'); + + $title = 'r'.$repository->getCallsign().$commit->getCommitIdentifier(). + ' '.$commit_data->getSummary(); + + $document + ->setDocumentCreated($date_created) + ->setDocumentModified($date_created) + ->setDocumentTitle($title); + + $document->addField( + PhabricatorSearchDocumentFieldType::FIELD_BODY, + $commit_message); + + if ($author_phid) { + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, + $author_phid, + PhabricatorPeopleUserPHIDType::TYPECONST, + $date_created); + } + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, + $repository->getPHID(), + PhabricatorRepositoryRepositoryPHIDType::TYPECONST, + $date_created); + } +} diff --git a/src/applications/repository/search/PhabricatorRepositoryCommitSearchIndexer.php b/src/applications/repository/search/PhabricatorRepositoryCommitSearchIndexer.php deleted file mode 100644 --- a/src/applications/repository/search/PhabricatorRepositoryCommitSearchIndexer.php +++ /dev/null @@ -1,58 +0,0 @@ -loadDocumentByPHID($phid); - - $commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere( - 'commitID = %d', - $commit->getID()); - $date_created = $commit->getEpoch(); - $commit_message = $commit_data->getCommitMessage(); - $author_phid = $commit_data->getCommitDetail('authorPHID'); - - $repository = id(new PhabricatorRepositoryQuery()) - ->setViewer($this->getViewer()) - ->withIDs(array($commit->getRepositoryID())) - ->executeOne(); - if (!$repository) { - throw new Exception(pht('No such repository!')); - } - - $title = 'r'.$repository->getCallsign().$commit->getCommitIdentifier(). - ' '.$commit_data->getSummary(); - - $doc = new PhabricatorSearchAbstractDocument(); - $doc->setPHID($commit->getPHID()); - $doc->setDocumentType(PhabricatorRepositoryCommitPHIDType::TYPECONST); - $doc->setDocumentCreated($date_created); - $doc->setDocumentModified($date_created); - $doc->setDocumentTitle($title); - - $doc->addField( - PhabricatorSearchDocumentFieldType::FIELD_BODY, - $commit_message); - - if ($author_phid) { - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, - $author_phid, - PhabricatorPeopleUserPHIDType::TYPECONST, - $date_created); - } - - $doc->addRelationship( - PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, - $repository->getPHID(), - PhabricatorRepositoryRepositoryPHIDType::TYPECONST, - $date_created); - - return $doc; - } -} diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php --- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php @@ -11,7 +11,8 @@ PhabricatorMentionableInterface, HarbormasterBuildableInterface, PhabricatorCustomFieldInterface, - PhabricatorApplicationTransactionInterface { + PhabricatorApplicationTransactionInterface, + PhabricatorFulltextInterface { protected $repositoryID; protected $phid; @@ -437,4 +438,11 @@ return $timeline->setPathMap($path_map); } +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + + public function newFulltextEngine() { + return new DiffusionCommitFulltextEngine(); + } + } diff --git a/src/applications/search/engineextension/PhabricatorFulltextIndexEngineExtension.php b/src/applications/search/engineextension/PhabricatorFulltextIndexEngineExtension.php new file mode 100644 --- /dev/null +++ b/src/applications/search/engineextension/PhabricatorFulltextIndexEngineExtension.php @@ -0,0 +1,30 @@ +newFulltextEngine(); + if (!$engine) { + return; + } + + $engine->setObject($object); + + $engine->buildFulltextIndexes(); + } + +} diff --git a/src/applications/search/engineextension/PhabricatorLiskFulltextEngineExtension.php b/src/applications/search/engineextension/PhabricatorLiskFulltextEngineExtension.php new file mode 100644 --- /dev/null +++ b/src/applications/search/engineextension/PhabricatorLiskFulltextEngineExtension.php @@ -0,0 +1,34 @@ +getConfigOption(LiskDAO::CONFIG_TIMESTAMPS)) { + return false; + } + + return true; + } + + public function indexFulltextObject( + $object, + PhabricatorSearchAbstractDocument $document) { + + $document + ->setDocumentCreated($object->getDateCreated()) + ->setDocumentModified($object->getDateModified()); + + } + +} diff --git a/src/applications/search/index/PhabricatorFulltextEngine.php b/src/applications/search/index/PhabricatorFulltextEngine.php new file mode 100644 --- /dev/null +++ b/src/applications/search/index/PhabricatorFulltextEngine.php @@ -0,0 +1,54 @@ +object = $object; + return $this; + } + + public function getObject() { + return $this->object; + } + + protected function getViewer() { + return PhabricatorUser::getOmnipotentUser(); + } + + abstract protected function buildAbstractDocument( + PhabricatorSearchAbstractDocument $document, + $object); + + final public function buildFulltextIndexes() { + $object = $this->getObject(); + + $extensions = PhabricatorFulltextEngineExtension::getAllExtensions(); + foreach ($extensions as $key => $extension) { + if (!$extension->shouldIndexFulltextObject($object)) { + unset($extensions[$key]); + } + } + + $document = $this->newAbstractDocument($object); + + $this->buildAbstractDocument($document, $object); + + foreach ($extensions as $extension) { + $extension->indexFulltextObject($object, $document); + } + + $storage_engine = PhabricatorSearchEngine::loadEngine(); + $storage_engine->reindexAbstractDocument($document); + } + + protected function newAbstractDocument($object) { + $phid = $object->getPHID(); + return id(new PhabricatorSearchAbstractDocument()) + ->setPHID($phid) + ->setDocumentType(phid_get_type($phid)); + } + +} diff --git a/src/applications/search/index/PhabricatorIndexEngine.php b/src/applications/search/index/PhabricatorIndexEngine.php --- a/src/applications/search/index/PhabricatorIndexEngine.php +++ b/src/applications/search/index/PhabricatorIndexEngine.php @@ -96,19 +96,4 @@ return $extensions; } - public function indexDocumentByPHID($phid) { - $indexers = id(new PhutilClassMapQuery()) - ->setAncestorClass('PhabricatorSearchDocumentIndexer') - ->execute(); - - foreach ($indexers as $indexer) { - if ($indexer->shouldIndexDocumentByPHID($phid)) { - $indexer->indexDocumentByPHID($phid); - break; - } - } - - return $this; - } - } diff --git a/src/applications/search/index/PhabricatorSearchDocumentIndexer.php b/src/applications/search/index/PhabricatorSearchDocumentIndexer.php deleted file mode 100644 --- a/src/applications/search/index/PhabricatorSearchDocumentIndexer.php +++ /dev/null @@ -1,65 +0,0 @@ -getIndexableObject(); - return (phid_get_type($phid) == phid_get_type($object->generatePHID())); - } - - public function getIndexIterator() { - $object = $this->getIndexableObject(); - return new LiskMigrationIterator($object); - } - - protected function loadDocumentByPHID($phid) { - $object = id(new PhabricatorObjectQuery()) - ->setViewer($this->getViewer()) - ->withPHIDs(array($phid)) - ->executeOne(); - if (!$object) { - throw new Exception(pht("Unable to load object by PHID '%s'!", $phid)); - } - return $object; - } - - public function indexDocumentByPHID($phid) { - $document = $this->buildAbstractDocumentByPHID($phid); - if ($document === null) { - // This indexer doesn't build a document index, so we're done. - return $this; - } - - $object = $this->loadDocumentByPHID($phid); - - $extensions = PhabricatorFulltextEngineExtension::getAllExtensions(); - foreach ($extensions as $key => $extension) { - if (!$extension->shouldIndexFulltextObject($object)) { - unset($extensions[$key]); - } - } - - foreach ($extensions as $extension) { - $extension->indexFulltextObject($object, $document); - } - - $engine = PhabricatorSearchEngine::loadEngine(); - $engine->reindexAbstractDocument($document); - - return $this; - } - - protected function newDocument($phid) { - return id(new PhabricatorSearchAbstractDocument()) - ->setPHID($phid) - ->setDocumentType(phid_get_type($phid)); - } - -} diff --git a/src/applications/search/interface/PhabricatorFulltextInterface.php b/src/applications/search/interface/PhabricatorFulltextInterface.php new file mode 100644 --- /dev/null +++ b/src/applications/search/interface/PhabricatorFulltextInterface.php @@ -0,0 +1,7 @@ +setSynopsis(pht('Build or rebuild search indexes.')) ->setExamples( "**index** D123\n". - "**index** --type DREV\n". + "**index** --type task\n". "**index** --all") ->setArguments( array( @@ -19,8 +19,9 @@ ), array( 'name' => 'type', - 'param' => 'TYPE', - 'help' => pht('PHID type to reindex, like "TASK" or "DREV".'), + 'param' => 'type', + 'help' => pht( + 'Object types to reindex, like "task", "commit" or "revision".'), ), array( 'name' => 'background', @@ -146,20 +147,49 @@ } private function loadPHIDsByTypes($type) { - $indexers = id(new PhutilClassMapQuery()) - ->setAncestorClass('PhabricatorSearchDocumentIndexer') + $objects = id(new PhutilClassMapQuery()) + ->setAncestorClass('PhabricatorFulltextInterface') ->execute(); - $phids = array(); - foreach ($indexers as $indexer) { - $indexer_phid = $indexer->getIndexableObject()->generatePHID(); - $indexer_type = phid_get_type($indexer_phid); + $normalized_type = phutil_utf8_strtolower($type); + + $matches = array(); + foreach ($objects as $object) { + $object_class = get_class($object); + $normalized_class = phutil_utf8_strtolower($object_class); + + if (!strlen($type) || + strpos($normalized_class, $normalized_type) !== false) { + $matches[$object_class] = $object; + } + } - if ($type && strcasecmp($indexer_type, $type)) { - continue; + if (!$matches) { + $all_types = array(); + foreach ($objects as $object) { + $all_types[] = get_class($object); } + sort($all_types); - $iterator = $indexer->getIndexIterator(); + throw new PhutilArgumentUsageException( + pht( + 'Type "%s" matches no indexable objects. Supported types are: %s.', + $type, + implode(', ', $all_types))); + } + + if ((count($matches) > 1) && strlen($type)) { + throw new PhutilArgumentUsageException( + pht( + 'Type "%s" matches multiple indexable objects. Use a more '. + 'specific string. Matching object types are: %s.', + $type, + implode(', ', array_keys($matches)))); + } + + $phids = array(); + foreach ($matches as $match) { + $iterator = new LiskMigrationIterator($match); foreach ($iterator as $object) { $phids[] = $object->getPHID(); } @@ -168,4 +198,5 @@ return $phids; } + } diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php --- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php +++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php @@ -204,10 +204,16 @@ // TODO: This is inelegant and not very efficient, but gets us reasonable // results. It would be nice to do this more elegantly. - $indexers = id(new PhutilClassMapQuery()) - ->setAncestorClass('PhabricatorSearchDocumentIndexer') + $objects = id(new PhutilClassMapQuery()) + ->setAncestorClass('PhabricatorFulltextInterface') ->execute(); + $type_map = array(); + foreach ($objects as $object) { + $phid_type = phid_get_type($object->generatePHID()); + $type_map[$phid_type] = $object; + } + if ($viewer) { $types = PhabricatorPHIDType::getAllInstalledTypes($viewer); } else { @@ -217,11 +223,9 @@ $results = array(); foreach ($types as $type) { $typeconst = $type->getTypeConstant(); - foreach ($indexers as $indexer) { - $fake_phid = 'PHID-'.$typeconst.'-fake'; - if ($indexer->shouldIndexDocumentByPHID($fake_phid)) { - $results[$typeconst] = $type->getTypeName(); - } + $object = idx($type_map, $typeconst); + if ($object) { + $results[$typeconst] = $type->getTypeName(); } } diff --git a/src/applications/search/worker/PhabricatorSearchWorker.php b/src/applications/search/worker/PhabricatorSearchWorker.php --- a/src/applications/search/worker/PhabricatorSearchWorker.php +++ b/src/applications/search/worker/PhabricatorSearchWorker.php @@ -47,18 +47,16 @@ $engine->setObject($object); $engine->indexObject(); - - $engine->indexDocumentByPHID($object->getPHID()); } catch (Exception $ex) { $lock->unlock(); - if (!($ex instanceof PhabricatorWorkerPermanentFailureException)) { - $ex = new PhabricatorWorkerPermanentFailureException( - pht( - 'Failed to update search index for document "%s": %s', - $object_phid, - $ex->getMessage())); - } + // if (!($ex instanceof PhabricatorWorkerPermanentFailureException)) { + // $ex = new PhabricatorWorkerPermanentFailureException( + // pht( + // 'Failed to update search index for document "%s": %s', + // $object_phid, + // $ex->getMessage())); + // } throw $ex; }