- 
                Notifications
    You must be signed in to change notification settings 
- Fork 174
Searchable blog posts #235
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
          
     Open
      
      
            abjerner
  wants to merge
  25
  commits into
  umbraco:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
abjerner:blog-posts-search
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Open
            
            
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    …at all IDs follow the same pattern
…" 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
…s for better reuse
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.
…r working with the database
…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
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
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
CommunityBlogItemsdatabase table as well as added to examine via a customBlogItemsIndexSetindex set. This is all handled within the existing Hangfire job.The

MultiIndexSearchersearcher used in the global search now also searchesBlogItemsIndexSet. Because of this, blog posts can now be found in the global search - eg. my blog post about extracting high contrast colors.A search result for a blog post is rendered by the
~/Views/Partials/Search/BlogItem.cshtmlpartial view with a model of the typeBlogItemSearchResult.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.
 In 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.
In 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.