- added an index constraint 'has location' to the condenser

- added evaluation of the 'has location' constraint to search using the /location operator


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7633 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent 41b8d7f655
commit 156cf02703

@ -136,7 +136,7 @@ public class Crawler_p {
// normalize URL
DigestURI crawlingStartURL = null;
try {crawlingStartURL = new DigestURI(crawlingStart);} catch (final MalformedURLException e1) {}
try {crawlingStartURL = new DigestURI(crawlingStart);} catch (final MalformedURLException e1) {Log.logException(e1);}
crawlingStart = (crawlingStartURL == null) ? null : crawlingStartURL.toNormalform(true, true);
// set new properties

@ -289,9 +289,14 @@ public class yacysearch {
ranking.coeff_worddistance = RankingProfile.COEFF_MAX;
}
if (querystring.indexOf("/date") >= 0) {
querystring = querystring.replace("/date", "");
querystring = querystring.replace("/date", "");
ranking.coeff_date = RankingProfile.COEFF_MAX;
}
if (querystring.indexOf("/location") >= 0) {
querystring = querystring.replace("/location", "");
if (constraint == null) constraint = new Bitfield(4);
constraint.set(Condenser.flag_cat_haslocation, true);
}
int lrp = querystring.indexOf("/language/");
String lr = "";
if (lrp >= 0) {

@ -441,7 +441,7 @@ public final class RankingProcess extends Thread {
(QueryParams.anymatch(pageauthor.toLowerCase(), query.excludeHashes))) {
continue;
}
// check index-of constraint
if ((query.constraint != null) &&
(query.constraint.get(Condenser.flag_cat_indexof)) &&
@ -452,6 +452,13 @@ public final class RankingProcess extends Thread {
}
continue;
}
// check location constraint
if ((query.constraint != null) &&
(query.constraint.get(Condenser.flag_cat_haslocation)) &&
(metadata.lat() == 0.0f || metadata.lon() == 0.0f)) {
continue;
}
// check content domain
if ((query.contentdom == ContentDomain.AUDIO && page.laudio() == 0) ||

@ -266,7 +266,8 @@ public class HTTPClient {
public byte[] GETbytes(final String uri, long maxBytes) throws IOException {
final MultiProtocolURI url = new MultiProtocolURI(uri);
boolean localhost = url.getHost().equals("localhost");
final HttpGet httpGet = new HttpGet(url.toNormalform(true, false, !localhost, false));
String urix = url.toNormalform(true, false, !localhost, false);
final HttpGet httpGet = new HttpGet(urix);
if (!localhost) setHost(url.getHost()); // overwrite resolved IP, needed for shared web hosting DO NOT REMOVE, see http://en.wikipedia.org/wiki/Shared_web_hosting_service
return getContentBytes(httpGet, maxBytes);
}

@ -76,7 +76,7 @@ public final class Condenser {
public static final int flag_cat_linux = 16; // pages about linux software
public static final int flag_cat_macos = 17; // pages about macintosh, apple computers and the mac os
public static final int flag_cat_windows = 18; // pages about windows os and software
public static final int flag_cat_osreserve = 19; // reserve
public static final int flag_cat_haslocation = 19; // the page has a location metadata attached
public static final int flag_cat_hasimage = 20; // the page refers to (at least one) images
public static final int flag_cat_hasaudio = 21; // the page refers to (at least one) audio file
public static final int flag_cat_hasvideo = 22; // the page refers to (at least one) videos
@ -116,6 +116,7 @@ public final class Condenser {
if (!document.getAudiolinks().isEmpty()) RESULT_FLAGS.set(flag_cat_hasaudio, true);
if (!document.getVideolinks().isEmpty()) RESULT_FLAGS.set(flag_cat_hasvideo, true);
if (!document.getApplinks().isEmpty()) RESULT_FLAGS.set(flag_cat_hasapp, true);
if (document.lat() != 0.0f && document.lon() != 0.0f) RESULT_FLAGS.set(flag_cat_haslocation, true);
this.languageIdentificator = new Identificator();

Loading…
Cancel
Save