Merge branch 'master' of git@github.com:yacy/yacy_search_server.git

pull/9/merge
Michael Peter Christen 10 years ago
commit 32a804b10c

@ -68,7 +68,7 @@
<classpathentry kind="lib" path="lib/httpmime-4.4.1.jar"/>
<classpathentry kind="lib" path="lib/noggit-0.6.jar"/>
<classpathentry kind="lib" path="lib/solr-core-5.2.0.jar" sourcepath="/Volumes/Uno/noBackup/Downloads/solr-5.2.0/solr/core/src/java"/>
<classpathentry kind="lib" path="lib/solr-solrj-5.2.0.jar" sourcepath="/Volumes/Uno/noBackup/Downloads/solr-5.2.0/solr/solrj/src/java"/>
<classpathentry kind="lib" path="lib/solr-solrj-5.2.0.jar" sourcepath="/Users/admin/Downloads/solr-5.2.1/solr/solrj/src/java"/>
<classpathentry kind="lib" path="lib/stax2-api-3.1.4.jar"/>
<classpathentry kind="lib" path="lib/woodstox-core-asl-4.4.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-analyzers-common-5.2.0.jar"/>

@ -271,14 +271,18 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU
// file://localhost/c:/WINDOWS/clock.avi
// network file://hostname/path/to/the%20file.txt
// local file:///c:/path/to/the%20file.txt
final String h = url.substring(p + 1);
String h = url.substring(p + 1);
this.host = null; // host is ignored on file: protocol
if (h.startsWith("///")) { //absolute local file path
// no host given
this.path = h.substring(2); // "/path" or "/c:/path"
} else if (h.startsWith("//")) { // "//host/path" or "//host/c:/path"
if (h.length() > 4 && h.charAt(3) == ':' && h.charAt(4) != '/' && h.charAt(4) != '\\') {
// wrong windows path, after the doublepoint there should be a backslash
h = h.substring(0, 4) + '\\' + h.substring(4);
}
int q = h.indexOf('/', 2);
if (q < 0) {
if (q < 0 || h.length() > 3 && h.charAt(3) == ':') {
this.path = h.substring(2); // "path" or "c:/path"
} else {
this.host = h.substring(2, q ); // TODO: handle "c:" ?
@ -2310,14 +2314,15 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU
if (p > 0) normalizedURL = normalizedURL.substring(p + 2);
return splitpattern.split(normalizedURL.toLowerCase()); // word components of the url
}
/*
public static void main(final String[] args) {
for (final String s: args) System.out.println(toTokens(s));
}
*/
public static void main(final String[] args) {
final String[][] test = new String[][]{
new String[]{null, "file://Z:\\"},
new String[]{null, "file://y:/"},
new String[]{null, "file://y:/yacy"},
new String[]{null, "file://y:/yacy/"},
new String[]{null, "file://y:"},
new String[]{null, "file://Z:admin\\home"}, // thats wrong but may appear
new String[]{null, "file://Z:\\admin\\home"},
new String[]{null, "https://www.example.com/shoe/?p=2&ps=75#t={%22san_NaviPaging%22:2}"}, // ugly strange pagination link
new String[]{null, "C:WINDOWS\\CMD0.EXE"},
new String[]{null, "file://C:WINDOWS\\CMD0.EXE"},
@ -2388,7 +2393,11 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU
((aURL != null) && (jURL != null) && (!(jURL.toString().equals(aURL.toNormalform(false)))))) {
System.out.println("Difference for environment=" + environment + ", url=" + url + ":");
System.out.println((jURL == null) ? "jURL rejected input" : "jURL=" + jURL.toString());
System.out.println((aURL == null) ? "aURL rejected input" : "aURL=" + aURL.toNormalform(false));
System.out.println((aURL == null) ? "aURL rejected input" : "aURL=" + aURL.toNormalform(false) + "; host=" + aURL.getHost() + "; path=" + aURL.getPath() + "; file=" + aURL.getFile());
}
if (aURL != null && jURL != null && jURL.toString().equals(aURL.toNormalform(false))) {
System.out.println("jURL == aURL=" + aURL.toNormalform(false) + "; host=" + aURL.getHost() + "; path=" + aURL.getPath() + "; file=" + aURL.getFile());
}
// check stability: the normalform of the normalform must be equal to the normalform

@ -112,6 +112,14 @@ public class SchemaConfiguration extends Configuration implements Serializable {
return this.contains(field.getSolrFieldName());
}
public void remove(final SolrInputDocument doc, final SchemaDeclaration key) {
key.remove(doc);
}
public void remove(final SolrInputDocument doc, final String key) {
doc.removeField(key);
}
public void add(final SolrInputDocument doc, final SchemaDeclaration key, final String value) {
assert !key.isMultiValued() : "key = " + key.getSolrFieldName();
if ((isEmpty() || contains(key)) && (!this.lazy || (value != null && !value.isEmpty()))) key.add(doc, value);

@ -72,5 +72,7 @@ public interface SchemaDeclaration {
public void add(final SolrInputDocument doc, final double value);
public void add(final SolrInputDocument doc, final boolean value);
public void remove(final SolrInputDocument doc);
}

@ -101,6 +101,7 @@ import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrInputField;
import org.eclipse.jetty.util.ConcurrentHashSet;
@ -1006,6 +1007,10 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
}
public void enrich(SolrInputDocument doc, List<String> synonyms, Map<String, Set<String>> genericFacets) {
remove(doc, CollectionSchema.vocabularies_sxt); // delete old values
for (SolrInputField sif: doc) {
if (sif.getName().startsWith(CollectionSchema.VOCABULARY_PREFIX)) remove(doc, sif.getName());
}
if (this.isEmpty() || contains(CollectionSchema.vocabularies_sxt)) {
// write generic navigation
// there are no pre-defined solr fields for navigation because the vocabulary is generic
@ -1027,6 +1032,7 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
}
if (vocabularies.size() > 0) add(doc, CollectionSchema.vocabularies_sxt, vocabularies);
}
remove(doc, CollectionSchema.synonyms_sxt); // delete old values
if (this.isEmpty() || contains(CollectionSchema.synonyms_sxt)) {
if (synonyms.size() > 0) add(doc, CollectionSchema.synonyms_sxt, synonyms);
}

@ -341,7 +341,7 @@ public enum CollectionSchema implements SchemaDeclaration {
public final String getComment() {
return this.comment;
}
@Override
public final void add(final SolrInputDocument doc, final String value) {
assert !this.isMultiValued();
@ -431,5 +431,9 @@ public enum CollectionSchema implements SchemaDeclaration {
doc.setField(this.getSolrFieldName(), value);
}
@Override
public final void remove(final SolrInputDocument doc) {
doc.removeField(this.getSolrFieldName());
}
}

@ -284,5 +284,9 @@ public enum WebgraphSchema implements SchemaDeclaration {
doc.setField(this.getSolrFieldName(), value);
}
@Override
public final void remove(final SolrInputDocument doc) {
doc.removeField(this.getSolrFieldName());
}
}

Loading…
Cancel
Save