PageRankLuaScript
The path of a Lua script that contains a custom algorithm to use for ranking pages when you set RankPages to TRUE
.
The script must contain a function named calculatePageRank
that returns the rank for a page. The function should look like this:
function calculatePageRank(url, depth, links, currentTime, modifiedTime, daysSinceModification) -- do some calculations return thePageRank end
The arguments supplied to the function are:
Argument | Description |
---|---|
url
|
The page URL. |
depth
|
The depth of the page (0 specifies that the connector started crawling from the page, 1 specifies that the page was reached by following one link, 2 specifies that the page was reached by following two links, and so on). |
links
|
The number of links from other pages to this page. |
currentTime
|
The current time, in epoch seconds. |
modifiedTime
|
The time when the page was last modified, in epoch seconds. This value is obtained from the page or HTTP headers (see Date Parameters). If the connector cannot obtain a date from the page or HTTP headers, this value will be the time at which the page was processed. |
daysSinceModification
|
The number of days since the page was last modified. If the connector cannot obtain the last modification time, this value will be zero. |
The connector installation includes an example Lua script, RankPage.Lua
, which demonstrates the default algorithm used by the connector.
Type: | String |
Default: | |
Required: | No |
Configuration Section: | TaskName or FetchTasks |
Example: | PageRankLuaScript=myCustomPageRankAlgorithm.lua
|
See Also: | RankPages |