XF 2.0 INNER JOIN in search

CMTV

Well-known member
Hi!

This link will show all user posts:
Code:
http://question.threads/index.php?search/member&user_id=1

1521042981086.png

Now how can I dispaly only posts with green diamond icon? Such "diamond" post ids are stored in xf_QT_best_answer table so I can get their ids with this query:
SQL:
SELECT `xf_post`.`post_id` FROM `xf_post` INNER JOIN `xf_QT_best_answer` ON `xf_post`.`post_id` = `xf_QT_best_answer`.`post_id` WHERE `xf_post`.`user_id` = ?

The problem is: How to show only "diamond" posts in search results page?
 
Last edited:

CMTV

Well-known member
I don't really understand how search is working in xenForo...

There is no with method in $query variable.
 

CMTV

Well-known member
I will try to explain my problem. (updated first post too).

This link will show all user posts:
Code:
http://question.threads/index.php?search/member&user_id=1

1521042742286.png

Now how can I dispaly only posts with green diamond icon? Such "diamond" post ids are stored in xf_QT_best_answer table so I can get their ids with this query:
SQL:
SELECT `xf_post`.`post_id` FROM `xf_post` INNER JOIN `xf_QT_best_answer` ON `xf_post`.`post_id` = `xf_QT_best_answer`.`post_id` WHERE `xf_post`.`user_id` = ?

The problem is: How to show only "diamond" posts in search results page?
 

S Thomas

Well-known member
Yea, you're right. Neither \Query nor \Search are tied to a Finder. So basically the idea behind all that stuff is:
  • Figure out who builds the query (/XF/Pub/Controller/Search/)
  • Add your stuff to the builder (?)
  • Run the query (/XF/Repository/Search/)
Sadly, I haven't figured out myself yet how the query is actually built. Maybe someone else can help you out there. A dirty approach whatsoever would be to override the runSearch() in /XF/Repository/Search/ method.
 
Top