search a list in c# and convert to dictionary

search a list in c# and convert to dictionary

Page 1 of 1

1 Replies - 2828 Views - Last Post: 08 June 2009 - 07:11 PM Rate Topic: -----

#1 itwoman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-June 09

search a list in c# and convert to dictionary

Posted 08 June 2009 - 03:18 PM

Hi,

I am developing a code to search book database and get a list of books.

after that I search that book list to get a sub set of books based on "keyword search"

I am using a dictionary for the same, indexing on the keyword and then searching with the keyword as the key. My concern is how do I avoid or ignore certain words like "and", "or", "an", "to" etc. in the search as these are irrelevant words.

I think we need to use regular expressions but i have no idea how to write them.

can some one give an idea about the same

Is This A Good Question/Topic? 0
  • +

Replies To: search a list in c# and convert to dictionary

#2 SwiftStriker00  Icon User is offline

  • No idea why my code works
  • member icon

Reputation: 433
  • View blog
  • Posts: 1,596
  • Joined: 25-December 08

Re: search a list in c# and convert to dictionary

Posted 08 June 2009 - 07:11 PM

well you can just remove those keywords before
string sample = "I get help at DIC.";
string result = sample.Replace("get", "need"); 

//or in your case:

string keywordstring = "the lion the witch and the wardrobe";
string newkeyword = keywordstring.Replace("and", "");
newkeyword = newkeyword.Replace("the", "");




or you can use RegEx. When exactly are you looking into removing these "useless" keywords?

This post has been edited by SwiftStriker00: 08 June 2009 - 07:12 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1