Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

added solr field images_withalt_i

orbiterd73fff0e0e76
diff --git a/defaults/solr.keys.list b/defaults/solr.keys.list
index 7ede1c94a..acef6b0bd 100644
--- a/defaults/solr.keys.list
+++ b/defaults/solr.keys.list
@@ -228,6 +228,9 @@ h6_txt
## all image link alt tag
#images_alt_txt
+## number of image links with alt tag
+#images_withalt_i
+
## binary pattern for the existance of h1..h6 headlines, int
#htags_i
diff --git a/source/net/yacy/search/index/SolrConfiguration.java b/source/net/yacy/search/index/SolrConfiguration.java
index 0799f7212..e54d94986 100644
--- a/source/net/yacy/search/index/SolrConfiguration.java
+++ b/source/net/yacy/search/index/SolrConfiguration.java
@@ -510,6 +510,7 @@ public class SolrConfiguration extends ConfigurationSet implements Serializable
final List<String> imgprots = new ArrayList<String>(imagesc.size());
final List<String> imgstubs = new ArrayList<String>(imagesc.size());
final List<String> imgalts = new ArrayList<String>(imagesc.size());
+ int withalt = 0;
for (final ImageEntry ie: imagesc) {
final MultiProtocolURI uri = ie.url();
inboundLinks.remove(uri);
@@ -519,12 +520,14 @@ public class SolrConfiguration extends ConfigurationSet implements Serializable
imgprots.add(protocol);
imgstubs.add(uri.toString().substring(protocol.length() + 3));
imgalts.add(ie.alt());
+ if (ie.alt() != null && ie.alt().length() > 0) withalt++;
}
if (allAttr || contains(YaCySchema.imagescount_i)) add(doc, YaCySchema.imagescount_i, imgtags.size());
if (allAttr || contains(YaCySchema.images_tag_txt)) add(doc, YaCySchema.images_tag_txt, imgtags);
if (allAttr || contains(YaCySchema.images_protocol_sxt)) add(doc, YaCySchema.images_protocol_sxt, protocolList2indexedList(imgprots));
if (allAttr || contains(YaCySchema.images_urlstub_txt)) add(doc, YaCySchema.images_urlstub_txt, imgstubs);
if (allAttr || contains(YaCySchema.images_alt_txt)) add(doc, YaCySchema.images_alt_txt, imgalts);
+ if (allAttr || contains(YaCySchema.images_withalt_i)) add(doc, YaCySchema.images_alt_txt, withalt);
// style sheets
if (allAttr || contains(YaCySchema.css_tag_txt)) {
diff --git a/source/net/yacy/search/index/YaCySchema.java b/source/net/yacy/search/index/YaCySchema.java
index cfa44e605..5cd017166 100644
--- a/source/net/yacy/search/index/YaCySchema.java
+++ b/source/net/yacy/search/index/YaCySchema.java
@@ -117,6 +117,7 @@ public enum YaCySchema implements Schema {
images_urlstub_txt(SolrType.text_general, true, true, true, "all image links without the protocol and '://'"),
images_protocol_sxt(SolrType.text_general, true, true, true, "all image link protocols"),
images_alt_txt(SolrType.text_general, true, true, true, "all image link alt tag"),
+ images_withalt_i(SolrType.integer, true, true, false, "number of image links with alt tag"),
htags_i(SolrType.integer, true, true, false, "binary pattern for the existance of h1..h6 headlines"),
canonical_t(SolrType.text_general, true, true, false, "url inside the canonical link element"),
refresh_s(SolrType.string, true, true, false, "link from the url property inside the refresh link element"),