SearchWP

This Documentation is for SearchWP Version 3

Available since: 2.7

searchwp_weight_mods

View Parameters »

SearchWP’s backbone is its search algorithm. Fundamentally the algorithm is based on keyword weights to produce the most relevant results. There are circumstances where you may want to inject your own logic into the search algorithm, however. The searchwp_weight_mods lets you do just that.

While you can’t completely omit SearchWP’s weight calculations, you can influence the overall weight of every result by injecting your own SQL statement at just the right time.

Example: If you’d like to have more recently published posts rank higher than older posts, see this KB entry

Parameters

Parameter Type Description
$sql String

The SQL to insert into the main algorithm query alongside the weight calculations