{"id":16421591,"url":"https://github.com/ongchi/wagtail-showsimilar","last_synced_at":"2025-10-26T22:30:39.722Z","repository":{"id":62588082,"uuid":"466175426","full_name":"ongchi/wagtail-showsimilar","owner":"ongchi","description":null,"archived":true,"fork":false,"pushed_at":"2023-01-05T12:29:18.000Z","size":507,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T18:20:18.281Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ongchi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-04T15:31:12.000Z","updated_at":"2024-10-05T23:20:14.000Z","dependencies_parsed_at":"2023-02-04T04:34:11.915Z","dependency_job_id":null,"html_url":"https://github.com/ongchi/wagtail-showsimilar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ongchi%2Fwagtail-showsimilar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ongchi%2Fwagtail-showsimilar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ongchi%2Fwagtail-showsimilar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ongchi%2Fwagtail-showsimilar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ongchi","download_url":"https://codeload.github.com/ongchi/wagtail-showsimilar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238401707,"owners_count":19465849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T07:33:55.926Z","updated_at":"2025-10-26T22:30:34.398Z","avatar_url":"https://github.com/ongchi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wagtail-showsimilar\n\nDisplay similar items by field value from wagtail search results.\n\n![Screeen Shot](https://raw.githubusercontent.com/ongchi/wagtail-showsimilar/master/images/screenshot.gif)\n\n## Quick Start\n\n### Installation\n\n```sh\npip install wagtail-showsimilar\n```\n\n### Setup\n\nAdd `wagtailshowsimilar` to your `settings.py` in the `INSTALLED_APPS` section:\n\n```python\nINSTALLED_APPS = [\n    ...\n    'wagtailshowsimilar',\n]\n```\n\n### Add admin urls\n\n```python\nfrom wagtailshowsimilar.urls import urlpatterns as showsimilar_admin_urls\n\nurlpatterns = [\n    ...\n    path('admin/showsimilar/', include(showsimilar_admin_urls)),\n    path('admin/', include(wagtailadmin_urls)),\n    ...\n]\n```\n\n### ```ShowSimilarPanel```\n\nThe model should be searchable to work with wagtail-showsimilar, All pages, images and documents are searchable by default in Wagtail. \n\n#### Options\n  - **score_threshold** (```int/float```) - Only score for matched results above this value will be listing. This field only works with Elasticsearch backend. (**default**: 20)\n  - **max_items** (```int```) - Maximum number of listing items shown from search results. (**default**: 10)\n\n```python\nfrom django.db import models\n\nfrom wagtail.search import index\nfrom wagtailshowsimilar.edit_handlers import ShowSimilarPanel\n\nclass BreadType(index.Indexed, models.Model):\n    title = models.CharField(max_length=255)\n\n    panels = [\n        ShowSimilarPanel('title', score_threshold=5),\n    ]\n\n    search_fields = [index.SearchField('title', partial_match=True)]\n```\n\nYou'll need to inherit from ```index.Indexed``` for custom models and add some ```search_fields``` to the model. For more information, please see [Indexing custom models](https://docs.wagtail.org/en/stable/topics/search/indexing.html#indexing-custom-models).\n\n### (Optional) Implement ```get_showsimilar_url```\n\nThe result list items create links to the edit view for Page models by default.\nIt's also possiable to implement get_showsimilar_url to customize link URL for ```Page```, ```Image```, ```Document``` or custom models.\n\n```python\nfrom django.urls import reverse\n\nclass BreadType(index.Indexed, models.Model):\n    ...\n\n    def get_showimilar_url(self):\n        return reverse(\"breads_breadtype_modeladmin_edit\", args=(self.id,))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fongchi%2Fwagtail-showsimilar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fongchi%2Fwagtail-showsimilar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fongchi%2Fwagtail-showsimilar/lists"}