searching big text
-
http://www.albahari.com/nutshell/predicatebuilder.html I found a link about expressions. Can someone explain that how can I use? Is it helpfully? or are there any idea for my problem with LINQ and expressions? (please don't say REGEX) [Smile] I have a class like this:
public class SearchWord
{
...
public string Search_key { get; set; }
public string And_key { get; set; }
public string Not_key { get; set; }
...
...
}and my search words: SearchWord sw1 = {Search_key = "test", And_key = "", Not_key = ""}; SearchWord sw2 = {Search_key = "test", And_key = "email", Not_key = ""}; SearchWord sw3 = {Search_key = "test", And_key = "email", Not_key = "engin"}; I have a big text: string forSearch = "test hkkdkh yrfjkdh ggshdj bla bla bla email bla bla sdkj engin hskhj............" I want to search the keywords in a big text. for sw1 (return) for sw2 (return) for sw3 (not return) i don't want to use regex. is this possible with LINQ and generic delegates? and how? thanx...
-
http://www.albahari.com/nutshell/predicatebuilder.html I found a link about expressions. Can someone explain that how can I use? Is it helpfully? or are there any idea for my problem with LINQ and expressions? (please don't say REGEX) [Smile] I have a class like this:
public class SearchWord
{
...
public string Search_key { get; set; }
public string And_key { get; set; }
public string Not_key { get; set; }
...
...
}and my search words: SearchWord sw1 = {Search_key = "test", And_key = "", Not_key = ""}; SearchWord sw2 = {Search_key = "test", And_key = "email", Not_key = ""}; SearchWord sw3 = {Search_key = "test", And_key = "email", Not_key = "engin"}; I have a big text: string forSearch = "test hkkdkh yrfjkdh ggshdj bla bla bla email bla bla sdkj engin hskhj............" I want to search the keywords in a big text. for sw1 (return) for sw2 (return) for sw3 (not return) i don't want to use regex. is this possible with LINQ and generic delegates? and how? thanx...
someone on the C# forum knows a solution thanks to O'Reilly. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Voting for dummies? No thanks. X|
-
someone on the C# forum knows a solution thanks to O'Reilly. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Voting for dummies? No thanks. X|
-
:) yes but i'm confused. something is wrong, o'reilly's code is inverted what I need. :):) why I posted cross? because I realized lately what this is true board :) I'm waiting for your helps
Hi, if you understand the code you got so far, it should be doable to modify it a bit to remedy the problem, shouldn't it? :)
Luc Pattyn [Forum Guidelines] [My Articles]
Voting for dummies? No thanks. X|
-
Hi, if you understand the code you got so far, it should be doable to modify it a bit to remedy the problem, shouldn't it? :)
Luc Pattyn [Forum Guidelines] [My Articles]
Voting for dummies? No thanks. X|
-
Hi, if you understand the code you got so far, it should be doable to modify it a bit to remedy the problem, shouldn't it? :)
Luc Pattyn [Forum Guidelines] [My Articles]
Voting for dummies? No thanks. X|
-
Sorry I can't help you. I am not familiar with LINQ and I don't know what is in the O'Reilly book you refer to. Hope some one will be able to help. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Voting for dummies? No thanks. X|
-
http://www.albahari.com/nutshell/predicatebuilder.html I found a link about expressions. Can someone explain that how can I use? Is it helpfully? or are there any idea for my problem with LINQ and expressions? (please don't say REGEX) [Smile] I have a class like this:
public class SearchWord
{
...
public string Search_key { get; set; }
public string And_key { get; set; }
public string Not_key { get; set; }
...
...
}and my search words: SearchWord sw1 = {Search_key = "test", And_key = "", Not_key = ""}; SearchWord sw2 = {Search_key = "test", And_key = "email", Not_key = ""}; SearchWord sw3 = {Search_key = "test", And_key = "email", Not_key = "engin"}; I have a big text: string forSearch = "test hkkdkh yrfjkdh ggshdj bla bla bla email bla bla sdkj engin hskhj............" I want to search the keywords in a big text. for sw1 (return) for sw2 (return) for sw3 (not return) i don't want to use regex. is this possible with LINQ and generic delegates? and how? thanx...
First you need to first split the forSearch into an Array using space as delimiter, then use LINQ to merge your
sw1
,sw2
aswhere
clauses to filter out whatever is neededFakher Halim
-
http://www.albahari.com/nutshell/predicatebuilder.html I found a link about expressions. Can someone explain that how can I use? Is it helpfully? or are there any idea for my problem with LINQ and expressions? (please don't say REGEX) [Smile] I have a class like this:
public class SearchWord
{
...
public string Search_key { get; set; }
public string And_key { get; set; }
public string Not_key { get; set; }
...
...
}and my search words: SearchWord sw1 = {Search_key = "test", And_key = "", Not_key = ""}; SearchWord sw2 = {Search_key = "test", And_key = "email", Not_key = ""}; SearchWord sw3 = {Search_key = "test", And_key = "email", Not_key = "engin"}; I have a big text: string forSearch = "test hkkdkh yrfjkdh ggshdj bla bla bla email bla bla sdkj engin hskhj............" I want to search the keywords in a big text. for sw1 (return) for sw2 (return) for sw3 (not return) i don't want to use regex. is this possible with LINQ and generic delegates? and how? thanx...
You can do searching over big strings using LINQ, yes, since a string could be broken up into a collection of words, and LINQ works on collections of any type. However, if you have a lot of big strings, your search might take awhile. Here at work we use the free and open source Lucene.NET to index and search our big texts. With Lucene.NET, you can do queries over your text using AND, OR, wildcard, etc. operators, and it all performs very, very quickly. Does that answer your question? I guess I'm not sure what your question is, exactly. Maybe you want to build an expression out of your SearchWord elements and use the resulting expression as the predicate criteria over your string - is that what you want to do?