@ -90,18 +90,13 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe
private String alternative_urlname ;
private String alternative_urlname ;
private TextSnippet textSnippet = null ;
private TextSnippet textSnippet = null ;
public URIMetadataNode ( final Properties prop , String collection ) {
public URIMetadataNode ( final Properties prop , String collection ) throws MalformedURLException {
// generates an plasmaLURLEntry using the properties from the argument
// generates an plasmaLURLEntry using the properties from the argument
// the property names must correspond to the one from toString
// the property names must correspond to the one from toString
//System.out.println("DEBUG-ENTRY: prop=" + prop.toString());
//System.out.println("DEBUG-ENTRY: prop=" + prop.toString());
super ( ) ;
super ( ) ;
final String urlRaw = crypt . simpleDecode ( prop . getProperty ( "url" , "" ) ) ;
final String urlRaw = crypt . simpleDecode ( prop . getProperty ( "url" , "" ) ) ;
try {
url = new DigestURL ( urlRaw ) ;
url = new DigestURL ( urlRaw ) ;
} catch ( final MalformedURLException e ) {
ConcurrentLog . logException ( e ) ;
this . url = null ;
}
String descr = crypt . simpleDecode ( prop . getProperty ( "descr" , "" ) ) ; if ( descr = = null ) descr = "" ;
String descr = crypt . simpleDecode ( prop . getProperty ( "descr" , "" ) ) ; if ( descr = = null ) descr = "" ;
String dc_creator = crypt . simpleDecode ( prop . getProperty ( "author" , "" ) ) ; if ( dc_creator = = null ) dc_creator = "" ;
String dc_creator = crypt . simpleDecode ( prop . getProperty ( "author" , "" ) ) ; if ( dc_creator = = null ) dc_creator = "" ;
String tags = crypt . simpleDecode ( prop . getProperty ( "tags" , "" ) ) ; if ( tags = = null ) tags = "" ;
String tags = crypt . simpleDecode ( prop . getProperty ( "tags" , "" ) ) ; if ( tags = = null ) tags = "" ;
@ -161,7 +156,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe
}
}
}
}
public URIMetadataNode ( final SolrDocument doc ) {
public URIMetadataNode ( final SolrDocument doc ) throws MalformedURLException {
super ( ) ;
super ( ) ;
for ( String name : doc . getFieldNames ( ) ) {
for ( String name : doc . getFieldNames ( ) ) {
this . addField ( name , doc . getFieldValue ( name ) ) ;
this . addField ( name , doc . getFieldValue ( name ) ) ;
@ -170,31 +165,15 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe
this . score = scorex = = null ? 0.0f : scorex . floatValue ( ) ;
this . score = scorex = = null ? 0.0f : scorex . floatValue ( ) ;
final byte [ ] hash = ASCII . getBytes ( getString ( CollectionSchema . id ) ) ; // TODO: can we trust this id ?
final byte [ ] hash = ASCII . getBytes ( getString ( CollectionSchema . id ) ) ; // TODO: can we trust this id ?
final String urlRaw = getString ( CollectionSchema . sku ) ;
final String urlRaw = getString ( CollectionSchema . sku ) ;
try {
this . url = new DigestURL ( urlRaw , hash ) ;
this . url = new DigestURL ( urlRaw , hash ) ;
} catch ( final MalformedURLException e ) {
ConcurrentLog . logException ( e ) ;
this . url = null ;
}
}
}
public URIMetadataNode ( final SolrDocument doc , final WordReferenceVars searchedWord , final float scorex ) {
public URIMetadataNode ( final SolrDocument doc , final WordReferenceVars searchedWord , final float scorex ) throws MalformedURLException {
this ( doc ) ;
this ( doc ) ;
this . word = searchedWord ;
this . word = searchedWord ;
this . score = scorex ;
this . score = scorex ;
}
}
public URIMetadataNode ( final String urlstr ) {
super ( ) ;
try {
url = new DigestURL ( urlstr ) ;
this . setField ( CollectionSchema . sku . name ( ) , url . toNormalform ( true ) ) ;
this . setField ( CollectionSchema . id . name ( ) , ASCII . String ( url . hash ( ) ) ) ;
} catch ( final MalformedURLException e ) {
ConcurrentLog . logException ( e ) ;
this . url = null ;
}
}
public URIMetadataNode ( DigestURL theurl ) {
public URIMetadataNode ( DigestURL theurl ) {
super ( ) ;
super ( ) ;
url = theurl ;
url = theurl ;
@ -520,7 +499,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe
}
}
try {
try {
return new URIMetadataNode ( MapTools . s2p ( propStr . substring ( 1 , propStr . length ( ) - 1 ) ) , collection ) ;
return new URIMetadataNode ( MapTools . s2p ( propStr . substring ( 1 , propStr . length ( ) - 1 ) ) , collection ) ;
} catch ( final kelondroException e ) {
} catch ( final kelondroException | MalformedURLException e ) {
// wrong format
// wrong format
ConcurrentLog . severe ( "URIMetadataNode" , e . getMessage ( ) ) ;
ConcurrentLog . severe ( "URIMetadataNode" , e . getMessage ( ) ) ;
return null ;
return null ;