BUG Index relative URLs

Avoids clashes between CLI and web modes (e.g. wrongly configured
$_FILE_TO_URL_MAPPING lookups).
This commit is contained in:
Ingo Schommer 2013-05-29 18:09:42 +02:00
parent cdb55f94f8
commit bd186a0a73
2 changed files with 11 additions and 5 deletions

View File

@ -148,12 +148,12 @@ class DocumentationPage extends ViewableData {
/** /**
* Returns the public accessible link for this page. * Returns the public accessible link for this page.
* *
* @param Boolean Absolute URL (incl. domain), or relative to webroot
* @return string * @return string
*/ */
function getLink() { function getLink($absolute=true) {
if($entity = $this->getEntity()) { if($entity = $this->getEntity()) {
$link = Controller::join_links($entity->Link($this->getVersion(), $this->lang), $this->getRelativeLink()); $link = $this->getRelativeLink();
$link = rtrim(DocumentationService::trim_extension_off($link), '/'); $link = rtrim(DocumentationService::trim_extension_off($link), '/');
// folders should have a / on them. Looks nicer // folders should have a / on them. Looks nicer
@ -166,7 +166,13 @@ class DocumentationPage extends ViewableData {
$link = $this->getPath(true); $link = $this->getPath(true);
} }
return $link; if($absolute) {
$fullLink = Controller::join_links($entity->Link($this->getVersion(), $this->lang), $link);
} else {
$fullLink = Controller::join_links($entity->getRelativeLink($this->getVersion(), $this->lang), $link);
}
return $fullLink;
} }
/** /**

View File

@ -86,7 +86,7 @@ class RebuildLuceneDocsIndex extends BuildTask {
$doc->addField(Zend_Search_Lucene_Field::Keyword('Version', $page->getVersion())); $doc->addField(Zend_Search_Lucene_Field::Keyword('Version', $page->getVersion()));
$doc->addField(Zend_Search_Lucene_Field::Keyword('Language', $page->getLang())); $doc->addField(Zend_Search_Lucene_Field::Keyword('Language', $page->getLang()));
$doc->addField(Zend_Search_Lucene_Field::Keyword('Entity', $entity)); $doc->addField(Zend_Search_Lucene_Field::Keyword('Entity', $entity));
$doc->addField(Zend_Search_Lucene_Field::Keyword('Link', $page->Link)); $doc->addField(Zend_Search_Lucene_Field::Keyword('Link', $page->getLink(false)));
// custom boosts // custom boosts
$titleField->boost = 3; $titleField->boost = 3;