1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 20:10:55 +01:00

Convert all "DocumentIndexers" into "FulltextEngines"

Summary: Ref T9979. This simplifies/standardizes the code a bit, but mostly gives us more consistent class names and structure.

Test Plan:
  - Used `bin/search index --type ...` to index documents of every indexable type.
  - Searched for documents by unique text, found them.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9979

Differential Revision: https://secure.phabricator.com/D14842
This commit is contained in:
epriestley 2015-12-21 09:02:55 -08:00
parent 99bd12b98d
commit 99c9df96b4
47 changed files with 764 additions and 665 deletions

View file

@ -482,6 +482,7 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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',
@ -1537,6 +1538,7 @@ phutil_register_library_map(array(
'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',
@ -1564,7 +1566,6 @@ phutil_register_library_map(array(
'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',
@ -1841,6 +1842,7 @@ phutil_register_library_map(array(
'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',
@ -1850,7 +1852,6 @@ phutil_register_library_map(array(
'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',
@ -2327,8 +2328,11 @@ phutil_register_library_map(array(
'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',
@ -2407,6 +2411,7 @@ phutil_register_library_map(array(
'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',
@ -2832,6 +2837,7 @@ phutil_register_library_map(array(
'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',
@ -2860,7 +2866,6 @@ phutil_register_library_map(array(
'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',
@ -2914,7 +2919,6 @@ phutil_register_library_map(array(
'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',
@ -3026,7 +3030,6 @@ phutil_register_library_map(array(
'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',
@ -3285,6 +3288,7 @@ phutil_register_library_map(array(
'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',
@ -3294,7 +3298,6 @@ phutil_register_library_map(array(
'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',
@ -3451,6 +3454,7 @@ phutil_register_library_map(array(
'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',
@ -3466,7 +3470,6 @@ phutil_register_library_map(array(
'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',
@ -3638,6 +3641,7 @@ phutil_register_library_map(array(
'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',
@ -3658,7 +3662,6 @@ phutil_register_library_map(array(
'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',
@ -3693,6 +3696,7 @@ phutil_register_library_map(array(
'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',
@ -3708,7 +3712,6 @@ phutil_register_library_map(array(
'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',
@ -4398,6 +4401,7 @@ phutil_register_library_map(array(
'PhabricatorMentionableInterface',
'PhabricatorDestructibleInterface',
'PhabricatorProjectInterface',
'PhabricatorFulltextInterface',
),
'DifferentialRevisionAffectedFilesHeraldField' => 'DifferentialRevisionHeraldField',
'DifferentialRevisionAuthorHeraldField' => 'DifferentialRevisionHeraldField',
@ -4411,6 +4415,7 @@ phutil_register_library_map(array(
'DifferentialRevisionDependsOnRevisionEdgeType' => 'PhabricatorEdgeType',
'DifferentialRevisionDetailView' => 'AphrontView',
'DifferentialRevisionEditController' => 'DifferentialController',
'DifferentialRevisionFulltextEngine' => 'PhabricatorFulltextEngine',
'DifferentialRevisionHasCommitEdgeType' => 'PhabricatorEdgeType',
'DifferentialRevisionHasReviewerEdgeType' => 'PhabricatorEdgeType',
'DifferentialRevisionHasTaskEdgeType' => 'PhabricatorEdgeType',
@ -4436,7 +4441,6 @@ phutil_register_library_map(array(
'DifferentialRevisionUpdateHistoryView' => 'AphrontView',
'DifferentialRevisionViewController' => 'DifferentialController',
'DifferentialSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'DifferentialSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'DifferentialSetDiffPropertyConduitAPIMethod' => 'DifferentialConduitAPIMethod',
'DifferentialStoredCustomField' => 'DifferentialCustomField',
'DifferentialSubscribersField' => 'DifferentialCoreCustomField',
@ -4485,6 +4489,7 @@ phutil_register_library_map(array(
'DiffusionCommitDiffContentRemovedHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitDiffEnormousHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitEditController' => 'DiffusionController',
'DiffusionCommitFulltextEngine' => 'PhabricatorFulltextEngine',
'DiffusionCommitHasRevisionEdgeType' => 'PhabricatorEdgeType',
'DiffusionCommitHasTaskEdgeType' => 'PhabricatorEdgeType',
'DiffusionCommitHash' => 'Phobject',
@ -4699,7 +4704,6 @@ phutil_register_library_map(array(
'DivinerAtomQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DivinerAtomRef' => 'Phobject',
'DivinerAtomSearchEngine' => 'PhabricatorApplicationSearchEngine',
'DivinerAtomSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'DivinerAtomizeWorkflow' => 'DivinerWorkflow',
'DivinerAtomizer' => 'Phobject',
'DivinerBookController' => 'DivinerController',
@ -4708,7 +4712,6 @@ phutil_register_library_map(array(
'DivinerBookItemView' => 'AphrontTagView',
'DivinerBookPHIDType' => 'PhabricatorPHIDType',
'DivinerBookQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DivinerBookSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'DivinerController' => 'PhabricatorController',
'DivinerDAO' => 'PhabricatorLiskDAO',
'DivinerDefaultEditCapability' => 'PhabricatorPolicyCapability',
@ -4725,8 +4728,10 @@ phutil_register_library_map(array(
'PhabricatorProjectInterface',
'PhabricatorDestructibleInterface',
'PhabricatorApplicationTransactionInterface',
'PhabricatorFulltextInterface',
),
'DivinerLiveBookEditor' => 'PhabricatorApplicationTransactionEditor',
'DivinerLiveBookFulltextEngine' => 'PhabricatorFulltextEngine',
'DivinerLiveBookTransaction' => 'PhabricatorApplicationTransaction',
'DivinerLiveBookTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'DivinerLivePublisher' => 'DivinerPublisher',
@ -4735,7 +4740,9 @@ phutil_register_library_map(array(
'PhabricatorPolicyInterface',
'PhabricatorMarkupInterface',
'PhabricatorDestructibleInterface',
'PhabricatorFulltextInterface',
),
'DivinerLiveSymbolFulltextEngine' => 'PhabricatorFulltextEngine',
'DivinerMainController' => 'DivinerController',
'DivinerPHPAtomizer' => 'DivinerAtomizer',
'DivinerParameterTableView' => 'AphrontTagView',
@ -4964,12 +4971,13 @@ phutil_register_library_map(array(
'PhabricatorFlaggableInterface',
'PhabricatorTokenReceiverInterface',
'PhabricatorDestructibleInterface',
'PhabricatorFulltextInterface',
),
'FundInitiativeBackController' => 'FundController',
'FundInitiativeCloseController' => 'FundController',
'FundInitiativeEditController' => 'FundController',
'FundInitiativeEditor' => 'PhabricatorApplicationTransactionEditor',
'FundInitiativeIndexer' => 'PhabricatorSearchDocumentIndexer',
'FundInitiativeFulltextEngine' => 'PhabricatorFulltextEngine',
'FundInitiativeListController' => 'FundController',
'FundInitiativePHIDType' => 'PhabricatorPHIDType',
'FundInitiativeQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@ -5351,7 +5359,6 @@ phutil_register_library_map(array(
'ManiphestReportController' => 'ManiphestController',
'ManiphestSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'ManiphestSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'ManiphestSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'ManiphestStatusConfigOptionType' => 'PhabricatorConfigJSONOptionType',
'ManiphestStatusEmailCommand' => 'ManiphestEmailCommand',
'ManiphestSubpriorityController' => 'ManiphestController',
@ -5370,6 +5377,7 @@ phutil_register_library_map(array(
'PhabricatorProjectInterface',
'PhabricatorSpacesInterface',
'PhabricatorConduitResultInterface',
'PhabricatorFulltextInterface',
),
'ManiphestTaskAssignHeraldAction' => 'HeraldAction',
'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction',
@ -5384,6 +5392,7 @@ phutil_register_library_map(array(
'ManiphestTaskDetailController' => 'ManiphestController',
'ManiphestTaskEditBulkJobType' => 'PhabricatorWorkerBulkJobType',
'ManiphestTaskEditController' => 'ManiphestController',
'ManiphestTaskFulltextEngine' => 'PhabricatorFulltextEngine',
'ManiphestTaskHasCommitEdgeType' => 'PhabricatorEdgeType',
'ManiphestTaskHasMockEdgeType' => 'PhabricatorEdgeType',
'ManiphestTaskHasRevisionEdgeType' => 'PhabricatorEdgeType',
@ -5616,6 +5625,7 @@ phutil_register_library_map(array(
'PhabricatorSubscribableInterface',
'PhabricatorDestructibleInterface',
'PhabricatorSpacesInterface',
'PhabricatorFulltextInterface',
),
'PassphraseCredentialAuthorPolicyRule' => 'PhabricatorPolicyRule',
'PassphraseCredentialConduitController' => 'PassphraseController',
@ -5623,6 +5633,7 @@ phutil_register_library_map(array(
'PassphraseCredentialCreateController' => 'PassphraseController',
'PassphraseCredentialDestroyController' => 'PassphraseController',
'PassphraseCredentialEditController' => 'PassphraseController',
'PassphraseCredentialFulltextEngine' => 'PhabricatorFulltextEngine',
'PassphraseCredentialListController' => 'PassphraseController',
'PassphraseCredentialLockController' => 'PassphraseController',
'PassphraseCredentialPHIDType' => 'PhabricatorPHIDType',
@ -5650,7 +5661,6 @@ phutil_register_library_map(array(
'PassphraseSSHPrivateKeyFileCredentialType' => 'PassphraseSSHPrivateKeyCredentialType',
'PassphraseSSHPrivateKeyTextCredentialType' => 'PassphraseSSHPrivateKeyCredentialType',
'PassphraseSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PassphraseSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PassphraseSecret' => 'PassphraseDAO',
'PasteConduitAPIMethod' => 'ConduitAPIMethod',
'PasteCreateConduitAPIMethod' => 'PasteConduitAPIMethod',
@ -5971,6 +5981,7 @@ phutil_register_library_map(array(
'PhabricatorMentionableInterface',
'PhabricatorFlaggableInterface',
'PhabricatorSpacesInterface',
'PhabricatorFulltextInterface',
),
'PhabricatorCalendarEventCancelController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController',
@ -5978,6 +5989,7 @@ phutil_register_library_map(array(
'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand',
'PhabricatorCalendarEventFulltextEngine' => 'PhabricatorFulltextEngine',
'PhabricatorCalendarEventInvitee' => array(
'PhabricatorCalendarDAO',
'PhabricatorPolicyInterface',
@ -5990,7 +6002,6 @@ phutil_register_library_map(array(
'PhabricatorCalendarEventQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorCalendarEventRSVPEmailCommand' => 'PhabricatorCalendarEventEmailCommand',
'PhabricatorCalendarEventSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorCalendarEventSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PhabricatorCalendarEventTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorCalendarEventTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PhabricatorCalendarEventTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
@ -6552,8 +6563,10 @@ phutil_register_library_map(array(
'PhabricatorFlaggableInterface' => 'PhabricatorPHIDInterface',
'PhabricatorFlagsApplication' => 'PhabricatorApplication',
'PhabricatorFlagsUIEventListener' => 'PhabricatorEventListener',
'PhabricatorFulltextEngine' => 'Phobject',
'PhabricatorFulltextEngineExtension' => 'Phobject',
'PhabricatorFulltextEngineExtensionModule' => 'PhabricatorConfigModule',
'PhabricatorFulltextIndexEngineExtension' => 'PhabricatorIndexEngineExtension',
'PhabricatorFundApplication' => 'PhabricatorApplication',
'PhabricatorGDSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorGarbageCollector' => 'Phobject',
@ -6637,6 +6650,7 @@ phutil_register_library_map(array(
'PhabricatorLipsumManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorLipsumMondrianArtist' => 'PhabricatorLipsumArtist',
'PhabricatorLiskDAO' => 'LiskDAO',
'PhabricatorLiskFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
'PhabricatorLiskSearchEngineExtension' => 'PhabricatorSearchEngineExtension',
'PhabricatorLiskSerializer' => 'Phobject',
'PhabricatorListFilterUIExample' => 'PhabricatorUIExample',
@ -7100,6 +7114,7 @@ phutil_register_library_map(array(
'PhabricatorSubscribableInterface',
'PhabricatorCustomFieldInterface',
'PhabricatorDestructibleInterface',
'PhabricatorFulltextInterface',
),
'PhabricatorProjectAddHeraldAction' => 'PhabricatorProjectHeraldAction',
'PhabricatorProjectApplication' => 'PhabricatorApplication',
@ -7144,6 +7159,7 @@ phutil_register_library_map(array(
'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController',
'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase',
'PhabricatorProjectFeedController' => 'PhabricatorProjectController',
'PhabricatorProjectFulltextEngine' => 'PhabricatorFulltextEngine',
'PhabricatorProjectHeraldAction' => 'HeraldAction',
'PhabricatorProjectIconSet' => 'PhabricatorIconSet',
'PhabricatorProjectListController' => 'PhabricatorProjectController',
@ -7171,7 +7187,6 @@ phutil_register_library_map(array(
'PhabricatorProjectSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorProjectSearchField' => 'PhabricatorSearchTokenizerField',
'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PhabricatorProjectSlug' => 'PhabricatorProjectDAO',
'PhabricatorProjectStandardCustomField' => array(
'PhabricatorProjectCustomField',
@ -7245,6 +7260,7 @@ phutil_register_library_map(array(
'HarbormasterBuildableInterface',
'PhabricatorCustomFieldInterface',
'PhabricatorApplicationTransactionInterface',
'PhabricatorFulltextInterface',
),
'PhabricatorRepositoryCommitChangeParserWorker' => 'PhabricatorRepositoryCommitParserWorker',
'PhabricatorRepositoryCommitData' => 'PhabricatorRepositoryDAO',
@ -7254,7 +7270,6 @@ phutil_register_library_map(array(
'PhabricatorRepositoryCommitPHIDType' => 'PhabricatorPHIDType',
'PhabricatorRepositoryCommitParserWorker' => 'PhabricatorWorker',
'PhabricatorRepositoryCommitRef' => 'Phobject',
'PhabricatorRepositoryCommitSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PhabricatorRepositoryConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorRepositoryDAO' => 'PhabricatorLiskDAO',
'PhabricatorRepositoryDiscoveryEngine' => 'PhabricatorRepositoryEngine',
@ -7380,7 +7395,6 @@ phutil_register_library_map(array(
'PhabricatorSearchDocument' => 'PhabricatorSearchDAO',
'PhabricatorSearchDocumentField' => 'PhabricatorSearchDAO',
'PhabricatorSearchDocumentFieldType' => 'Phobject',
'PhabricatorSearchDocumentIndexer' => 'Phobject',
'PhabricatorSearchDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorSearchDocumentRelationship' => 'PhabricatorSearchDAO',
'PhabricatorSearchDocumentTypeDatasource' => 'PhabricatorTypeaheadDatasource',
@ -7656,6 +7670,7 @@ phutil_register_library_map(array(
'PhabricatorSSHPublicKeyInterface',
'PhabricatorFlaggableInterface',
'PhabricatorApplicationTransactionInterface',
'PhabricatorFulltextInterface',
),
'PhabricatorUserBlurbField' => 'PhabricatorUserCustomField',
'PhabricatorUserConfigOptions' => 'PhabricatorApplicationConfigOptions',
@ -7672,6 +7687,7 @@ phutil_register_library_map(array(
'PhabricatorUserEditorTestCase' => 'PhabricatorTestCase',
'PhabricatorUserEmail' => 'PhabricatorUserDAO',
'PhabricatorUserEmailTestCase' => 'PhabricatorTestCase',
'PhabricatorUserFulltextEngine' => 'PhabricatorFulltextEngine',
'PhabricatorUserLog' => array(
'PhabricatorUserDAO',
'PhabricatorPolicyInterface',
@ -7684,7 +7700,6 @@ phutil_register_library_map(array(
'PhabricatorUserRealNameField' => 'PhabricatorUserCustomField',
'PhabricatorUserRolesField' => 'PhabricatorUserCustomField',
'PhabricatorUserSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorUserSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PhabricatorUserSinceField' => 'PhabricatorUserCustomField',
'PhabricatorUserStatusField' => 'PhabricatorUserCustomField',
'PhabricatorUserTestCase' => 'PhabricatorTestCase',
@ -7883,6 +7898,7 @@ phutil_register_library_map(array(
'PhabricatorDestructibleInterface',
'PhabricatorSpacesInterface',
'PhabricatorMentionableInterface',
'PhabricatorFulltextInterface',
),
'PholioMockArchiveController' => 'PholioController',
'PholioMockAuthorHeraldField' => 'PholioMockHeraldField',
@ -7891,6 +7907,7 @@ phutil_register_library_map(array(
'PholioMockEditController' => 'PholioController',
'PholioMockEditor' => 'PhabricatorApplicationTransactionEditor',
'PholioMockEmbedView' => 'AphrontView',
'PholioMockFulltextEngine' => 'PhabricatorFulltextEngine',
'PholioMockHasTaskEdgeType' => 'PhabricatorEdgeType',
'PholioMockHeraldField' => 'HeraldField',
'PholioMockHeraldFieldGroup' => 'HeraldFieldGroup',
@ -7906,7 +7923,6 @@ phutil_register_library_map(array(
'PholioRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'PholioReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PholioSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PholioSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PholioTransaction' => 'PhabricatorApplicationTransaction',
'PholioTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PholioTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
@ -8129,10 +8145,12 @@ phutil_register_library_map(array(
'PhabricatorTokenReceiverInterface',
'PhabricatorDestructibleInterface',
'PhabricatorApplicationTransactionInterface',
'PhabricatorFulltextInterface',
),
'PhrictionDocumentAuthorHeraldField' => 'PhrictionDocumentHeraldField',
'PhrictionDocumentContentHeraldField' => 'PhrictionDocumentHeraldField',
'PhrictionDocumentController' => 'PhrictionController',
'PhrictionDocumentFulltextEngine' => 'PhabricatorFulltextEngine',
'PhrictionDocumentHeraldAdapter' => 'HeraldAdapter',
'PhrictionDocumentHeraldField' => 'HeraldField',
'PhrictionDocumentHeraldFieldGroup' => 'HeraldFieldGroup',
@ -8153,7 +8171,6 @@ phutil_register_library_map(array(
'PhrictionReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PhrictionSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhrictionSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhrictionSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PhrictionTransaction' => 'PhabricatorApplicationTransaction',
'PhrictionTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PhrictionTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
@ -8204,10 +8221,12 @@ phutil_register_library_map(array(
'PhabricatorProjectInterface',
'PhabricatorDestructibleInterface',
'PhabricatorSpacesInterface',
'PhabricatorFulltextInterface',
),
'PonderQuestionCommentController' => 'PonderController',
'PonderQuestionEditController' => 'PonderController',
'PonderQuestionEditor' => 'PonderEditor',
'PonderQuestionFulltextEngine' => 'PhabricatorFulltextEngine',
'PonderQuestionHistoryController' => 'PonderController',
'PonderQuestionListController' => 'PonderController',
'PonderQuestionMailReceiver' => 'PhabricatorObjectMailReceiver',
@ -8223,7 +8242,6 @@ phutil_register_library_map(array(
'PonderQuestionViewController' => 'PonderController',
'PonderRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'PonderSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PonderSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PonderVote' => 'PonderConstants',
'PonderVoteEditor' => 'PhabricatorEditor',
'PonderVotingUserHasAnswerEdgeType' => 'PhabricatorEdgeType',

View file

@ -0,0 +1,39 @@
<?php
final class PhabricatorCalendarEventFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$event = $object;
$document->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());
}
}

View file

@ -1,47 +0,0 @@
<?php
final class PhabricatorCalendarEventSearchIndexer
extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new PhabricatorCalendarEvent();
}
protected function buildAbstractDocumentByPHID($phid) {
$event = $this->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;
}
}

View file

@ -10,7 +10,8 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
PhabricatorDestructibleInterface,
PhabricatorMentionableInterface,
PhabricatorFlaggableInterface,
PhabricatorSpacesInterface {
PhabricatorSpacesInterface,
PhabricatorFulltextInterface {
protected $name;
protected $userPHID;
@ -562,4 +563,13 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
public function getSpacePHID() {
return $this->spacePHID;
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new PhabricatorCalendarEventFulltextEngine();
}
}

View file

@ -0,0 +1,64 @@
<?php
final class DifferentialRevisionFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$revision = id(new DifferentialRevisionQuery())
->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());
}
}
}

View file

@ -1,76 +0,0 @@
<?php
final class DifferentialSearchIndexer
extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new DifferentialRevision();
}
protected function loadDocumentByPHID($phid) {
$object = id(new DifferentialRevisionQuery())
->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;
}
}

View file

@ -13,7 +13,8 @@ final class DifferentialRevision extends DifferentialDAO
PhabricatorApplicationTransactionInterface,
PhabricatorMentionableInterface,
PhabricatorDestructibleInterface,
PhabricatorProjectInterface {
PhabricatorProjectInterface,
PhabricatorFulltextInterface {
protected $title = '';
protected $originalTitle;
@ -629,4 +630,13 @@ final class DifferentialRevision extends DifferentialDAO
$this->saveTransaction();
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new DifferentialRevisionFulltextEngine();
}
}

View file

@ -1,31 +0,0 @@
<?php
final class DivinerBookSearchIndexer extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new DivinerLiveBook();
}
protected function buildAbstractDocumentByPHID($phid) {
$book = $this->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;
}
}

View file

@ -0,0 +1,26 @@
<?php
final class DivinerLiveBookFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$book = $object;
$document->setDocumentTitle($book->getTitle());
$document->addField(
PhabricatorSearchDocumentFieldType::FIELD_BODY,
$book->getPreface());
$document->addRelationship(
PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY,
$book->getRepositoryPHID(),
PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
$book->getDateCreated());
}
}

View file

@ -1,49 +1,43 @@
<?php
final class DivinerAtomSearchIndexer extends PhabricatorSearchDocumentIndexer {
final class DivinerLiveSymbolFulltextEngine
extends PhabricatorFulltextEngine {
public function getIndexableObject() {
return new DivinerLiveSymbol();
}
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
protected function buildAbstractDocumentByPHID($phid) {
$atom = $this->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;
}
}

View file

@ -5,7 +5,8 @@ final class DivinerLiveBook extends DivinerDAO
PhabricatorPolicyInterface,
PhabricatorProjectInterface,
PhabricatorDestructibleInterface,
PhabricatorApplicationTransactionInterface {
PhabricatorApplicationTransactionInterface,
PhabricatorFulltextInterface {
protected $name;
protected $repositoryPHID;
@ -161,4 +162,12 @@ final class DivinerLiveBook extends DivinerDAO
return $timeline;
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new DivinerLiveBookFulltextEngine();
}
}

View file

@ -4,7 +4,8 @@ final class DivinerLiveSymbol extends DivinerDAO
implements
PhabricatorPolicyInterface,
PhabricatorMarkupInterface,
PhabricatorDestructibleInterface {
PhabricatorDestructibleInterface,
PhabricatorFulltextInterface {
protected $bookPHID;
protected $repositoryPHID;
@ -280,4 +281,16 @@ final class DivinerLiveSymbol extends DivinerDAO
$this->saveTransaction();
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
if (!$this->getIsDocumentable()) {
return null;
}
return new DivinerLiveSymbolFulltextEngine();
}
}

View file

@ -0,0 +1,34 @@
<?php
final class FundInitiativeFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$initiative = $object;
$document->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());
}
}

View file

@ -1,56 +0,0 @@
<?php
final class FundInitiativeIndexer
extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new FundInitiative();
}
protected function loadDocumentByPHID($phid) {
$object = id(new FundInitiativeQuery())
->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;
}
}

View file

@ -9,7 +9,8 @@ final class FundInitiative extends FundDAO
PhabricatorMentionableInterface,
PhabricatorFlaggableInterface,
PhabricatorTokenReceiverInterface,
PhabricatorDestructibleInterface {
PhabricatorDestructibleInterface,
PhabricatorFulltextInterface {
protected $name;
protected $ownerPHID;
@ -207,4 +208,12 @@ final class FundInitiative extends FundDAO
$this->saveTransaction();
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new FundInitiativeFulltextEngine();
}
}

View file

@ -1,55 +1,48 @@
<?php
final class ManiphestSearchIndexer extends PhabricatorSearchDocumentIndexer {
final class ManiphestTaskFulltextEngine
extends PhabricatorFulltextEngine {
public function getIndexableObject() {
return new ManiphestTask();
}
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
protected function buildAbstractDocumentByPHID($phid) {
$task = $this->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;
}
}

View file

@ -14,7 +14,8 @@ final class ManiphestTask extends ManiphestDAO
PhabricatorApplicationTransactionInterface,
PhabricatorProjectInterface,
PhabricatorSpacesInterface,
PhabricatorConduitResultInterface {
PhabricatorConduitResultInterface,
PhabricatorFulltextInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:desc';
@ -452,4 +453,12 @@ final class ManiphestTask extends ManiphestDAO
return array();
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new ManiphestTaskFulltextEngine();
}
}

View file

@ -0,0 +1,27 @@
<?php
final class PassphraseCredentialFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$credential = $object;
$document->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());
}
}

View file

@ -1,34 +0,0 @@
<?php
final class PassphraseSearchIndexer extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new PassphraseCredential();
}
protected function buildAbstractDocumentByPHID($phid) {
$credential = $this->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;
}
}

View file

@ -7,7 +7,8 @@ final class PassphraseCredential extends PassphraseDAO
PhabricatorFlaggableInterface,
PhabricatorSubscribableInterface,
PhabricatorDestructibleInterface,
PhabricatorSpacesInterface {
PhabricatorSpacesInterface,
PhabricatorFulltextInterface {
protected $name;
protected $credentialType;
@ -189,4 +190,13 @@ final class PassphraseCredential extends PassphraseDAO
return $this->spacePHID;
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new PassphraseCredentialFulltextEngine();
}
}

View file

@ -0,0 +1,22 @@
<?php
final class PhabricatorUserFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$user = $object;
$document->setDocumentTitle($user->getFullName());
$document->addRelationship(
$user->isUserActivated()
? PhabricatorSearchRelationship::RELATIONSHIP_OPEN
: PhabricatorSearchRelationship::RELATIONSHIP_CLOSED,
$user->getPHID(),
PhabricatorPeopleUserPHIDType::TYPECONST,
PhabricatorTime::getNow());
}
}

View file

@ -1,30 +0,0 @@
<?php
final class PhabricatorUserSearchIndexer
extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new PhabricatorUser();
}
protected function buildAbstractDocumentByPHID($phid) {
$user = $this->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;
}
}

View file

@ -15,7 +15,8 @@ final class PhabricatorUser
PhabricatorDestructibleInterface,
PhabricatorSSHPublicKeyInterface,
PhabricatorFlaggableInterface,
PhabricatorApplicationTransactionInterface {
PhabricatorApplicationTransactionInterface,
PhabricatorFulltextInterface {
const SESSION_TABLE = 'phabricator_session';
const NAMETOKEN_TABLE = 'user_nametoken';
@ -1308,4 +1309,12 @@ final class PhabricatorUser
return $timeline;
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new PhabricatorUserFulltextEngine();
}
}

View file

@ -0,0 +1,25 @@
<?php
final class PholioMockFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$mock = $object;
$document->setDocumentTitle($mock->getName());
$document->addField(
PhabricatorSearchDocumentFieldType::FIELD_BODY,
$mock->getDescription());
$document->addRelationship(
PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
$mock->getAuthorPHID(),
PhabricatorPeopleUserPHIDType::TYPECONST,
$mock->getDateCreated());
}
}

View file

@ -1,30 +0,0 @@
<?php
final class PholioSearchIndexer extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new PholioMock();
}
protected function buildAbstractDocumentByPHID($phid) {
$mock = $this->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;
}
}

View file

@ -11,7 +11,8 @@ final class PholioMock extends PholioDAO
PhabricatorProjectInterface,
PhabricatorDestructibleInterface,
PhabricatorSpacesInterface,
PhabricatorMentionableInterface {
PhabricatorMentionableInterface,
PhabricatorFulltextInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
@ -321,4 +322,12 @@ final class PholioMock extends PholioDAO
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new PholioMockFulltextEngine();
}
}

View file

@ -0,0 +1,44 @@
<?php
final class PhrictionDocumentFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$wiki = id(new PhrictionDocumentQuery())
->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());
}
}

View file

@ -1,47 +0,0 @@
<?php
final class PhrictionSearchIndexer
extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new PhrictionDocument();
}
protected function buildAbstractDocumentByPHID($phid) {
$document = $this->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;
}
}

View file

@ -7,7 +7,8 @@ final class PhrictionDocument extends PhrictionDAO
PhabricatorFlaggableInterface,
PhabricatorTokenReceiverInterface,
PhabricatorDestructibleInterface,
PhabricatorApplicationTransactionInterface {
PhabricatorApplicationTransactionInterface,
PhabricatorFulltextInterface {
protected $slug;
protected $depth;
@ -252,4 +253,12 @@ final class PhrictionDocument extends PhrictionDAO
$this->saveTransaction();
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new PhrictionDocumentFulltextEngine();
}
}

View file

@ -0,0 +1,24 @@
<?php
final class PonderQuestionFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$question = $object;
$document->setDocumentTitle($question->getTitle());
$document->addField(
PhabricatorSearchDocumentFieldType::FIELD_BODY,
$question->getContent());
$document->addRelationship(
PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
$question->getAuthorPHID(),
PhabricatorPeopleUserPHIDType::TYPECONST,
$question->getDateCreated());
}
}

View file

@ -1,42 +0,0 @@
<?php
final class PonderSearchIndexer
extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new PonderQuestion();
}
protected function buildAbstractDocumentByPHID($phid) {
$question = $this->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;
}
}

View file

@ -10,7 +10,8 @@ final class PonderQuestion extends PonderDAO
PhabricatorTokenReceiverInterface,
PhabricatorProjectInterface,
PhabricatorDestructibleInterface,
PhabricatorSpacesInterface {
PhabricatorSpacesInterface,
PhabricatorFulltextInterface {
const MARKUP_FIELD_CONTENT = 'markup:content';
@ -291,4 +292,12 @@ final class PonderQuestion extends PonderDAO
return $this->spacePHID;
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new PonderQuestionFulltextEngine();
}
}

View file

@ -0,0 +1,24 @@
<?php
final class PhabricatorProjectFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$project = $object;
$project->updateDatasourceTokens();
$document->setDocumentTitle($project->getName());
$document->addRelationship(
$project->isArchived()
? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED
: PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
$project->getPHID(),
PhabricatorProjectProjectPHIDType::TYPECONST,
PhabricatorTime::getNow());
}
}

View file

@ -1,35 +0,0 @@
<?php
final class PhabricatorProjectSearchIndexer
extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new PhabricatorProject();
}
protected function buildAbstractDocumentByPHID($phid) {
$project = $this->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;
}
}

View file

@ -7,7 +7,8 @@ final class PhabricatorProject extends PhabricatorProjectDAO
PhabricatorPolicyInterface,
PhabricatorSubscribableInterface,
PhabricatorCustomFieldInterface,
PhabricatorDestructibleInterface {
PhabricatorDestructibleInterface,
PhabricatorFulltextInterface {
protected $name;
protected $status = PhabricatorProjectStatus::STATUS_ACTIVE;
@ -387,6 +388,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO
/* -( PhabricatorDestructibleInterface )----------------------------------- */
public function destroyObjectPermanently(
PhabricatorDestructionEngine $engine) {
@ -408,4 +410,12 @@ final class PhabricatorProject extends PhabricatorProjectDAO
$this->saveTransaction();
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new PhabricatorProjectFulltextEngine();
}
}

View file

@ -0,0 +1,49 @@
<?php
final class DiffusionCommitFulltextEngine
extends PhabricatorFulltextEngine {
protected function buildAbstractDocument(
PhabricatorSearchAbstractDocument $document,
$object) {
$commit = id(new DiffusionCommitQuery())
->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);
}
}

View file

@ -1,58 +0,0 @@
<?php
final class PhabricatorRepositoryCommitSearchIndexer
extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new PhabricatorRepositoryCommit();
}
protected function buildAbstractDocumentByPHID($phid) {
$commit = $this->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;
}
}

View file

@ -11,7 +11,8 @@ final class PhabricatorRepositoryCommit
PhabricatorMentionableInterface,
HarbormasterBuildableInterface,
PhabricatorCustomFieldInterface,
PhabricatorApplicationTransactionInterface {
PhabricatorApplicationTransactionInterface,
PhabricatorFulltextInterface {
protected $repositoryID;
protected $phid;
@ -437,4 +438,11 @@ final class PhabricatorRepositoryCommit
return $timeline->setPathMap($path_map);
}
/* -( PhabricatorFulltextInterface )--------------------------------------- */
public function newFulltextEngine() {
return new DiffusionCommitFulltextEngine();
}
}

View file

@ -0,0 +1,30 @@
<?php
final class PhabricatorFulltextIndexEngineExtension
extends PhabricatorIndexEngineExtension {
const EXTENSIONKEY = 'fulltext';
public function getExtensionName() {
return pht('Fulltext Engine');
}
public function shouldIndexObject($object) {
return ($object instanceof PhabricatorFulltextInterface);
}
public function indexObject(
PhabricatorIndexEngine $engine,
$object) {
$engine = $object->newFulltextEngine();
if (!$engine) {
return;
}
$engine->setObject($object);
$engine->buildFulltextIndexes();
}
}

View file

@ -0,0 +1,34 @@
<?php
final class PhabricatorLiskFulltextEngineExtension
extends PhabricatorFulltextEngineExtension {
const EXTENSIONKEY = 'lisk';
public function getExtensionName() {
return pht('Lisk Builtin Properties');
}
public function shouldIndexFulltextObject($object) {
if (!($object instanceof PhabricatorLiskDAO)) {
return false;
}
if (!$object->getConfigOption(LiskDAO::CONFIG_TIMESTAMPS)) {
return false;
}
return true;
}
public function indexFulltextObject(
$object,
PhabricatorSearchAbstractDocument $document) {
$document
->setDocumentCreated($object->getDateCreated())
->setDocumentModified($object->getDateModified());
}
}

View file

@ -0,0 +1,54 @@
<?php
abstract class PhabricatorFulltextEngine
extends Phobject {
private $object;
public function setObject($object) {
$this->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));
}
}

View file

@ -96,19 +96,4 @@ final class PhabricatorIndexEngine extends Phobject {
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;
}
}

View file

@ -1,65 +0,0 @@
<?php
abstract class PhabricatorSearchDocumentIndexer extends Phobject {
abstract public function getIndexableObject();
abstract protected function buildAbstractDocumentByPHID($phid);
protected function getViewer() {
return PhabricatorUser::getOmnipotentUser();
}
public function shouldIndexDocumentByPHID($phid) {
$object = $this->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));
}
}

View file

@ -0,0 +1,7 @@
<?php
interface PhabricatorFulltextInterface {
public function newFulltextEngine();
}

View file

@ -9,7 +9,7 @@ final class PhabricatorSearchManagementIndexWorkflow
->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 @@ final class PhabricatorSearchManagementIndexWorkflow
),
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 @@ final class PhabricatorSearchManagementIndexWorkflow
}
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);
if ($type && strcasecmp($indexer_type, $type)) {
continue;
$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;
}
}
$iterator = $indexer->getIndexIterator();
if (!$matches) {
$all_types = array();
foreach ($objects as $object) {
$all_types[] = get_class($object);
}
sort($all_types);
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 @@ final class PhabricatorSearchManagementIndexWorkflow
return $phids;
}
}

View file

@ -204,10 +204,16 @@ final class PhabricatorSearchApplicationSearchEngine
// 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 @@ final class PhabricatorSearchApplicationSearchEngine
$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();
}
}

View file

@ -47,8 +47,6 @@ final class PhabricatorSearchWorker extends PhabricatorWorker {
$engine->setObject($object);
$engine->indexObject();
$engine->indexDocumentByPHID($object->getPHID());
} catch (Exception $ex) {
$lock->unlock();