+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Blog Search

Blog Search

4 posts, 0 answered
  1. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    15 Jan 2011
    Link to this post
    Hi,
    I am trying to create a search functionality for blog and I want to search Author name and Date. Below I am using the code. It is working for title, content and category but not working for author name and date.

    IList getBlogs = listOfContentItems.Cast<IContent>().Where(p => p.GetMetaData("Title").ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.Content.ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.GetMetaData("Category").ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.GetMetaData("Publication_Date").ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.GetMetaData("Author").ToString().ToLower().Contains(Keyword.Text.ToLower())).ToList();
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Jan 2011
    Link to this post
    Hi Asif,

    The code looks file. The problem could be in the value you pass.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Asif
    Asif avatar
    110 posts
    Registered:
    18 Nov 2010
    18 Jan 2011
    Link to this post
    Hi Ivan,
    Please find the attached screen shot. If I use the Author name as search keyword then it doesnt show any result and if I search 2010 or any numeric in date then it shows me result but if I search "Wednesday" or "December" then it doesnt show any result. However I am using similar code for News and it is working for "Author" but not sure the problem with "Blog's Author". 

    For Blog which is not working for Author and not working for date if I search for alphabet character not numeric values
    IList getBlogs = listOfContentItems.Cast<IContent>().Where(p => p.GetMetaData("Title").ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.Content.ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.GetMetaData("Category").ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.GetMetaData("Publication_Date").ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.GetMetaData("Author").ToString().ToLower().Contains(Keyword.Text.ToLower())).ToList();

    For News, which is working fine with Author
    IList getNews = listOfContentItems.Cast<IContent>().Where(p => p.GetMetaData("Title").ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.Content.ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.GetMetaData("Category").ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.GetMetaData("Publication_Date").ToString().ToLower().Contains(Keyword.Text.ToLower()) || p.GetMetaData("Author").ToString().ToLower().Contains(Keyword.Text.ToLower())).ToList();
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Jan 2011
    Link to this post
    Hi Asif,

    Have you checked what is the value you get for "Publication_Date" when you execute the LINQ expression? Most probably it does not contain the name of the month or day.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered