Are post ID’s searchable in Relevanssi?
No. Relevanssi does understand the WP_Query p parameter to restrict the search by post ID.
However, if you want to search by post ID, it’s very simple to make that happen using the relevanssi_content_to_index filter hook:
add_filter( 'relevanssi_content_to_index', 'rlv_index_post_id', 10, 2 );
function rlv_index_post_id( $content, $post ) {
$content .= ' ' . $post->ID;
return $content;
}Add that to theme functions.php, reindex and searching for post ID’s works.
Related Posts
Related Posts
Related posts are a popular feature, as it keeps the users engaged and offers them a new direction to continue to within your site, keeping the users on your site for a longer time. Many plugins do...
Indexing embedded PDFs for the parent post
...WordPress. Thus, Relevanssi won’t know the PDF is embedded in the post and cannot index the PDF contents for the parent post. Most of these plugins use shortcodes to embed the PDF viewer on a page. To get Relevanssi to index the embedded PDF contents for the parent post, you......$upload_dir = wp_upload_dir(); foreach ( $matches[1] as $pdf ) { $pdf_url = ltrim( str_replace( $upload_dir['baseurl'], '', urldecode( $pdf ) ), '/' ); $pdf_content = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_relevanssi_pdf_content' AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = %s......meta_key = '_wp_attached_file' AND meta_value = %s )", $pdf_url ) ); $content .= $pdf_content; } } return $content; } If you use the Gutenberg block, the code is different and uses the relevanssi_block_to_render filter hook: add_filter( 'relevanssi_block_to_render', 'rlv_pdfembedder_content', 10 ); function rlv_pdfembedder_content( $block ) { if ( $block['blockName'] === 'pdfemb/pdf-embedder-viewer'...
Installing Relevanssi and adjusting the settings
...haven’t been read yet. If reading the PDF caused an error message before, the PDF will be skipped, unless the error message is a time out, in which case it’s attempted again. Reset all PDF data from the posts will empty out the PDF information from the posts. It is......content reading. If you have PDF files in your Media Library, Relevanssi can read in the PDF contents so that they are available for indexing. In order to read the contents of the PDFs, the files are sent over to Relevanssiservices.com, an Apache Tika server hosted by UpCloud. One server......in them. In order to block individual files from reading, use the Relevanssi post controls on attachment edit page to exclude attachment posts from indexing. Read all unread PDFs reads in all the PDF content in attachments. This does not wipe the index, and will only process those PDFs which...
Indexing image captions for the posts
The use case is I run several newspapers, and the “caption” field when uploading media is where the journalists put the photographer credit. We need to be able to index the photographer bylines, but i...
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...
ACF: Indexing relationship content
If your posts include content from related posts using the Advanced Custom Fields relationship functionality, Relevanssi doesn't index that content by default. Even if you set Relevanssi up to index t...
Does that contains products id also?
Sure, a post ID is a post ID, no matter the post type. They’re all posts to Relevanssi.