Open Anduin2017 opened 4 years ago
This could be done via Azure Cognitive Search, but it will make the blog system couple with Azure again.
You shall make this feature an abstract: ISearchEngine.
And first implement it with Azure Cognitive Search. If the user hates Azure, you can provider another option to search in database.
public interface ISearchEngine
{
List<Blog> Search(string input)
}
@Anduin2017 good idea, hate Azure and search 996!
Since you're using SQL Server for database, why not use its integrated full-text search service?
Hi @hez2010 full-text search is perfect for searching blog content, but I can't use it because full-text search will require extra installation and configuration for SQL Server, not every user of Moonglade has the administrative permission to modify their SQL Server deployment. Especially for users on non-Azure clouds, or even using classic SQL Server services by many Chinese ISPs, they don't have full-text search enabled.
I don't want to roughly implement the content search by "LIKE %XXXX%", the closest I can think of is to "LIKE %XXXX%" the post content abstract (initial 400 words) instead of full post content. But it isn't perfect as well.
I am now thinking about enabling full-text search as a switch in system settings, turned off by default, so that users with full-text search support on their SQL Server can turn on this switch to allow Moonglade search content in blog posts.
To enable full-text search:
CREATE FULLTEXT CATALOG MoongladeFTCat AS default
GO
DROP FULLTEXT INDEX ON Post
GO
CREATE FULLTEXT INDEX ON Post(PostContent)
KEY INDEX PK_Post
WITH CHANGE_TRACKING AUTO
GO
Test full-text search
SELECT Id, Title, ContentAbstract
FROM Post
WHERE CONTAINS(PostContent, '"ASP.NET Core"')
I just successfully deploy your code onto my own azure web app service https://manaatmoonblog.azurewebsites.net/. Since i don't know if there is any legal requirement, so please let me know if i need to obey any rules.
You shall make this feature an abstract: ISearchEngine.
And first implement it with Azure Cognitive Search. If the user hates Azure, you can provider another option to search in database.
public interface ISearchEngine { List<Blog> Search(string input) }
If Users hate Azure,let he/she go away.
Any plan for this feature?
Any update on this? @EdiWang
Hi @Anduin2017 this feature may come when UWP is revived
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
I can search the content in any blog.
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Additional context
I can't get the search result if the title do not contains my search content.