Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ public function handle_save_settings(): void {
'ai_categorize' => isset( $_POST['ai_categorize'] ),
'hub_review' => isset( $_POST['hub_review'] ),
'strategic_mode' => isset( $_POST['strategic_mode'] ),
'similarity_threshold' => min( 1, max( 0, (float) ( $_POST['similarity_threshold'] ?? 0.82 ) ) ),
'similarity_threshold' => min( 1, max( 0, (float) ( $_POST['similarity_threshold'] ?? 0.72 ) ) ),
'cluster_window_days' => max( 1, (int) ( $_POST['cluster_window_days'] ?? 7 ) ),
'import_interval_minutes' => max( 1, (int) ( $_POST['import_interval_minutes'] ?? 30 ) ),
'processing_enabled' => isset( $_POST['processing_enabled'] ),
Expand Down
3 changes: 2 additions & 1 deletion src/Admin/views/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@
<table class="form-table" role="presentation">
<tr>
<th><label for="similarity_threshold"><?php esc_html_e( 'Duplicate sensitivity', 'aggregate-it' ); ?></label></th>
<td><input name="similarity_threshold" id="similarity_threshold" type="number" step="0.01" min="0" max="1" class="small-text" value="<?php echo esc_attr( (string) $settings->similarity_threshold() ); ?>"></td>
<td><input name="similarity_threshold" id="similarity_threshold" type="number" step="0.01" min="0" max="1" class="small-text" value="<?php echo esc_attr( (string) $settings->similarity_threshold() ); ?>">
<p class="description"><?php esc_html_e( 'How similar two articles must be to merge into one story (0-1). Lower merges more aggressively; raise it if unrelated stories are being combined. Default 0.72.', 'aggregate-it' ); ?></p></td>
</tr>
<tr>
<th><label for="cluster_window_days"><?php esc_html_e( 'Keep updating a story for (days)', 'aggregate-it' ); ?></label></th>
Expand Down
8 changes: 8 additions & 0 deletions src/Cluster/Clusterer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public function match( array $vector, string $content ): ?int {

foreach ( $candidates as $candidate ) {
if ( $candidate['score'] < $threshold ) {
EventLog::info(
sprintf(
'Nearest existing story #%d scored %.3f, under the %.2f duplicate threshold, so this published as a new story. Lower "Duplicate sensitivity" to merge stories like this.',
$candidate['owner_id'],
$candidate['score'],
$threshold
)
);
return null; // sorted desc — nothing below the top will clear it either
}

Expand Down
2 changes: 1 addition & 1 deletion src/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function strategic_mode(): bool {
}

public function similarity_threshold(): float {
return (float) $this->get( 'similarity_threshold', 0.82 );
return (float) $this->get( 'similarity_threshold', 0.72 );
}

public function cluster_window_days(): int {
Expand Down
Loading