- add canonical field only if requested by solr schema

- remove canonical url from in/outbound urls if present
pull/1/head
Michael Peter Christen 13 years ago
parent 3fd4a01286
commit 0294a53459

@ -195,9 +195,6 @@ public class SolrConfiguration extends ConfigurationSet implements Serializable
addSolr(solrdoc, SolrField.htags_i, h);
// canonical tag
if (html.getCanonical() != null) addSolr(solrdoc, SolrField.canonical_s, html.getCanonical().toNormalform(false, false));
// noindex and nofollow attributes
// from HTML (meta-tag in HTML header: robots)
// and HTTP header (x-robots property)
@ -343,6 +340,16 @@ public class SolrConfiguration extends ConfigurationSet implements Serializable
if (iframes.length > 0) addSolr(solrdoc, SolrField.iframes_txt, iframes);
}
// canonical tag
if (isEmpty() || contains(SolrField.canonical_s.name())) {
final MultiProtocolURI canonical = html.getCanonical();
if (canonical != null) {
inboundLinks.remove(canonical);
ouboundLinks.remove(canonical);
addSolr(solrdoc, SolrField.canonical_s, canonical.toNormalform(false, false));
}
}
// flash embedded
if (isEmpty() || contains(SolrField.flash_b.name())) {
MultiProtocolURI[] flashURLs = html.getFlash();

Loading…
Cancel
Save