Note: while the guidelines in this article apply to most search systems, this article was written for Drupal with Faceted Search. If your site uses Drupal with Apache Solr, some of the specifics of this article may not apply.


About search ranking

When performing a search, two things happen: first posts are filtered for keyword matches, and then those matching posts are sorted or "ranked." Typically, search results are ranked such that the most relevant result is at the top. Since relevance is subjective, the search system will use some kind of heuristic algorithm to approximate relevance. These algorithms can range from very complex and proprietary (such as Google's algorithm) to very simple (such as ranking search results by the time the content was last edited).


In Drupal with Faceted Search, and many other common search systems, search results are roughly based on word frequencies, weighed by where the word appears. For example, if a post has a total of 100 words and the word "water" appears in the body three (3) times, then the word frequency of "water" in the post body would be 3 ÷ 100 = 0.03. If a word appears in the title of the post, it receives an extra multiplier, say 5x. For example, if the word "water" appears once in the title and three (3) times in the body of the post, then the total score for that word for that post would be (1 ÷ 100 × 5) + (3 ÷ 100) = 0.08.


Making a post show up higher in your site's search results

Knowing roughly how search results are ranked, you can adjust your content to make certain posts score higher for certain search keywords. Keep in mind that trying to tweak one set of search results may adversely affect another set of search results. For example, if you optimize a post for "water" you have to be careful it doesn't score so high that it competes with more relevant posts in related searches such as "water shortage."


Strategies:

  • Adding or moving a keyword to the title, subtitle, or headings within the body will increase that keyword's score for that post.
  • Splitting up a long post into several smaller posts may make each of those posts rank higher, because the word frequency of each word increases when you decrease the total number of words in a post.
  • Adding a keyword to the "additional search keywords" field underneath the body field (make sure advanced mode is turned on) will increase the keyword frequency and score without affecting the visible text of the post. You can even repeat the same keyword many times in this field to further increase the keyword score for the post.