From bd6d1d46593f31befe0f5788e26b943eab83330a Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 14 Oct 2012 12:13:45 +0000 Subject: [PATCH] * make TheTVDB local search more restrictive --- source/net/sourceforge/filebot/WebServices.java | 3 +++ .../net/sourceforge/filebot/web/LocalSearch.java | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/source/net/sourceforge/filebot/WebServices.java b/source/net/sourceforge/filebot/WebServices.java index a487891c..165eb529 100644 --- a/source/net/sourceforge/filebot/WebServices.java +++ b/source/net/sourceforge/filebot/WebServices.java @@ -128,6 +128,9 @@ public final class WebServices { return set(object.getName()); } }; + + // make local search more restrictive + localIndex.setResultMinimumSimilarity(0.7f); } return localIndex; diff --git a/source/net/sourceforge/filebot/web/LocalSearch.java b/source/net/sourceforge/filebot/web/LocalSearch.java index 3950d97a..f9b7c492 100644 --- a/source/net/sourceforge/filebot/web/LocalSearch.java +++ b/source/net/sourceforge/filebot/web/LocalSearch.java @@ -27,8 +27,8 @@ import uk.ac.shef.wit.simmetrics.similaritymetrics.QGramsDistance; public class LocalSearch { private final AbstractStringMetric metric = new QGramsDistance(); - private final float resultMinimumSimilarity = 0.5f; - private final int resultSetSize = 20; + private float resultMinimumSimilarity = 0.5f; + private int resultSetSize = 20; private final List objects; private final List> fields; @@ -110,6 +110,16 @@ public class LocalSearch { } + public void setResultMinimumSimilarity(float resultMinimumSimilarity) { + this.resultMinimumSimilarity = resultMinimumSimilarity; + } + + + public void setResultSetSize(int resultSetSize) { + this.resultSetSize = resultSetSize; + } + + protected Set getFields(T object) { return set(object.toString()); }