Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added list-orphans and clear-orphans sub-commands to the `search-…#7044

Merged
smotornyuk merged 3 commits into
ckan:masterfrom
JVickery-TBS:feature/search-index-remove-orphans
Oct 7, 2022
Merged

Added list-orphans and clear-orphans sub-commands to the `search-…#7044
smotornyuk merged 3 commits into
ckan:masterfrom
JVickery-TBS:feature/search-index-remove-orphans

Conversation

@JVickery-TBS
Copy link
Copy Markdown
Contributor

…index` command.

Fixes #

Adds sub-commands to search-index to list and clear any orphaned package indexes.

Background info:

We ran into an issue in which there were some left-over packages in the solr index, despite that the packages were purged from the database. So we had a report of a few packages not existing but still coming up in the searches due to the solr index. We had to just run ckan search-index clear DATASET_ID on each one. So this sparked adding these simple cli sub-commands to deal with this issue if it happens for others.

Features:

  • includes tests covering changes
  • includes updated documentation
  • includes user-visible changes
  • includes API changes
  • includes bugfix for possible backport

Please [X] all the boxes above that apply

@smotornyuk smotornyuk self-assigned this Aug 30, 2022
Comment thread ckan/cli/search_index.py Outdated
Comment thread ckan/cli/search_index.py Outdated
Comment thread ckan/cli/search_index.py Outdated
Comment thread ckan/cli/search_index.py Outdated
Comment thread ckan/cli/search_index.py Outdated
Comment thread ckan/cli/search_index.py Outdated
@smotornyuk
Copy link
Copy Markdown
Member

In addition to review comments:

  • Run flake8 and fix all style issues
  • Run npx pyright and fix all type issues
  • add changes/7044.feature with a short description of the feature for the changelog

…hans` to always return a str list. Changed the `indexed_package_ids` to a pagination loop at a 1000 iteration. Used `click.echo` instead of `pprint`. Added another output message on how many orphaned packages were found. Added changelog file.
@JVickery-TBS
Copy link
Copy Markdown
Contributor Author

@smotornyuk I have done all of your suggested changes. I also ran flake8 for the file but no issues came up locally for me. I ran npx pyright and fixed any issues with those as well.

The changelog file has also been added.

@JVickery-TBS
Copy link
Copy Markdown
Contributor Author

@smotornyuk nevermind regarding the flake8, turns out I just don't know how to use it. Figured it out and made those changes.

Because of the line length, I did end up putting the @search_index.command definitions across multiple lines. Hope that is alright?

@smotornyuk smotornyuk merged commit 2448cd9 into ckan:master Oct 7, 2022
JVickery-TBS pushed a commit to open-data/ckan that referenced this pull request Jun 27, 2023
…emove-orphans

Added `list-orphans` and `clear-orphans` sub-commands to the `search-…
# Conflicts:
#	ckan/cli/search_index.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants