Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search in blog content #300

Open
Anduin2017 opened this issue Dec 6, 2019 · 13 comments
Open

Search in blog content #300

Anduin2017 opened this issue Dec 6, 2019 · 13 comments

Comments

@Anduin2017
Copy link
Collaborator

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to edi.wang
  2. Click on search
  3. See error

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):

  • OS: [e.g. Windows 10]
  • Browser [e.g. Chrome]
  • Version [e.g. 70]

Additional context

I can't get the search result if the title do not contains my search content.

@EdiWang
Copy link
Owner

EdiWang commented Dec 7, 2019

This could be done via Azure Cognitive Search, but it will make the blog system couple with Azure again.

@Anduin2017
Copy link
Collaborator Author

Anduin2017 commented Dec 7, 2019

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)
}

@EdiWang
Copy link
Owner

EdiWang commented Dec 7, 2019

@Anduin2017 good idea, hate Azure and search 996!

@hez2010
Copy link

hez2010 commented May 18, 2020

Since you're using SQL Server for database, why not use its integrated full-text search service?

@EdiWang
Copy link
Owner

EdiWang commented May 19, 2020

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.

@EdiWang
Copy link
Owner

EdiWang commented May 25, 2020

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.

@EdiWang EdiWang self-assigned this May 25, 2020
@EdiWang EdiWang removed the research label May 25, 2020
@EdiWang
Copy link
Owner

EdiWang commented May 25, 2020

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"')

@manaatmoon
Copy link

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.

@EdiWang EdiWang mentioned this issue Jul 1, 2020
@misaya
Copy link

misaya commented Jan 15, 2021

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.

@Anduin2017
Copy link
Collaborator Author

Any plan for this feature?

@Anduin2017
Copy link
Collaborator Author

Any update on this? @EdiWang

@EdiWang
Copy link
Owner

EdiWang commented Jul 21, 2022

Hi @Anduin2017 this feature may come when UWP is revived

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants