Skip to main content

Introduction

A Plone portlet that uses the catalog internals to find ‘similar’ content to the page you are looking at

This portlet uses some deep dark data structures within the ZCatalog and ZCTextindex, so it could be brittle in the future if those structures are changed. Then again, they have been the same for the past 8 years or so ;)

This portlet also runs in linear time relative to the number for documents you have in your site, so it could well slow things down. That said I’ve tried to make it pretty efficient.

How it Works

In a nutshell, this portlet compares the text content of an object with all other objects on the site to find other objects with a similar content. The steps are as follows:

  1. Find the path of this document

  2. Look up the record_id (docid) of this path in the catalog

  3. Look in the SearchableText index to find all word ids (wids) in this document

  4. Work out the top 20 most ‘important’ words in this document [*]

  5. For each of the top 20 words, find all documents containing any of those words

  6. Use a vector space model to measure similarity of each candidate document to our top 20 words

  7. Return the top 10 most similar documents.

[*] We work out the top 20 words using a TF*IDF algorithm (the same used in ZCTextIndex.OkapiIndex) to find the words that appear proportionately high in this document compared to all documents in general.

TODO

Add some caching ;)

Changelog

1.5 - 2011-12-12

  • Fixed portlet edit permission used [vangheem]

1.4

  • Added checks for security and language on results [Alessio Siniscalchi]

1.3

  • Fixed broken 1.2 release egg

1.2

  • Added ability to only search certain types [matth]

  • Do not display portlet if no similar items found [matth]

1.1

  • Bug fix important word selection code [matth]

1.0

  • Initial release

Release files for collective.portlet.similarcontent 1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collective.portlet.similarcontent 1.5
File Size Uploaded
collective.portlet.similarcontent-1.5.zip 24.8 kB Details

Release files / collective.portlet.similarcontent-1.5.zip

Download URL collective.portlet.similarcontent-1.5.zip
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
925633721b2fca7f4bf32eff8a6a16f1403097df53d85608f62b4b2b0e23a618
BLAKE2b-256 checksum
How to use checksums
d3ab5b888bf7d905199bf6858dea2ee350cf98fc86970dbc5087adbc68708946
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.5 This release

1 release file

1.4

1 release file

1.3

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page