-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove Es6IndexUnitOfWork, use Es6Index instead
- Loading branch information
Showing
10 changed files
with
76 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,28 @@ | ||
import logging | ||
|
||
from karp.lex.application.repositories import EntryUnitOfWork | ||
from karp.lex.domain.errors import EntryNotFound, ResourceNotFound | ||
from karp.lex_core.value_objects import unique_id | ||
from karp.search.generic_resources import GenericResourceViews | ||
from karp.search_infrastructure import Es6IndexUnitOfWork, GenericPreProcessor | ||
from karp.timings import utc_now | ||
from karp.search_infrastructure import GenericPreProcessor | ||
from karp.search_infrastructure.repositories.es6_indicies import Es6Index | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class SearchCommands: | ||
def __init__( | ||
self, | ||
index_uow: Es6IndexUnitOfWork, | ||
index: Es6Index, | ||
resource_views: GenericResourceViews, | ||
pre_processor: GenericPreProcessor, | ||
): | ||
super().__init__() | ||
self.index_uow = index_uow | ||
self.index = index | ||
self.resource_views = resource_views | ||
self.pre_processor = pre_processor | ||
|
||
def reindex_resource(self, resource_id): | ||
logger.debug("Reindexing resource '%s'", resource_id) | ||
with self.index_uow as uw: | ||
uw.repo.create_index( | ||
resource_id, | ||
self.resource_views.get_resource_config(resource_id), | ||
) | ||
uw.repo.add_entries(resource_id, self.pre_processor.process(resource_id)) | ||
uw.commit() | ||
self.index.create_index( | ||
resource_id, | ||
self.resource_views.get_resource_config(resource_id), | ||
) | ||
self.index.add_entries(resource_id, self.pre_processor.process(resource_id)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
from .es6_indicies import Es6IndexUnitOfWork | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.