I'm trying to show the results only for posts which has a custom meta_key "my_metakey", the filed also should not be empty.
I've tried to modify the sql_query inside the sphinx.conf file with no luck.
I'm not familiar with the way sphinx uses the sphinx.conf file, so not sure how many edits are required to achieve this.
The plugin I'm using is https://wordpress.org/plugins/wordpress-sphinx-plugin/
Any help is highly appropriated!
After lots of testing I've accomplished what I was looking for by modifying the SQL query of source {prefix}main_posts{} inside the sphinx.conf file as the following:
sql_query = select \
p.ID*2+1 as ID, \
0 as comment_ID,\
p.ID as post_ID,\
p.post_title as title, \
p.post_content as body, \
t.name as category, \
my_metakey_meta.meta_value as my_metakey, \
.
.
.
from \
{wp_posts} as p \
left join \
{wp_term_relationships} tr on (p.ID = tr.object_id) \
.
.
left join \
wp_postmeta my_metakey_meta on (p.ID = my_metakey_meta.post_id and my_metakey_meta.meta_key = 'my_metakey') \
.
.
.
where \
p.id>=$start AND p.id<=$end and \
p.post_status = 'publish' and \
my_metakey_meta.meta_value != '' \
group by p.ID
And modified the SQL query of source {prefix}main_comments{} as the following:
sql_query = select \
.
.
'' as category, \
'' as my_metakey, \
.
.
.