Skip to content

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

added the collection field to minimized exports, needed for packs. Also: replaced sku with urls_s. For this we also relaxed parsing of url fields in import, also url instead url_s is accepted.

Michael Peter Christen0b89b0e560cc
diff --git a/source/net/yacy/document/importer/JsonListImporter.java b/source/net/yacy/document/importer/JsonListImporter.java
index 928350c03..5707de2ee 100644
--- a/source/net/yacy/document/importer/JsonListImporter.java
+++ b/source/net/yacy/document/importer/JsonListImporter.java
@@ -211,7 +211,7 @@ public class JsonListImporter extends Thread implements Importer {
ctype.add(pack, list);
} else {
// first handle exceptional keys / maybe patch for other systems + other names
- if (key.equals("url_s") || key.equals("sku")) {
+ if (key.equals("url") || key.equals("url_s") || key.equals("sku")) {
// patch yacy grid altered schema (yacy grid does not have IDs any more, but they can be re-computed here)
final DigestURL durl = new DigestURL(o.toString());
final String id = ASCII.String(durl.hash());
diff --git a/source/net/yacy/search/index/Fulltext.java b/source/net/yacy/search/index/Fulltext.java
index ef824d880..ce5dadacc 100644
--- a/source/net/yacy/search/index/Fulltext.java
+++ b/source/net/yacy/search/index/Fulltext.java
@@ -727,13 +727,14 @@ public final class Fulltext {
private final static Set<String> minified_keys = new HashSet<>();
static {
//minified_keys.add(CollectionSchema.id.getSolrFieldName());
- minified_keys.add(CollectionSchema.sku.getSolrFieldName());
- minified_keys.add(CollectionSchema.title.getSolrFieldName());
- //minified_keys.add(CollectionSchema.author.getSolrFieldName());
+ minified_keys.add(CollectionSchema.sku.getSolrFieldName()); // required but should be renamed to url
+ minified_keys.add(CollectionSchema.title.getSolrFieldName()); // required
+ //minified_keys.add(CollectionSchema.author.getSolrFieldName()); // would be nice to have, but from web crawls this usually contains nonsense (i.e SEO spam)
minified_keys.add(CollectionSchema.description_txt.getSolrFieldName());
- //minified_keys.add(CollectionSchema.size_i.getSolrFieldName());
- minified_keys.add(CollectionSchema.last_modified.getSolrFieldName());
- minified_keys.add(CollectionSchema.text_t.getSolrFieldName());
+ //minified_keys.add(CollectionSchema.size_i.getSolrFieldName()); // nice but rarely of actual use
+ minified_keys.add(CollectionSchema.last_modified.getSolrFieldName()); // often wrong (latest date from CMS sytems) however useful if right
+ minified_keys.add(CollectionSchema.text_t.getSolrFieldName()); // required, should contain markdown
+ minified_keys.add(CollectionSchema.collection_sxt.getSolrFieldName()); // needed to support the pack concept
}
public class Export extends Thread {
@@ -844,12 +845,28 @@ public final class Fulltext {
while ((doc = docs.take()) != AbstractSolrConnector.POISON_DOCUMENT) {
final String url = this.getStringFrom(doc.getFieldValue(CollectionSchema.sku.getSolrFieldName()));
if (this.pattern != null && !this.pattern.matcher(url).matches()) continue;
+
+ // exclude non-minified keys if minified export is requested
if (this.minified) {
final Iterator<Entry<String, Object>> i = doc.iterator();
while (i.hasNext()) {
if (!minified_keys.contains(i.next().getKey())) i.remove();
}
}
+
+ // rename sku to url_s
+ final Iterator<Entry<String, Object>> i = doc.iterator();
+ while (i.hasNext()) {
+ Entry<String, Object> entry = i.next();
+ if (entry.getKey().equals(CollectionSchema.sku.getSolrFieldName())) {
+ String sku = (String) entry.getValue();
+ i.remove();
+ doc.setField("url_s", sku);
+ break;
+ }
+ }
+
+ // write the document in requested format
final CRIgnoreWriter sw = new CRIgnoreWriter();
if (this.text) sw.write((String) doc.getFieldValue(CollectionSchema.text_t.getSolrFieldName()));
if (this.format == ExportFormat.solr) EnhancedXMLResponseWriter.writeDoc(sw, doc);