Relevanssi Integration 🧠

Cwicly empowers highly dynamic sites based on metadata. This is great, until it’s time to search. WordPress search doesn’t extend to post metadata, weighted search results, etc. Ordinarily, the Relevanssi search plugin provides a solution, but there’s no integration at the moment between the two.

The solution is simple. When Relevanssi is installed, Cwicly queries which utilize the search parameter should source their query results from Relevanssi instead of WordPress. It’s really this simple to implement:

relevanssi_do_query( WP_Query &$query )

Relevanssi is great. Cwicly is great. We need these two to work together. Hopefully soon. :wave:

Got a workaround! This filter works, for anyone interested:

add_filter(
    "cwicly/query/args",
    function ($query_args) {
        // check if the search query is set
        if (isset($query_args["s"]) && !empty($query_args["s"])) {
            // if so, add 'relevanssi'  => true to the query args
            $query_args["relevanssi"] = true;
        }
        return $query_args;
    },
    10,
    1
);
4 Likes