From e8f7e2baaf4c7516e9cb9fabd3dc2649326f0972 Mon Sep 17 00:00:00 2001 From: Chriztian Steinmeier Date: Tue, 18 Dec 2012 12:07:10 +0100 Subject: [PATCH 1/3] Fix for ordered lists not showing their numbrered markers in a comment --- OurUmbraco.Site/css/forum.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OurUmbraco.Site/css/forum.css b/OurUmbraco.Site/css/forum.css index 03029e35..7d2a2ff2 100644 --- a/OurUmbraco.Site/css/forum.css +++ b/OurUmbraco.Site/css/forum.css @@ -66,7 +66,8 @@ padding: 15px; text-align: left; padding-left: 60px } #forum ul.commentsList li .comment .body{font-size: 12px;} #forum ul.commentsList li .comment .body p{font-size: 12px; margin-top: 0px; margin-bottom: 15px;} -#forum ul.commentsList li .comment .body ul li{ display: list-item; list-style-type: disc; margin-top:.5em; margin-bottom:1em;} +#forum ul.commentsList li .comment .body li{display: list-item; margin-top:.5em; margin-bottom:1em;} +#forum ul.commentsList li .comment .body ul li {list-style-type: disc;} /* Solutions */ From 9b8bef8e011154d92cfb1a7cc0d7e0f1c366c223 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Tue, 18 Dec 2012 14:20:06 +0100 Subject: [PATCH 2/3] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0c29cfe6..4d498f0e 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,5 @@ And then each time you want to get the changes: *git fetch upstream* .. Yes, this is a scary command line operation, don't you love it?! :-D + +Any updates to the main repo (github.com/umbraco/OurUmbraco) get deployed automatically to http://our.sandbox.umbraco.org/ - So when your pull request gets accepted, your changes should show up there within a few minutes. From 65370d08ca24f093d924799b5b2ec745eac3d321 Mon Sep 17 00:00:00 2001 From: Niels Hartvig Date: Tue, 18 Dec 2012 14:40:43 +0100 Subject: [PATCH 3/3] Updates to the Search With support for AND/OR and less YSODs --- .../usercontrols/ExamineSearchResults.ascx.cs | 63 ++++++++++--------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/our.umbraco.org/usercontrols/ExamineSearchResults.ascx.cs b/our.umbraco.org/usercontrols/ExamineSearchResults.ascx.cs index 28df7c46..559b2a67 100644 --- a/our.umbraco.org/usercontrols/ExamineSearchResults.ascx.cs +++ b/our.umbraco.org/usercontrols/ExamineSearchResults.ascx.cs @@ -23,7 +23,7 @@ namespace our.usercontrols return HttpContext.Current.Server.HtmlEncode(result["Title"]); else return string.Empty; - + } public static string fullURL(this SearchResult result) @@ -67,7 +67,7 @@ namespace our.usercontrols } catch { } } - + text = umbraco.library.StripHtml(text); @@ -100,11 +100,11 @@ namespace our.usercontrols { cssClass = " forum "; - + SqlConnection cn = new SqlConnection(umbraco.GlobalSettings.DbDSN); cn.Open(); - SqlCommand cmd = new SqlCommand("Select answer from forumTopics where id = @id",cn); - cmd.Parameters.AddWithValue("@id",result.Id); + SqlCommand cmd = new SqlCommand("Select answer from forumTopics where id = @id", cn); + cmd.Parameters.AddWithValue("@id", result.Id); int solved = 0; try { @@ -113,24 +113,26 @@ namespace our.usercontrols catch { } cn.Close(); - if(solved != 0) + if (solved != 0) cssClass += "solution"; } - + return cssClass; } - public static string BuildExamineString(this string term, int boost, string field) + public static string BuildExamineString(this string term, int boost, string field, bool andSearch) { term = Lucene.Net.QueryParsers.QueryParser.Escape(term); var terms = term.Trim().Split(' '); var qs = field + ":"; qs += "\"" + term + "\"^" + (boost + 30000).ToString() + " "; qs += field + ":(+" + term.Replace(" ", " +") + ")^" + (boost + 5).ToString() + " "; - qs += field + ":(" + term + ")^" + boost.ToString() + " "; - return qs; + if (!andSearch) + { + qs += field + ":(" + term + ")^" + boost.ToString() + " "; + } return qs; } @@ -151,18 +153,19 @@ namespace our.usercontrols protected BaseSearchProvider Searcher; - + public ExamineSearchResults() { - searchTerm = string.Empty; - searchResults = new List(); + searchTerm = string.Empty; + searchResults = new List(); } protected void Page_Load(object sender, EventArgs e) { //Check we have a search term - searchTerm = Request.QueryString["q"].Trim(); + var orgSearchTerm = Request.QueryString["q"].Trim(); + searchTerm = orgSearchTerm.Replace(" OR ", " ").Replace(" or ", " "); if (string.IsNullOrEmpty(searchTerm) || searchTerm.Length == 1) { phNotValid.Visible = true; @@ -170,34 +173,38 @@ namespace our.usercontrols return; } - + Searcher = ExamineManager.Instance.SearchProviderCollection["MultiIndexSearcher"]; //Search Criteria for WIKI & Projects + bool andSearch = false; var searchCriteria = Searcher.CreateSearchCriteria(BooleanOperation.Or); + if (searchTerm.IndexOf("\"") == -1 && searchTerm.ToLower().IndexOf(" and ") > -1) + { + andSearch = true; + searchTerm = searchTerm.Replace(" and ", " ").Replace(" AND ", " "); + } - - - /*var searchFilter = searchCriteria.Field("a","b").Or().GroupedOr .GroupedOr(new string[] { "nodeName", "bodyText", "description", "Title", "Body", "CommentsContent" }, searchTerm) .Compile();*/ - - var searchQuery = searchTerm.BuildExamineString(10, "nodeName"); - searchQuery += searchTerm.BuildExamineString(8, "bodyText"); - searchQuery += searchTerm.BuildExamineString(9, "description"); - searchQuery += searchTerm.BuildExamineString(10, "Title"); - searchQuery += searchTerm.BuildExamineString(8, "Body"); - searchQuery += searchTerm.BuildExamineString(7, "CommentsContent").TrimEnd(' '); + + var searchQuery = searchTerm.BuildExamineString(10, "nodeName", andSearch); + searchQuery += searchTerm.BuildExamineString(8, "bodyText", andSearch); + searchQuery += searchTerm.BuildExamineString(9, "description", andSearch); + searchQuery += searchTerm.BuildExamineString(10, "Title", andSearch); + searchQuery += searchTerm.BuildExamineString(8, "Body", andSearch); + searchQuery += searchTerm.BuildExamineString(7, "CommentsContent", andSearch).TrimEnd(' '); var searchFilter = searchCriteria.RawQuery(searchQuery); searchResults = Searcher.Search(searchFilter).OrderByDescending(x => x.Score); - + // set the searchterm back for the results view + searchTerm = orgSearchTerm; //Get where to search (content) string searchWhere = Request.QueryString["content"]; @@ -241,7 +248,7 @@ namespace our.usercontrols int.TryParse(Request.QueryString["p"], out page); int ItemsPerPage = 20; - + //Bind repater to the list of results searchResultListing.DataSource = searchResults.Skip(page * ItemsPerPage).Take(ItemsPerPage); searchResultListing.DataBind(); @@ -275,6 +282,6 @@ namespace our.usercontrols } } - + } } \ No newline at end of file