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

Searchable blog posts #235

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Conversation

abjerner
Copy link
Contributor

Implements parts of #222


There is a lot of good blog posts out there about Umbraco, so instead of just showing the most recent blog posts, this pull request introduces a searchable archive of blog posts. This means that:

  • Blog posts are now stored in the CommunityBlogItems database table as well as added to examine via a custom BlogItemsIndexSet index set. This is all handled within the existing Hangfire job.

  • The MultiIndexSearcher searcher used in the global search now also searches BlogItemsIndexSet. Because of this, blog posts can now be found in the global search - eg. my blog post about extracting high contrast colors.

    image

  • A search result for a blog post is rendered by the ~/Views/Partials/Search/BlogItem.cshtml partial view with a model of the type BlogItemSearchResult.

Fallpits

  • To keep track of which RSS posts that already have been added to the archive, the update logic pulls all existing posts from the database. This may become a lot of posts over time. My local DB currently has 1417 posts in it's archive 😮

  • Showing external content in the global search (and probably anywhere else on Our) might be an issue, as it isn't clear that the link will take the user away from Our. The link for a blog posts does open in a new window, but perhaps there should be a confirmation prompt to leave Our. Or just an icon indicating that the link opens in a new tab. But whether this is actually a problem depends on the HQ's stance on external links - I just thought I'd make sure to mention it ;)

Possible further improvements

  • A JSON file is still kept with the most recent blog posts. As they are also stored in Examine, we could drop the JSON file in favor of an Examine search.

  • As we can search the archive, we can also search for blog posts of a specific blog. So we could add the various blogs to the sidebar so a user can choose to see the blog posts of a single blog.

    imageIn the above example, Umbraco HQ is shown at the top, then followed by 24 Days In Umbraco and Skrift. The remaining blogs are sorted alphabetically.

    However with a growing amount of blogs, this probably isn't the right way to show them.

abjerner and others added 25 commits May 3, 2018 20:45
…" properties with the values from the original RSS item

- the "Guid" property can be used to identifying the RSS item when saved to the database.
-t he "Description" property is useful as we can then search the description rather than just the title
…he new namespace and now the class from Tweetinvi
As the methods are not specifically for RSS, but the whole blog implementation in general
The new class is made to specifcally handle reading from the various ways that we cache blogs and blog posts, whereas the "BlogPostsService" class should then be focused on the database logic
The constructor should only have parameters for "result" and "blog", as "item" is parsed from "result". This makes code calling the constructor more clean :D
- to separate the code a bit based on it's purpose, I've added a "BlogPostsWebClient" for making the requests to the interwebz (fetching and parsing the RSS feeds)
- the "BlogPostsService" class now has a single "UpdateBlogPosts" method that takes care of everything necessary for updating the cache / files on disk
- the "BlogDatabaseItem" class now has a numeric ID (used as primary key in the database), which we now can use when indexing in Examine. This is better than an incremental counter, since we can now index blog posts on the fly.
…ntifier for the blog post

Hopefully means that we don't store the same posts more than once :D
…braco into abjerner-blog-posts-search

# Conflicts:
#	OurUmbraco.Site/OurUmbraco.Site.csproj
@nul800sebastiaan nul800sebastiaan changed the base branch from master to main July 15, 2020 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants