From 26352fb745e8bed4e47aff57ceb019ae0699136c Mon Sep 17 00:00:00 2001 From: tmont Date: Mon, 28 Feb 2011 22:30:03 +0000 Subject: [PATCH] fixed bug in LuceneSearcher where it would generate a bad sql query --- Lib/Portoa.Lucene.dll | Bin 10240 -> 10240 bytes Lib/Portoa.Lucene.xml | 58 +++++++++--------- .../Configuration/EnableSearchWithLucene.cs | 8 +-- .../VideoGameQuotes.Web.csproj | 12 ++-- .../Views/Quote/Search.aspx | 9 ++- 5 files changed, 45 insertions(+), 42 deletions(-) diff --git a/Lib/Portoa.Lucene.dll b/Lib/Portoa.Lucene.dll index 236de4cedf9766c6b4782c05ce5dac1e62bc4276..e677f153ca667668653cfde2bb7668f956b68dbb 100644 GIT binary patch delta 4602 zcmZu#4RBP|6+Y+Qx9`1Ol67~J4N2I<4L`EUCMkhL3j`s`Ph&xdL6Bk%kpx5oPqWEb zjbRgDtUu5i*C{Gxiq-1SY8@MY0Xt|ZEuHC9bgXs;Q?1q+b&6W8%&4XP?s*H1PIuYw zp1*tUx#ym9-wQ)4hF08lo1T~K8M(89Pmb(g&G+V*rw2;s6D4w0sy4TVr}L+|Va`Th zg3Nrrg`c7TP0dBso<);pSad%mnkY&-RZ0{pIn6~@)T#?oiiy&N>8)1DY5eo06R8){ z>#d#Bh`4tm$V_>zKqs=3FjZ+Ufx)W)gjA{$!^F(FzzO8omX`!IPz5MZuH#JxQ8*SN z$D0C*=mZ68;4@;v%TW0)BO@xB!Bl|J@&lX-(@>i1nypG(DZ~IH6&O5^vRJ)$H^NCx z7h#Q=I3Yh#4W!P@o2>MpVQMN>DrUx_8H#4WE`SBpKs7{q0C9x8G(Zj10#kK{uQ%`w z!@}GT!py}s$VQyeOoI{I%A1LiY&|e5S8tVM2cUQ0JJSSlfolz#C0sRV9FulW+vkJG zTmVQZq&sA%a29Dffe@AKa)~Atrst}G^I&0nbAS^Zy>%|ex}xIKb~A{~Jiw3Q!{CXrrWV)q&`Y2wHUJAy*L(c2`B{Mq5eW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d-pw^Bc6gBalhw?J3A+@ zLrz|YoV*S>;{M-4$K0_dCylzEK6M++CZcdVBs^6);`zCa@RO{WHc~WvuGy|;hUc5R z)WYyFNR|s;1qzghXjuc4jR@zDtJineZg+ESY4;yR-dW)dZqqITPAEgv%nP07ITL&JpUm~ zC*jL?C-7%_7x1`t713v=0%%z^O5-bqzhKx>%Lpnw#UapftP0;0jFp%djp1ah!gH*s z8W@2#NokrwkE_qs6um%Sr@yE7=#*(Pv&`7bOwm{+ek?|R+WjT*Md5Y)a{{g{|FL*$ zT{~@2i|BQ=k#=IF-qKsazevv*gAgJAAMr{4wnVaiX`ydZVNLVG&As^zc?y=E{F=Vr z>+^l9Tm2b{i~I)@xBKbp%=kdryg0w9xqHLf{H?S+-**$u&u{8p%hX7Pw?mEmwX#v! z{e{hay?K90^}dm4%{-l&9eA93?KRi5P=9ZsFW*(@r3*K2=v{rbKO;HWZWXEDT{}3r zdr9Bgd|!U;1sgWslR zDpicCO0uiHM6guxl2%@Iup}$VNo(cRc^NBBUR@}yz%ZE+G80SdYHyON_NHQE%uS?q zT|l$cYw}vHw2H-y?bYEgV`brkA>$xqJGN95(?;BvS>`&bJr^o(4#(+`I2~@90%;f- z1QcuMh<1)ilM;(b*vBG4T}cSq!J*h6=s6s_!_Ag`F;|>ZnYKp74DztJ!H~L&F=%#~ z*vh19Ia~lhCPXUgHHG25v`c$UQEf+!qoNim9Sg_N&Zs~=xsh^lY#c3?ig9sE!&p$& zj1H%Z+ABQ?iEG()UXy#;SqS=6Z8EM=-qK$93A~BAp6XR7!XcAR2wS~YvGJO|x(SUe zPbI)kitF%rM6v|d)2Pw`&WLDX-`Portoa.Lucene - - - Handles interaction between objects and Lucene documents - - - - - - Builds a out of another object - - The object from which to build the document - - - - Gets a term representing the identifying in a - . This can be used as a means - to delete documents using an , for example. - - The object from which to create the term - - - - implementation for entities based on Lucene.NET - - implementation based on Lucene.NET - + Transforms the results of a search into a proper result set @@ -57,11 +32,10 @@ Gets the index directory associated with this searcher - + - implementation for entities based on Lucene.NET + implementation for entities based on Lucene.NET - The entity to build the index for @@ -99,5 +73,31 @@ Application logger + + + implementation for entities based on Lucene.NET + + The entity to build the index for + + + + Handles interaction between objects and Lucene documents + + + + + + Builds a out of another object + + The object from which to build the document + + + + Gets a term representing the identifying in a + . This can be used as a means + to delete documents using an , for example. + + The object from which to create the term + diff --git a/Src/VideoGameQuotes.Web/Configuration/EnableSearchWithLucene.cs b/Src/VideoGameQuotes.Web/Configuration/EnableSearchWithLucene.cs index f5f7dc0..1483afb 100644 --- a/Src/VideoGameQuotes.Web/Configuration/EnableSearchWithLucene.cs +++ b/Src/VideoGameQuotes.Web/Configuration/EnableSearchWithLucene.cs @@ -20,6 +20,7 @@ using Directory = Lucene.Net.Store.Directory; using Version = Lucene.Net.Util.Version; namespace VideoGameQuotes.Web.Configuration { + public class EnableSearchWithLucene : UnityContainerExtension { protected override void Initialize() { var indexWriterLifetimeManager = new ExplicitlyDisposableLifetimeManager( @@ -56,12 +57,7 @@ namespace VideoGameQuotes.Web.Configuration { } private static IndexWriter CreateIndexWriter(IUnityContainer container) { - return new IndexWriter( - container.Resolve(), - new StandardAnalyzer(Version.LUCENE_29), - true, - IndexWriter.MaxFieldLength.UNLIMITED - ); + return new IndexWriter(container.Resolve(), container.Resolve(), true, IndexWriter.MaxFieldLength.UNLIMITED); } #endregion diff --git a/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj b/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj index e073cfb..124f139 100644 --- a/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj +++ b/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj @@ -33,7 +33,9 @@ 4 - + + ..\..\Lib\Lucene.Net.dll + ..\..\Lib\Microsoft.Practices.Unity.dll @@ -49,7 +51,9 @@ ..\..\Lib\Portoa.Log4Net.dll - + + ..\..\Lib\Portoa.Lucene.dll + False ..\..\Lib\Portoa.NHibernate.dll @@ -208,9 +212,7 @@ - - - + {329FAB1F-A18D-4B7B-9E3C-A0C157E55503} diff --git a/Src/VideoGameQuotes.Web/Views/Quote/Search.aspx b/Src/VideoGameQuotes.Web/Views/Quote/Search.aspx index 8f16979..d7506a4 100644 --- a/Src/VideoGameQuotes.Web/Views/Quote/Search.aspx +++ b/Src/VideoGameQuotes.Web/Views/Quote/Search.aspx @@ -6,9 +6,14 @@ Search results for: <%: Model.SearchQuery %>

- <% +<% + if (Model.Results.Any()) { foreach (var result in Model.Results) { Html.RenderPartial("SingleQuote", new QuoteModel { Quote = result.Record, User = Model.User }); } - %> + } else { %> +

+ Nothing turned up. You suck at searching for things and you’re ugly. +

+ <% } %> \ No newline at end of file