[tomboy] submitting patch for bug 637239
- From: Jared L Jennings <jjennings src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tomboy] submitting patch for bug 637239
- Date: Sat, 9 Apr 2011 21:59:45 +0000 (UTC)
commit 0294442c8b64b1d30aebf9c5cea2c68c2490f26a
Author: Jared Jennings <jjennings src gnome org>
Date: Sat Apr 9 17:59:24 2011 -0400
submitting patch for bug 637239
Tomboy/RecentChanges.cs | 5 ++++-
Tomboy/Search.cs | 23 +++++++++++++++++------
2 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/Tomboy/RecentChanges.cs b/Tomboy/RecentChanges.cs
index 314f070..fdca069 100644
--- a/Tomboy/RecentChanges.cs
+++ b/Tomboy/RecentChanges.cs
@@ -530,7 +530,10 @@ namespace Tomboy
if (note != null) {
int match_count;
if (current_matches.TryGetValue (note.Uri, out match_count)) {
- if (match_count > 0) {
+ if (match_count == int.MaxValue) {
+ match_str = string.Format (
+ Catalog.GetString ("Title match"));
+ } else if (match_count > 0) {
match_str = string.Format (
Catalog.GetPluralString ("{0} match",
"{0} matches",
diff --git a/Tomboy/Search.cs b/Tomboy/Search.cs
index bc0c7ff..ee02e38 100644
--- a/Tomboy/Search.cs
+++ b/Tomboy/Search.cs
@@ -15,7 +15,9 @@ namespace Tomboy
}
/// <summary>
- /// Search the notes!
+ /// Search the notes! A match number of
+ /// <see cref="int.MaxValue"/> indicates that the note
+ /// title contains the search term.
/// </summary>
/// <param name="query">
/// A <see cref="System.String"/>
@@ -29,7 +31,9 @@ namespace Tomboy
/// be searched.
/// </param>
/// <returns>
- /// A <see cref="IDictionary`2"/>
+ /// A <see cref="IDictionary`2"/> with the relevant Notes
+ /// and a match number. If the search term is in the title,
+ /// number will be <see cref="int.MaxValue"/>.
/// </returns>
public IDictionary<Note,int> SearchNotes (
string query,
@@ -56,16 +60,23 @@ namespace Tomboy
&& selected_notebook.ContainsNote (note) == false)
continue;
- // Check the note's raw XML for at least one
- // match, to avoid deserializing Buffers
- // unnecessarily.
- if (CheckNoteHasMatch (note,
+ // First check the note's title for a match,
+ // if there is no match check the note's raw
+ // XML for at least one match, to avoid
+ // deserializing Buffers unnecessarily.
+
+ if (0 < FindMatchCountInNote (note.Title,
+ words,
+ case_sensitive))
+ temp_matches.Add(note,int.MaxValue);
+ else if (CheckNoteHasMatch (note,
encoded_words,
case_sensitive)){
int match_count =
FindMatchCountInNote (note.TextContent,
words,
case_sensitive);
+
if (match_count > 0)
// TODO: Improve note.GetHashCode()
temp_matches.Add(note,match_count);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]