views:

120

answers:

4

Hi to everyone.

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.

A: 

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>";
David Thomas
Thank you so much for the answer...I haven't create a PR alghoritm...I have no idea on it...Actually I've implemented on my inner search engine a mechanism of query results based on relevance of the query, assuming a difference weight if the search term is on the title of the page, or in <h1> or <p> and so on...but how can I match this results with a PR score?
bobighorus
A: 

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

mabwi
That's not a bad idea; but...presumably you'd need multiple page_rank results; the search for 'whetstone' would require significantly different page_rank results from the search for 'bed and breakfast.' (I have no idea what sort of search expressions he'd be expecting.)
David Thomas
To the best of my knowledge - which is admittedly incomplete - PageRank (at least the original iteration) has no relationship to the search term used. It's merely a rating of how trusted a page is in general.
mabwi
Thank you so much for the answer. Infact PR has no relationship to query term...so I hava no idea on how can I order the results of the search both on the PR and the query relevance...
bobighorus
You will need to come up with some relationship between the non-PR relevance and the PR to determine overall query result.If you want to go 50/50, you could take a relevance score out of 10, and your PR score out of 10, and add them together, with the highest combined score being your top result. Or, you take all results that match the query term, and just sort them by PR, which makes PR your relevance score.
mabwi
Thank you so much for the answer...Have you got any suggest for implement a PageRank alghoritm in PHP?
bobighorus
+1  A: 

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

The Pixel Developer
Thank you so much for the answer, I've already read a lot about PR all around but I need a help for writing this in code.:)
bobighorus
A: 

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.

Joe Philllips