OK. Maybe I understood you wrong. Here's what I think you need to acomplish => correct me if I'm wrong. So, you need to get like all the data about books based on the book keywords/tags and the keywords introduced by user. If that's what you need then this is a working solution: (feel free to create a new windows app, add 2 buttons and paste the code to check):
/// <summary>
/// check if contains any keywords
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnContainsAny_Click(object sender, EventArgs e)
{
string tags = "science fiction futurist 1024 cores 25 GHz";
string user = "fiction core";
if (MyContainsAny(tags, user))
{
string message =
String.Format("At least one keyword form \"{0}\" was found in \r\n" +
"\"{1}\"", user, tags);
MessageBox.Show(message);
}
}
/// <summary>
/// check if contains all keywords
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnContainsAll\_Click(object sender, EventArgs e)
{
string tags = "science fiction futurist 1024 cores 25 GHz";
string user = "fiction core";
if (MyContainsAll(tags, user))
{
string message =
String.Format("All the keywords form \\"{0}\\" were found in \\r\\n" +
"\\"{1}\\"", user, tags);
MessageBox.Show(message);//as you can see it finds core in cores
}
}
/// <summary>
/// used to see if the tag contains ANY of the keywords introduced by user
/// </summary>
/// <param name="tag"></param>
/// <param name="userData"></param>
/// <returns></returns>
private bool MyContainsAny(string tag, string userData)
{
string\[\] words = userData.Trim().Split(" ");
foreach (var item in words)
{
if (tag.Contains(item)) { return true; }
}
return false;
}
/// <summary>
/// used to see if the tag contains ALL of the keywords introduced by user
/// </