Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. searching big text

searching big text

Scheduled Pinned Locked Moved LINQ
questioncsharphtmllinqcom
9 Posts 4 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    enginco
    wrote on last edited by
    #1

    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...

    L F J 3 Replies Last reply
    0
    • E enginco

      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...

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      someone on the C# forum knows a solution thanks to O'Reilly. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      Voting for dummies? No thanks. X|


      E 1 Reply Last reply
      0
      • L Luc Pattyn

        someone on the C# forum knows a solution thanks to O'Reilly. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        Voting for dummies? No thanks. X|


        E Offline
        E Offline
        enginco
        wrote on last edited by
        #3

        :) 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

        L 1 Reply Last reply
        0
        • E enginco

          :) 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

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          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|


          E 2 Replies Last reply
          0
          • L Luc Pattyn

            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|


            E Offline
            E Offline
            enginco
            wrote on last edited by
            #5

            Yes, everything is possible. but my problem is a little bit complicated. I don't have enough time to try something. I thought, when I try to solve this problem may be someone helps me. Maybe someone already did this. :)

            1 Reply Last reply
            0
            • L Luc Pattyn

              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|


              E Offline
              E Offline
              enginco
              wrote on last edited by
              #6

              ok, could you tell me how is my state of affairs? is O'reilly's code wrong way?

              L 1 Reply Last reply
              0
              • E enginco

                ok, could you tell me how is my state of affairs? is O'reilly's code wrong way?

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                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|


                1 Reply Last reply
                0
                • E enginco

                  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...

                  F Offline
                  F Offline
                  Fakher Halim
                  wrote on last edited by
                  #8

                  First you need to first split the forSearch into an Array using space as delimiter, then use LINQ to merge your sw1, sw2 as where clauses to filter out whatever is needed

                  Fakher Halim

                  1 Reply Last reply
                  0
                  • E enginco

                    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...

                    J Offline
                    J Offline
                    Judah Gabriel Himango
                    wrote on last edited by
                    #9

                    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?

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups