Continue reading Indexing attachments from File blocks

Indexing attachments from File blocks

The Relevanssi attachment indexing assumes the files are connected to the posts using the WordPress attachment mechanism. What if you don’t use that but instead add the files to the pages using the File block in the block editor? That’s not a problem, but it requires some extra code. Add this function to your site…

Read more Indexing attachments from File blocks 0 Comment on Indexing attachments from File blocks
Continue reading Attachment file content cannot be saved

Attachment file content cannot be saved

The Relevanssi error “Could not save the file content to the custom field” means that Relevanssi has managed to read the attachment contents but cannot save them to the _relevanssi_pdf_content custom field Relevanssi uses to store the attachment contents. Relevanssi uses the update_post_meta() function to save the content, and for some reason, that function is…

Read more Attachment file content cannot be saved 0 Comment on Attachment file content cannot be saved
Continue reading Indexing and searching PDFs in WordPress

Indexing and searching PDFs in WordPress

…service on a separate server. Which PDF files can you index? Since Relevanssi is a WordPress search, Relevanssi operates on WordPress posts (including all the different post types). So, to have Relevanssi index your PDFs, they need to be WordPress posts. That’s fortunately really simple: upload your PDF files to……or EU. You can choose from the settings which server you want to use. There the files are processed with Tika. While we don’t care what’s inside the files you index on our server, the server needs to make working copies. The server removes the documents after use. It is……attachments? Yes! Relevanssi can handle lots of different formats. Our server uses Apache Tika to process the files, giving us a wide variety of supported formats. The essential document formats are covered: Word documents (DOC and DOCX), Open Office documents (ODT), RTFs, etc. How does the attachment indexing work? Relevanssi…

Read more Indexing and searching PDFs in WordPress 78 Comments on Indexing and searching PDFs in WordPress
Continue reading Controlling attachment types in index

Controlling attachment types in index

….= ‘ No images’; return $restriction; } Only PDFs This function will only index PDF attachments, and nothing else. add_filter( ‘relevanssi_indexing_restriction’, ‘rlv_only_pdfs’ ); function rlv_only_pdfs( $restriction ) { global $wpdb; $restriction[‘mysql’] .= ” AND post.ID NOT IN (SELECT ID FROM $wpdb->posts WHERE post_type = ‘attachment’ AND post_mime_type != ‘application/pdf‘ )…

Read more Controlling attachment types in index 16 Comments on Controlling attachment types in index
Continue reading Indexing attachment file names

Indexing attachment file names

…( ‘attachment’ === $post->post_type ) { $content .= ‘ ‘ . basename( $post->guid ); } return $content; } Notice that by default Relevanssi replaces periods with spaces, so “sample.pdf” is indexed as “sample pdf”. That should not be a problem, as also in searching “sample.pdf” becomes “sample pdf”. However, if…Relevanssi has been working nicely for the normal usecase. But how does one setup indexing of attachment files. When someone searches by a file name or an extension like pdf, there are no results. I have enabled ‘attachment’ at Relevanssi ‘Indexing options’ and still there are no results. Relevanssi doesn’t…

Read more Indexing attachment file names 7 Comments on Indexing attachment file names