tag:blogger.com,1999:blog-8340788719090141711.post1028515590221429776..comments2023-09-26T16:29:36.757+02:00Comments on Manfred's Blog: Full text search for Entity FrameworkAnonymoushttp://www.blogger.com/profile/14884047895668798987noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-8340788719090141711.post-61675199441670890002016-05-16T12:47:14.497+02:002016-05-16T12:47:14.497+02:00Thank you very much. Exactly what I was looking fo...Thank you very much. Exactly what I was looking for! For small data sets, this solution is great. Btw. DevExpress does exactly the same with their ORM (XPO) within their RAD Framework (XAF).Samuelhttps://www.blogger.com/profile/13930962805313069252noreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-22755048660755025992014-05-23T13:13:28.847+02:002014-05-23T13:13:28.847+02:00Greate article man. It is really helpful. This is ...Greate article man. It is really helpful. This is what I was looking for.Nikolay Angelovhttps://www.blogger.com/profile/10303845761844954518noreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-22460179518354927892013-08-24T13:03:34.580+02:002013-08-24T13:03:34.580+02:00@Anonymous
If you'll combine all properties w...@Anonymous <br />If you'll combine all properties with an AND clause, you can use<br />Expression.And instead Expression.OR.<br /><br />But when you combine your searchstrings with AND you should compare the currently searchkey with the first entry of searchkeys. The first will be combined with OR, and the next strings with AND. like this:<br /><br />orExpressions = searchKeyPart == searchKeyParts[0] ? Expression.Or(orExpressions, callContainsMethod) : Expression.And(orExpressions, callContainsMethod);<br /><br />I hope I was of help to you<br /><br /><br />Mario Binderhttp://www.biggle.denoreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-54387484530560799822013-07-19T17:33:27.187+02:002013-07-19T17:33:27.187+02:00how do you get this to do "and" instead ...how do you get this to do "and" instead of or???Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-69236978961524711042013-07-13T00:01:29.809+02:002013-07-13T00:01:29.809+02:00Works great with one word entered in search box bu...Works great with one word entered in search box but I can't seem to get it to search properly with more than one word. The "exactmatch" bool is incorrectly returning true. Any ideas how to fix this?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-23786738246451665272013-07-02T15:52:08.614+02:002013-07-02T15:52:08.614+02:00I liked and used your search extension several tim...I liked and used your search extension several times. I ended up also needing access to FreeText and Contains methods in EF and ended up building this http://www.balsamicsolutions.com/Blog/Post/2/Full-text-search-in-Microsoft%27s-Entity-FrameworkRobert Ginsburgnoreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-5391051606827061142011-02-04T20:47:14.900+01:002011-02-04T20:47:14.900+01:00Great Job....Great Job....Shabirhttps://www.blogger.com/profile/16575143497916170431noreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-63519009175168252962011-01-20T12:29:16.035+01:002011-01-20T12:29:16.035+01:00Went like a charm..Exactly what I was looking for....Went like a charm..Exactly what I was looking for..Kewl Work...Md. Rezoanul Alamhttps://www.blogger.com/profile/16968010020977638420noreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-2306399248426647622010-08-14T07:48:48.568+02:002010-08-14T07:48:48.568+02:00Manfred,
I think, Anonymous on December 16, 2009 ...Manfred,<br /><br />I think, Anonymous on December 16, 2009 meant FREETEXT(col_name, "value")<br /><br />Correct me if I am wrong, but I don't think you are leveraging full-text search capabilities of SQL Server 2008. When working with EF1 we resorted to regular ADO.NET SqlDataReader in order to invoke full-text search queries; I was hoping that we can use EF4 facilities to "pass-through" sql statement to the database...Anonymoushttps://www.blogger.com/profile/09056314350609674162noreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-14078411158696608202010-01-05T09:10:49.490+01:002010-01-05T09:10:49.490+01:00Hi vslee,
well the big problem is, that (as far as...Hi vslee,<br />well the big problem is, that (as far as I know) SQL does not support to search for parts of integers (contains) and therefore LINQ also doesn't support it. My code creates "only" a LINQ statement which is then translated by the .NET Framework to SQL and executed. So you have no influence on how it is translated or which statements ist supports. However you could have a look at http://manfred-ramoser.blogspot.com/2009/08/linq-expression-trees-and-ormapper.html. With that code you can "easily" influence how linq statements are converted to SQL. Maybe you could use something like: <br />SELECT * FROM yourTable<br />WHERE CAST(intField AS NVARCHAR) LIKE '%6%'Anonymoushttps://www.blogger.com/profile/14884047895668798987noreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-88768832113935852632010-01-05T07:21:01.359+01:002010-01-05T07:21:01.359+01:00how about searching through integer fields (or oth...how about searching through integer fields (or other non-string fields)? When I try doing .ToString().Contains() it throws an error. Any ideas?vsleehttps://www.blogger.com/profile/04508810408180323635noreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-90490683554719865532009-12-16T21:16:17.821+01:002009-12-16T21:16:17.821+01:00Hi Anonymous,
thanks for the warning; but I know t...Hi Anonymous,<br />thanks for the warning; but I know that this is not a real full text search and as described above I know also that the performance is not the best one. But this is, as far as I know, the only solution for a, let's call it extended search, for the entity framework. If You have a better solution to perform this task, please share Your knowledge with us.<br /><br />What exactly do You mean with "SQL's native fulltext search"?Anonymoushttps://www.blogger.com/profile/14884047895668798987noreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-7794081302752711392009-12-16T03:14:32.000+01:002009-12-16T03:14:32.000+01:00Just a warning that, as Peter notes, this is not f...Just a warning that, as Peter notes, this is not full text search and can have a severe impact on the performance of your app.<br />For production, I'd suggest making use of a stored procedure to get access to SQL's native full text search...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-51536481879058415662009-10-05T18:43:49.040+02:002009-10-05T18:43:49.040+02:00Hello Peter,
thanks :-)
I did not check how the p...Hello Peter,<br />thanks :-)<br /><br />I did not check how the performance of this approach is. I tested it only on some data and it was fast enough for my needs. I would have to test it on a very large amount of data; which I will do as soon as I have some time...<br /><br />Well, I think that the fulltext search which is provided by SQL Server should be much faster und offers also more features such as finding similar words.<br />The only problem with that is that it is not supported by the ADO.Net Entity Framework (LINQ to Objects) because not all DBMS systems offer a fulltext search feature and to be compatible also with them the EF uses only standard SQL.<br /><br />Yes, LINQ to SQL may offer it since it works "only" with SQL Server and can therefore get all the power and features out of it :-)<br /><br />Initially it was a little bit challenging to understand how Expressions and Expressiontrees work. The problem was to understand how the different types of expressions work and how the they are combined and evaluated; because this is not always easy and obvious to understand.<br />For example Method-Variables which are passed to an Expression Tree are not there as values but they are a field of the class in which the method is and if you want the value then you have to get the value of that field.<br />I found it also easier to evaluate an existing expression tree (see my last post about ORMapper) than creating my own Expression tree.Anonymoushttps://www.blogger.com/profile/14884047895668798987noreply@blogger.comtag:blogger.com,1999:blog-8340788719090141711.post-8761750434321480962009-10-03T07:41:33.005+02:002009-10-03T07:41:33.005+02:00Nice work!
But what about the performance of doing...Nice work!<br />But what about the performance of doing this kind of full text search.<br /><br />I used "full text search" feature of SQL Server in LINQ using this blog post<br />http://sqlblogcasts.com/blogs/simons/archive/2008/12/18/LINQ-to-SQL---Enabling-Fulltext-searching.aspx<br />Fast and easy<br /><br />Anyway, how did you find it to work with Expressions?Peter Gfaderhttps://www.blogger.com/profile/07780415437484280285noreply@blogger.com