Reputation: 1152
I was asked for my final degree project to build a custom SEO Content Management System; the point is that the request is to implement PageRank alghoritm for the inner search engine of this CMS, to order the results of the query by the PR. Is it possible? How may I start with this? The CMS is build on PHP and MySql (or PostgreSql). Thank you so much in advance.
Upvotes: 0
Views: 234
Reputation: 51160
You need to come up with an algorithm that can determine "importance" of a page. Google tends to use backlinks to determine this but keyword usage is also an important factor. On your CMS, what makes a page important? Take a specific page or search query and make a use-case out of it. What page should come up when you do this search and why should it come up? Use this information to determine what your algorithm should look for when ranking these pages.
Upvotes: 0
Reputation: 13430
There is some information about the Page Rank algorithm on wikipedia. That should keep you busy for a few days.
You can then merge this with your search algorithm to produce a set of relevant results.
Good luck on your assignment.
-Mathew
Upvotes: 1
Reputation: 5350
If you have the PageRank algorithm done, you probably don't want to be calculating it on each search. I'd schedule regular calculations (daily? weekly? whatever is most appropriate) and then store the PR in your database.
Then, when you run your SQL query, just ORDER BY page_rank
Upvotes: 0
Reputation: 253396
You could possibly create an array of some kind and then sort, here I've used the results of your $pageRank
algorithm (you have created that, haven't you?) as the associative key to a link to a search-result object. Though you could, presumably (depending on the performance of your system) hold the entire result-set in the array if you wanted to.
$pageRankedResults = array("$pageRankAlgorithmResult" => "$referenceToSearchResultObject")
);
echo "<ol>";
foreach(asort($pageRankedResults) as $key => $value) {
echo "<li>$value</li>";
}
echo "</ol>";
Upvotes: 0