diff --git a/Blog/bin/Blog.dll b/Blog/bin/Blog.dll index fea599a..2803610 100644 Binary files a/Blog/bin/Blog.dll and b/Blog/bin/Blog.dll differ diff --git a/Blog/bin/Blog.pdb b/Blog/bin/Blog.pdb index c18a06a..a5beac9 100644 Binary files a/Blog/bin/Blog.pdb and b/Blog/bin/Blog.pdb differ diff --git a/Blog/bin/Umbraco.Examine.Linq.dll b/Blog/bin/Umbraco.Examine.Linq.dll index ea895a1..c4c093d 100644 Binary files a/Blog/bin/Umbraco.Examine.Linq.dll and b/Blog/bin/Umbraco.Examine.Linq.dll differ diff --git a/Blog/bin/Umbraco.Examine.Linq.pdb b/Blog/bin/Umbraco.Examine.Linq.pdb index b780f1b..c5f3621 100644 Binary files a/Blog/bin/Umbraco.Examine.Linq.pdb and b/Blog/bin/Umbraco.Examine.Linq.pdb differ diff --git a/Blog/obj/Debug/Blog.csprojResolveAssemblyReference.cache b/Blog/obj/Debug/Blog.csprojResolveAssemblyReference.cache index 2ac13ba..0b047ed 100644 Binary files a/Blog/obj/Debug/Blog.csprojResolveAssemblyReference.cache and b/Blog/obj/Debug/Blog.csprojResolveAssemblyReference.cache differ diff --git a/Blog/obj/Debug/Blog.dll b/Blog/obj/Debug/Blog.dll index fea599a..2803610 100644 Binary files a/Blog/obj/Debug/Blog.dll and b/Blog/obj/Debug/Blog.dll differ diff --git a/Blog/obj/Debug/Blog.pdb b/Blog/obj/Debug/Blog.pdb index c18a06a..a5beac9 100644 Binary files a/Blog/obj/Debug/Blog.pdb and b/Blog/obj/Debug/Blog.pdb differ diff --git a/LINQToExamine.1.3.nupkg b/LINQToExamine.1.3.nupkg new file mode 100644 index 0000000..3f01376 Binary files /dev/null and b/LINQToExamine.1.3.nupkg differ diff --git a/LINQToExamine.1.4.nupkg b/LINQToExamine.1.4.nupkg new file mode 100644 index 0000000..41b39e8 Binary files /dev/null and b/LINQToExamine.1.4.nupkg differ diff --git a/LINQToExamine.nuspec b/LINQToExamine.nuspec index 66f234b..98b18ef 100644 --- a/LINQToExamine.nuspec +++ b/LINQToExamine.nuspec @@ -3,7 +3,7 @@ LINQToExamine Linq To Examine for Umbraco - 1.2 + 1.4 Craig Noble This project allows you to query the Lucene indexes using LINQ based on your own classes. en-US diff --git a/Umbraco.Examine.Linq.Sandbox/App_Data/Umbraco.sdf b/Umbraco.Examine.Linq.Sandbox/App_Data/Umbraco.sdf index 348d908..9a40e1d 100644 Binary files a/Umbraco.Examine.Linq.Sandbox/App_Data/Umbraco.sdf and b/Umbraco.Examine.Linq.Sandbox/App_Data/Umbraco.sdf differ diff --git a/Umbraco.Examine.Linq.Sandbox/Views/BlogOverview.cshtml b/Umbraco.Examine.Linq.Sandbox/Views/BlogOverview.cshtml index 7264b99..f8fde8c 100644 --- a/Umbraco.Examine.Linq.Sandbox/Views/BlogOverview.cshtml +++ b/Umbraco.Examine.Linq.Sandbox/Views/BlogOverview.cshtml @@ -7,17 +7,48 @@ @{ Layout = "Master.cshtml"; + var searcher = new Searcher(); + var CurrentPage = (Umbraco.Core.Models.IPublishedContent)base.CurrentPage; - var results = new Umbraco.Examine.Linq.Index(new Umbraco.Examine.Linq.Sandbox.Mapper.ConcreteMapper()) - .Where(c => c.CreateDate < DateTime.Now); + var results = new Umbraco.Examine.Linq.Index(searcher, new Umbraco.Examine.Linq.Sandbox.Mapper.ConcreteMapper()) + .Where(c => c.Name.Contains("tall").Fuzzy(0.5) || c.Name.Contains("f*").Boost(10)); + results = results.Where(c => c.CreateDate > DateTime.Now.AddYears(-2) && c.CreateDate < DateTime.Now); + + results = results.ToList().AsQueryable(); + + +} + +@functions { + public class Searcher : Umbraco.Examine.Linq.ISearcher + { + public string Query { get; set; } + + public IEnumerable Search(string query) + { + Query = query; + try + { + return new Umbraco.Examine.Linq.SearchProviders.LuceneSearch("ExternalSearcher").Search(query); + } + catch (Exception) + { + Query = "invalid : " + query; + } + + return new List(); + } + } }
- +
+

@searcher.Query

+
@*foreach (var post in new UmbracoNS.Examine.Linq.Sandbox.Repositories.BlogRepository().GetAllBlogPosts())*@ @foreach (var post in results) diff --git a/Umbraco.Examine.Linq/ExpressionTreeVisitor.cs b/Umbraco.Examine.Linq/ExpressionTreeVisitor.cs index 3cb8b53..50c5603 100644 --- a/Umbraco.Examine.Linq/ExpressionTreeVisitor.cs +++ b/Umbraco.Examine.Linq/ExpressionTreeVisitor.cs @@ -359,7 +359,8 @@ protected override Expression VisitMethodCallExpression(MethodCallExpression exp bracketsEnabled = false; VisitExpression(expression.Arguments[0]); VisitExpression(expression.Object); - //addEndBracket(); + if((expression.Arguments[0] is BinaryExpression) && expression.Arguments[0].GetType().FullName != "System.Linq.Expressions.LogicalBinaryExpression") + addEndBracket(); currentPart.AppendFormat("^{0}", expression.Arguments[1]); bracketsEnabled = false; break; @@ -369,6 +370,8 @@ protected override Expression VisitMethodCallExpression(MethodCallExpression exp if (expression.Arguments.Any()) VisitExpression(expression.Arguments[0]); VisitExpression(expression.Object); + if (expression.Arguments[0] is BinaryExpression) + addEndBracket(); fuzzy = 0; bracketsEnabled = false; break;