=== modified file 'Do/src/Do.Core/HistogramRelevanceProvider.cs' --- Do/src/Do.Core/HistogramRelevanceProvider.cs 2009-06-18 20:12:44 +0000 +++ Do/src/Do.Core/HistogramRelevanceProvider.cs 2009-12-07 00:09:38 +0000 @@ -65,9 +65,9 @@ match = match ?? ""; newest_hit = DateTime.Now; - if (!hits.TryGetValue (element.UniqueId, out rec)) { + if (!hits.TryGetValue (element.UniqueId + (other == null ? "" : other.UniqueId), out rec)) { rec = new RelevanceRecord (element); - hits [element.UniqueId] = rec; + hits [element.UniqueId + (other == null ? "" : other.UniqueId)] = rec; } rec.Hits++; @@ -85,10 +85,10 @@ if (element == null) throw new ArgumentNullException ("element"); match = match ?? ""; - if (hits.TryGetValue (element.UniqueId, out rec)) { + if (hits.TryGetValue (element.UniqueId + (other == null ? "" : other.UniqueId), out rec)) { rec.Hits--; if (other == null) rec.FirstPaneHits--; - if (rec.Hits == 0) hits.Remove (element.UniqueId); + if (rec.Hits == 0) hits.Remove (element.UniqueId + (other == null ? "" : other.UniqueId)); } } @@ -99,20 +99,16 @@ float relevance = 0f, age = 0f, score = 0f; string name = e.Safe.Name; - if (!hits.TryGetValue (e.UniqueId, out rec)) + if (!hits.TryGetValue (e.UniqueId + (other == null ? "" : other.UniqueId), out rec)) rec = new RelevanceRecord (e); isAction = e.IsAction (); + // Get string similarity score. score = StringScoreForAbbreviation (name, match); if (score == 0f) return 0f; - - // Pin some actions to top. - // TODO Remove this when relevance is refactored and improved. - if (other != null && - (e is OpenAction || e is RunAction || e is OpenUrlAction)) - return 1f; + // We must give a base, non-zero relevance to make scoring rules take // effect. We scale by length so that if two objects have default