I have a problem with creating search functionality, I read a lot of stuff but I cannot do it. I would like to keep it simple.. I think that with elasticsearch will be good, because If possible I would like searching by tags also. It is a big project about social ads/like services, selling items/..
namespace Model
{
public class Ad : Post
{
//public Price Price = new Price();
public ISet Categories { get; set; }
public string Title { get; set; }
public DateTime ExpDate { get; set; }
public int Views { get; set; }
}
}
//i would like to use the title for searching
namespace Model
{
public class Post
{
public string Id { get; set; }
public string Content { get; set; }
public string ImageSource { get; set; }
public DateTime DatePosted { get; set; }
public DateTime LastEdited { get; set; }
}
}
//I would like to use content from hereThank you in advance.
I tought that I should do it like this
Afzaal Ahmad ZeeshanPosted Nov 24, 2017, 5:03 AM
Rethink the ways to search in the database, rather than doing it in the .NET framework code. If you are storing in a database engine, such as SQL Server, then a simple command for LIKE "%query" would be better solution, compared to doing a LINQ. You need to explain a bit more, so that we can dig deeper into it.
Lastly, the Title and Content fields are string, thus meaning you would need a different indexing mechanism. Title and Content can (and should!) only be searched via a LIKE query to determine whether the content is there or not.
You can implement the logic in any of the provided database engines, just check against their documentation to find the solutions.