/// Creates the full text search index for the blog posts.
Creates the full text search index for the blog posts.
Creates the full text search index for the blog posts .
pub fn create_fts_index(conn: &SqliteConnection) -> errors::Result<()> {
    use crate::schema::post_content;
    use crate::schema::posts::dsl::*;
    sql::<Bool>(r#"CREATE VIRTUAL TABLE post_content USING fts4(content, title)"#).execute(conn)?;
    // TODO: We should actually load the content here, not the HTML.
    let new_post_content = posts.select((id, title, html)).load::<PostContent>(conn)?;
    diesel::insert_into(post_content::table)
        .values(&new_post_content)
        .execute(conn)?;
    info!("optimizing blog post content index");
    sql::<Bool>(r#"INSERT INTO post_content(post_content) VALUES ('optimize')"#).execute(conn)?;
    Ok(())
}
pub fn create_fts_index ( conn : & SqliteConnection ) -> errors :: Result < ( ) > { use crate :: schema :: post_content ; use crate :: schema :: posts :: dsl :: * ; sql :: < Bool > ( r#"CREATE VIRTUAL TABLE post_content USING fts4(content, title)"# ) . execute ( conn ) ? ; // TODO: We should actually load the content here, not the HTML. let new_post_content = posts . select ( ( id , title , html ) ) . load :: < PostContent > ( conn ) ? ; diesel :: insert_into ( post_content :: table ) . values ( & new_post_content ) . execute ( conn ) ? ; info ! ( " " ) ; sql :: < Bool > ( r#"INSERT INTO post_content(post_content) VALUES ('optimize')"# ) . execute ( conn ) ? ; Ok ( ( ) ) }
Creates the full text search index for the blog posts.
Creates the full text search index for the blog posts .
conn
&SqliteConnection