From dbbad23e120183342346d76b489d5356027742ae Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Mon, 3 Aug 2015 05:37:34 +0200 Subject: [PATCH] removed warnings --- htroot/Bookmarks.java | 2 +- htroot/ConfigHTCache_p.java | 1 - htroot/IndexControlRWIs_p.java | 32 ++++++++--------- htroot/ViewFile.java | 4 +-- htroot/yacysearch.java | 6 ++-- htroot/yacysearchtrailer.java | 2 +- .../solr/instance/EmbeddedInstance.java | 1 - .../EnhancedXMLResponseWriter.java | 2 -- .../responsewriter/HTMLResponseWriter.java | 1 - source/net/yacy/crawler/Balancer.java | 1 - .../net/yacy/crawler/RecrawlBusyThread.java | 3 +- source/net/yacy/data/BookmarksDB.java | 3 +- source/net/yacy/data/WorkTables.java | 2 +- .../kelondro/data/meta/URIMetadataNode.java | 18 +++++----- source/net/yacy/kelondro/util/OS.java | 35 ------------------- source/net/yacy/peers/Protocol.java | 2 -- .../net/yacy/search/query/QueryModifier.java | 3 -- source/net/yacy/search/query/QueryParams.java | 12 +++---- source/net/yacy/search/query/SearchEvent.java | 28 +++++++-------- .../yacy/search/ranking/ReferenceOrder.java | 22 ++++++------ source/net/yacy/utils/cryptbig.java | 11 ++---- 21 files changed, 67 insertions(+), 124 deletions(-) diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.java index ee92ce6f1..a5a4b3342 100644 --- a/htroot/Bookmarks.java +++ b/htroot/Bookmarks.java @@ -321,7 +321,7 @@ public class Bookmarks { count = 0; while(count < max_count && it.hasNext()) { - Bookmark bookmark = bookmark = sb.bookmarksDB.getBookmark(it.next()); + Bookmark bookmark = sb.bookmarksDB.getBookmark(it.next()); if (bookmark != null){ if (bookmark.getFeed() && isAdmin) { diff --git a/htroot/ConfigHTCache_p.java b/htroot/ConfigHTCache_p.java index aa5c0cec3..6005e1d2a 100644 --- a/htroot/ConfigHTCache_p.java +++ b/htroot/ConfigHTCache_p.java @@ -31,7 +31,6 @@ import java.io.IOException; import net.yacy.cora.protocol.RequestHeader; import net.yacy.crawler.data.Cache; -import net.yacy.data.WorkTables; import net.yacy.search.Switchboard; import net.yacy.search.SwitchboardConstants; import net.yacy.server.serverObjects; diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java index a7e13a0b8..9830a02ab 100644 --- a/htroot/IndexControlRWIs_p.java +++ b/htroot/IndexControlRWIs_p.java @@ -44,7 +44,7 @@ import net.yacy.cora.util.ByteBuffer; import net.yacy.cora.util.ConcurrentLog; import net.yacy.cora.util.SpaceExceededException; import net.yacy.data.ListManager; -import net.yacy.document.Condenser; +import net.yacy.document.Tokenizer; import net.yacy.kelondro.data.meta.URIMetadataNode; import net.yacy.kelondro.data.word.Word; import net.yacy.kelondro.data.word.WordReference; @@ -526,11 +526,11 @@ public class IndexControlRWIs_p { prop.putNum("genUrlList_urlList_" + i + "_urlExists_urllength", entry.word().urllength()); prop.put( "genUrlList_urlList_" + i + "_urlExists_props", - ((entry.word().flags().get(Condenser.flag_cat_indexof)) ? "appears on index page, " : "") - + ((entry.word().flags().get(Condenser.flag_cat_hasimage)) ? "contains images, " : "") - + ((entry.word().flags().get(Condenser.flag_cat_hasaudio)) ? "contains audio, " : "") - + ((entry.word().flags().get(Condenser.flag_cat_hasvideo)) ? "contains video, " : "") - + ((entry.word().flags().get(Condenser.flag_cat_hasapp)) ? "contains applications, " : "") + ((entry.word().flags().get(Tokenizer.flag_cat_indexof)) ? "appears on index page, " : "") + + ((entry.word().flags().get(Tokenizer.flag_cat_hasimage)) ? "contains images, " : "") + + ((entry.word().flags().get(Tokenizer.flag_cat_hasaudio)) ? "contains audio, " : "") + + ((entry.word().flags().get(Tokenizer.flag_cat_hasvideo)) ? "contains video, " : "") + + ((entry.word().flags().get(Tokenizer.flag_cat_hasapp)) ? "contains applications, " : "") + ((entry.word().flags().get(WordReferenceRow.flag_app_dc_identifier)) ? "appears in url, " : "") + ((entry.word().flags().get(WordReferenceRow.flag_app_dc_title)) ? "appears in title, " : "") + ((entry.word().flags().get(WordReferenceRow.flag_app_dc_creator)) ? "appears in author, " : "") @@ -590,19 +590,19 @@ public class IndexControlRWIs_p { b.set(WordReferenceRow.flag_app_emphasized, true); } if ( post.get("image", "").equals("on") ) { - b.set(Condenser.flag_cat_hasimage, true); + b.set(Tokenizer.flag_cat_hasimage, true); } if ( post.get("audio", "").equals("on") ) { - b.set(Condenser.flag_cat_hasaudio, true); + b.set(Tokenizer.flag_cat_hasaudio, true); } if ( post.get("video", "").equals("on") ) { - b.set(Condenser.flag_cat_hasvideo, true); + b.set(Tokenizer.flag_cat_hasvideo, true); } if ( post.get("app", "").equals("on") ) { - b.set(Condenser.flag_cat_hasapp, true); + b.set(Tokenizer.flag_cat_hasapp, true); } if ( post.get("indexof", "").equals("on") ) { - b.set(Condenser.flag_cat_indexof, true); + b.set(Tokenizer.flag_cat_indexof, true); } return b; } @@ -678,11 +678,11 @@ public class IndexControlRWIs_p { prop.put("searchresult_subject", theSearch.flagCount()[WordReferenceRow.flag_app_dc_subject]); prop.put("searchresult_url", theSearch.flagCount()[WordReferenceRow.flag_app_dc_identifier]); prop.put("searchresult_emphasized", theSearch.flagCount()[WordReferenceRow.flag_app_emphasized]); - prop.put("searchresult_image", theSearch.flagCount()[Condenser.flag_cat_hasimage]); - prop.put("searchresult_audio", theSearch.flagCount()[Condenser.flag_cat_hasaudio]); - prop.put("searchresult_video", theSearch.flagCount()[Condenser.flag_cat_hasvideo]); - prop.put("searchresult_app", theSearch.flagCount()[Condenser.flag_cat_hasapp]); - prop.put("searchresult_indexof", theSearch.flagCount()[Condenser.flag_cat_indexof]); + prop.put("searchresult_image", theSearch.flagCount()[Tokenizer.flag_cat_hasimage]); + prop.put("searchresult_audio", theSearch.flagCount()[Tokenizer.flag_cat_hasaudio]); + prop.put("searchresult_video", theSearch.flagCount()[Tokenizer.flag_cat_hasvideo]); + prop.put("searchresult_app", theSearch.flagCount()[Tokenizer.flag_cat_hasapp]); + prop.put("searchresult_indexof", theSearch.flagCount()[Tokenizer.flag_cat_indexof]); } return theSearch; } diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java index f7e58166f..d764621b9 100644 --- a/htroot/ViewFile.java +++ b/htroot/ViewFile.java @@ -46,11 +46,11 @@ import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.util.CommonPattern; import net.yacy.crawler.data.Cache; import net.yacy.crawler.retrieval.Response; -import net.yacy.document.Condenser; import net.yacy.document.Document; import net.yacy.document.LibraryProvider; import net.yacy.document.Parser; import net.yacy.document.SentenceReader; +import net.yacy.document.Tokenizer; import net.yacy.document.WordTokenizer; import net.yacy.document.parser.html.CharacterCoding; import net.yacy.document.parser.html.ImageEntry; @@ -158,7 +158,7 @@ public class ViewFile { descr = urlEntry.dc_title(); //urlEntry.wordCount(); size = urlEntry.filesize(); - pre = urlEntry.flags().get(Condenser.flag_cat_indexof); + pre = urlEntry.flags().get(Tokenizer.flag_cat_indexof); prop.put("moar", 1); prop.putHTML("moar_search", post.get("search","")); } diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index e31e95d2f..3706113bb 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -59,10 +59,10 @@ import net.yacy.data.BookmarksDB.Bookmark; import net.yacy.data.DidYouMean; import net.yacy.data.UserDB; import net.yacy.data.ymark.YMarkTables; -import net.yacy.document.Condenser; import net.yacy.document.Document; import net.yacy.document.LibraryProvider; import net.yacy.document.Parser; +import net.yacy.document.Tokenizer; import net.yacy.kelondro.data.meta.URIMetadataNode; import net.yacy.kelondro.util.Bitfield; import net.yacy.kelondro.util.Formatter; @@ -242,7 +242,7 @@ public class yacysearch { : null; if ( indexof ) { constraint = new Bitfield(4); - constraint.set(Condenser.flag_cat_indexof, true); + constraint.set(Tokenizer.flag_cat_indexof, true); } // SEARCH @@ -396,7 +396,7 @@ public class yacysearch { if ( constraint == null ) { constraint = new Bitfield(4); } - constraint.set(Condenser.flag_cat_haslocation, true); + constraint.set(Tokenizer.flag_cat_haslocation, true); modifier.add("/location"); } diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java index 5db301000..14b9c8edb 100644 --- a/htroot/yacysearchtrailer.java +++ b/htroot/yacysearchtrailer.java @@ -56,7 +56,7 @@ public class yacysearchtrailer { private static final int TOPWORDS_MINSIZE = 8; private static final int TOPWORDS_MAXSIZE = 22; - @SuppressWarnings({ "deprecation", "static-access" }) + @SuppressWarnings({ }) public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) { final serverObjects prop = new serverObjects(); final Switchboard sb = (Switchboard) env; diff --git a/source/net/yacy/cora/federate/solr/instance/EmbeddedInstance.java b/source/net/yacy/cora/federate/solr/instance/EmbeddedInstance.java index 4d169024f..b7d70569e 100644 --- a/source/net/yacy/cora/federate/solr/instance/EmbeddedInstance.java +++ b/source/net/yacy/cora/federate/solr/instance/EmbeddedInstance.java @@ -21,7 +21,6 @@ package net.yacy.cora.federate.solr.instance; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Collection; diff --git a/source/net/yacy/cora/federate/solr/responsewriter/EnhancedXMLResponseWriter.java b/source/net/yacy/cora/federate/solr/responsewriter/EnhancedXMLResponseWriter.java index 0aa9f77f3..3c92c4fab 100644 --- a/source/net/yacy/cora/federate/solr/responsewriter/EnhancedXMLResponseWriter.java +++ b/source/net/yacy/cora/federate/solr/responsewriter/EnhancedXMLResponseWriter.java @@ -258,7 +258,6 @@ public class EnhancedXMLResponseWriter implements QueryResponseWriter { writer.write(lb); } - @SuppressWarnings({ "static-access", "deprecation" }) private static void writeField(final Writer writer, final String typeName, final String name, final String value) throws IOException { if (typeName.equals(SolrType.text_general.printName()) || typeName.equals(SolrType.string.printName()) || @@ -279,7 +278,6 @@ public class EnhancedXMLResponseWriter implements QueryResponseWriter { } } - @SuppressWarnings({ "static-access", "deprecation" }) private static void writeField(final Writer writer, final String name, final Object value) throws IOException { if (value instanceof String) { writeTag(writer, "str", name, (String) value, true); diff --git a/source/net/yacy/cora/federate/solr/responsewriter/HTMLResponseWriter.java b/source/net/yacy/cora/federate/solr/responsewriter/HTMLResponseWriter.java index 2c19f6f68..ebff21190 100644 --- a/source/net/yacy/cora/federate/solr/responsewriter/HTMLResponseWriter.java +++ b/source/net/yacy/cora/federate/solr/responsewriter/HTMLResponseWriter.java @@ -218,7 +218,6 @@ public class HTMLResponseWriter implements QueryResponseWriter { return kv; } - @SuppressWarnings({ "static-access", "deprecation" }) private static String field2string(final FieldType type, final String value) { String typeName = type.getTypeName(); if (typeName.equals(SolrType.bool.printName())) { diff --git a/source/net/yacy/crawler/Balancer.java b/source/net/yacy/crawler/Balancer.java index 164a26c79..6b6a075c6 100644 --- a/source/net/yacy/crawler/Balancer.java +++ b/source/net/yacy/crawler/Balancer.java @@ -21,7 +21,6 @@ package net.yacy.crawler; -import java.io.File; import java.io.IOException; import java.util.Iterator; import java.util.List; diff --git a/source/net/yacy/crawler/RecrawlBusyThread.java b/source/net/yacy/crawler/RecrawlBusyThread.java index d896abf7f..d1e8eaea7 100644 --- a/source/net/yacy/crawler/RecrawlBusyThread.java +++ b/source/net/yacy/crawler/RecrawlBusyThread.java @@ -148,9 +148,8 @@ public class RecrawlBusyThread extends AbstractBusyThread { if (this.urlstack.isEmpty()) { return processSingleQuery(); - } else { - return feedToCrawler(); } + return feedToCrawler(); } diff --git a/source/net/yacy/data/BookmarksDB.java b/source/net/yacy/data/BookmarksDB.java index 94888598d..1f91ca92b 100644 --- a/source/net/yacy/data/BookmarksDB.java +++ b/source/net/yacy/data/BookmarksDB.java @@ -172,9 +172,8 @@ public class BookmarksDB { if (map == null) { ConcurrentLog.info("BOOKMARKS", "cannot get bookmark for url hash " + urlHash); return null; - } else { - return new Bookmark(map); } + return new Bookmark(map); } catch (final Throwable e) { return null; } diff --git a/source/net/yacy/data/WorkTables.java b/source/net/yacy/data/WorkTables.java index fc140a1ea..a7bff08c8 100644 --- a/source/net/yacy/data/WorkTables.java +++ b/source/net/yacy/data/WorkTables.java @@ -339,7 +339,7 @@ public class WorkTables extends Tables { row.put(WorkTables.TABLE_API_COL_DATE_NEXT_EXEC, new Date(d)); } - public void failURLsRegisterMissingWord(IndexCell indexCell, final DigestURL url, HandleSet queryHashes, final String reason) { + public void failURLsRegisterMissingWord(IndexCell indexCell, final DigestURL url, HandleSet queryHashes) { // remove words from index if (indexCell != null) { diff --git a/source/net/yacy/kelondro/data/meta/URIMetadataNode.java b/source/net/yacy/kelondro/data/meta/URIMetadataNode.java index ce296c95f..976bdd36c 100644 --- a/source/net/yacy/kelondro/data/meta/URIMetadataNode.java +++ b/source/net/yacy/kelondro/data/meta/URIMetadataNode.java @@ -46,8 +46,8 @@ import net.yacy.cora.lod.vocabulary.Tagging; import net.yacy.cora.order.Base64Order; import net.yacy.cora.util.ConcurrentLog; import net.yacy.crawler.retrieval.Response; -import net.yacy.document.Condenser; import net.yacy.document.SentenceReader; +import net.yacy.document.Tokenizer; import net.yacy.document.parser.pdfParser; import net.yacy.kelondro.data.word.Word; import net.yacy.kelondro.data.word.WordReferenceRow; @@ -389,14 +389,14 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable= 0) this.flags.set(Condenser.flag_cat_indexof, true); + if (dc_subject() != null && dc_subject().indexOf("indexof") >= 0) this.flags.set(Tokenizer.flag_cat_indexof, true); ContentDomain cd = getContentDomain(); - if (lon() != 0.0d || lat() != 0.0d) this.flags.set(Condenser.flag_cat_haslocation, true); - if (cd == ContentDomain.IMAGE || limage() > 0) this.flags.set(Condenser.flag_cat_hasimage, true); - if (cd == ContentDomain.AUDIO || laudio() > 0) this.flags.set(Condenser.flag_cat_hasaudio, true); - if (cd == ContentDomain.VIDEO || lvideo() > 0) this.flags.set(Condenser.flag_cat_hasvideo, true); - if (cd == ContentDomain.APP) this.flags.set(Condenser.flag_cat_hasapp, true); - if (lapp() > 0) this.flags.set(Condenser.flag_cat_hasapp, true); + if (lon() != 0.0d || lat() != 0.0d) this.flags.set(Tokenizer.flag_cat_haslocation, true); + if (cd == ContentDomain.IMAGE || limage() > 0) this.flags.set(Tokenizer.flag_cat_hasimage, true); + if (cd == ContentDomain.AUDIO || laudio() > 0) this.flags.set(Tokenizer.flag_cat_hasaudio, true); + if (cd == ContentDomain.VIDEO || lvideo() > 0) this.flags.set(Tokenizer.flag_cat_hasvideo, true); + if (cd == ContentDomain.APP) this.flags.set(Tokenizer.flag_cat_hasapp, true); + if (lapp() > 0) this.flags.set(Tokenizer.flag_cat_hasapp, true); } return this.flags; } @@ -707,7 +707,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable[heap]m - * @author [DW], 07.02.2009 - */ - private static int getWin32MaxHeap() { - int maxmem = 1000; - while(checkWin32Heap(maxmem)) maxmem += 100; - while(!checkWin32Heap(maxmem)) maxmem -= 10; - return maxmem; - } - - private final static ConcurrentLog memchecklog = new ConcurrentLog("MEMCHECK"); - - /** - * checks heap (may cause high system load) - * @param mem heap to check in -Xmx[heap]m - * @return true if possible - * @author [DW], 07.02.2009 - */ - private static boolean checkWin32Heap(final int mem){ - String line = ""; - final List processArgs = new ArrayList(); - processArgs.add("java"); - processArgs.add("-Xms4m"); - processArgs.add("-Xmx" + Integer.toString(mem) + "m"); - try { - line = ConsoleInterface.getLastLineConsoleOutput(processArgs, memchecklog); - } catch (final IOException e) { - return false; - } - return (line.indexOf("space for object heap",0) > -1) ? false : true; - } - public static String infoString() { String s = "System="; if (systemOS == System.Unknown) s += "unknown"; diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java index 6adcc5d18..ceafce8d2 100644 --- a/source/net/yacy/peers/Protocol.java +++ b/source/net/yacy/peers/Protocol.java @@ -47,9 +47,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; import java.net.InetAddress; -import java.net.URLDecoder; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; diff --git a/source/net/yacy/search/query/QueryModifier.java b/source/net/yacy/search/query/QueryModifier.java index a65ae1e31..f3db2f233 100644 --- a/source/net/yacy/search/query/QueryModifier.java +++ b/source/net/yacy/search/query/QueryModifier.java @@ -355,7 +355,6 @@ public class QueryModifier { Date onDate = DateDetection.parseLine(onDescription, timezoneOffset); StringBuilder filterQuery = new StringBuilder(20); if (onDate != null) { - @SuppressWarnings({ "deprecation", "static-access" }) String dstr = TrieDateField.formatExternal(onDate); filterQuery.append(CollectionSchema.dates_in_content_dts.getSolrFieldName()).append(":[").append(dstr).append(" TO ").append(dstr).append(']'); } @@ -367,9 +366,7 @@ public class QueryModifier { Date toDate = to == null || to.equals("*") ? null : DateDetection.parseLine(to, timezoneOffset); StringBuilder filterQuery = new StringBuilder(20); if (fromDate != null && toDate != null) { - @SuppressWarnings({ "deprecation", "static-access" }) String dstrFrom = fromDate == null ? "*" : TrieDateField.formatExternal(fromDate); - @SuppressWarnings({ "deprecation", "static-access" }) String dstrTo = toDate == null ? "*" : TrieDateField.formatExternal(toDate); filterQuery.append(CollectionSchema.dates_in_content_dts.getSolrFieldName()).append(":[").append(dstrFrom).append(" TO ").append(dstrTo).append(']'); } diff --git a/source/net/yacy/search/query/QueryParams.java b/source/net/yacy/search/query/QueryParams.java index 4f145b94e..28316350a 100644 --- a/source/net/yacy/search/query/QueryParams.java +++ b/source/net/yacy/search/query/QueryParams.java @@ -53,8 +53,8 @@ import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.storage.HandleSet; import net.yacy.cora.util.ConcurrentLog; import net.yacy.cora.util.SpaceExceededException; -import net.yacy.document.Condenser; import net.yacy.document.LibraryProvider; +import net.yacy.document.Tokenizer; import net.yacy.kelondro.data.word.Word; import net.yacy.kelondro.data.word.WordReferenceRow; import net.yacy.kelondro.index.RowHandleSet; @@ -349,7 +349,7 @@ public final class QueryParams { */ private final boolean matchesText(final String text) { boolean ret = false; - QueryGoal.NormalizedWords words = new QueryGoal.NormalizedWords(Condenser.getWords(text, null).keySet()); + QueryGoal.NormalizedWords words = new QueryGoal.NormalizedWords(Tokenizer.getWords(text, null).keySet()); if (!SetTools.anymatchByTest(this.queryGoal.getExcludeWords(), words)) { ret = SetTools.totalInclusion(this.queryGoal.getIncludeWords(), words); } @@ -358,7 +358,7 @@ public final class QueryParams { protected static final boolean anymatch(final String text, final Iterator keywords) { if (keywords == null || !keywords.hasNext()) return false; - final SortedSet textwords = (SortedSet) Condenser.getWords(text, null).keySet(); + final SortedSet textwords = (SortedSet) Tokenizer.getWords(text, null).keySet(); return SetTools.anymatchByTest(keywords, textwords); } @@ -448,9 +448,7 @@ public final class QueryParams { // add site facets fqs.addAll(getFacetsFilterQueries()); if (fqs.size() > 0) { - for (String f: fqs) { - params.setFilterQueries(fqs.toArray(new String[fqs.size()])); - } + params.setFilterQueries(fqs.toArray(new String[fqs.size()])); } // set facet query attributes @@ -463,9 +461,7 @@ public final class QueryParams { for (String field: this.facetfields) params.addFacetField("{!ex=" + field + "}" + field); // params.addFacetField("{!ex=" + field + "}" + field); if (this.facetfields.contains(CollectionSchema.dates_in_content_dts.name())) { params.setParam("facet.range", CollectionSchema.dates_in_content_dts.name()); - @SuppressWarnings({ "static-access", "deprecation" }) String start = TrieDateField.formatExternal(new Date(System.currentTimeMillis() - 1000L * 60L * 60L * 24L * 3)); - @SuppressWarnings({ "static-access", "deprecation" }) String end = TrieDateField.formatExternal(new Date(System.currentTimeMillis() + 1000L * 60L * 60L * 24L * 3)); params.setParam("f." + CollectionSchema.dates_in_content_dts.getSolrFieldName() + ".facet.range.start", start); params.setParam("f." + CollectionSchema.dates_in_content_dts.getSolrFieldName() + ".facet.range.end", end); diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java index c4b432551..70bf0b998 100644 --- a/source/net/yacy/search/query/SearchEvent.java +++ b/source/net/yacy/search/query/SearchEvent.java @@ -70,10 +70,10 @@ import net.yacy.cora.util.ConcurrentLog; import net.yacy.cora.util.SpaceExceededException; import net.yacy.crawler.retrieval.Response; import net.yacy.data.WorkTables; -import net.yacy.document.Condenser; import net.yacy.document.LargeNumberCache; import net.yacy.document.LibraryProvider; import net.yacy.document.TextParser; +import net.yacy.document.Tokenizer; import net.yacy.kelondro.data.meta.URIMetadataNode; import net.yacy.kelondro.data.word.Word; import net.yacy.kelondro.data.word.WordReference; @@ -601,10 +601,10 @@ public final class SearchEvent { // check document domain if (this.query.contentdom.getCode() > 0 && - ((this.query.contentdom == ContentDomain.AUDIO && !(flags.get(Condenser.flag_cat_hasaudio))) || - (this.query.contentdom == ContentDomain.VIDEO && !(flags.get(Condenser.flag_cat_hasvideo))) || - (this.query.contentdom == ContentDomain.IMAGE && !(flags.get(Condenser.flag_cat_hasimage))) || - (this.query.contentdom == ContentDomain.APP && !(flags.get(Condenser.flag_cat_hasapp))))) { + ((this.query.contentdom == ContentDomain.AUDIO && !(flags.get(Tokenizer.flag_cat_hasaudio))) || + (this.query.contentdom == ContentDomain.VIDEO && !(flags.get(Tokenizer.flag_cat_hasvideo))) || + (this.query.contentdom == ContentDomain.IMAGE && !(flags.get(Tokenizer.flag_cat_hasimage))) || + (this.query.contentdom == ContentDomain.APP && !(flags.get(Tokenizer.flag_cat_hasapp))))) { if (log.isFine()) log.fine("dropped RWI: contentdom fail"); continue pollloop; } @@ -926,10 +926,10 @@ public final class SearchEvent { // check document domain if (this.query.contentdom.getCode() > 0 && - ((this.query.contentdom == ContentDomain.AUDIO && !(flags.get(Condenser.flag_cat_hasaudio))) || - (this.query.contentdom == ContentDomain.VIDEO && !(flags.get(Condenser.flag_cat_hasvideo))) || - (this.query.contentdom == ContentDomain.IMAGE && !(flags.get(Condenser.flag_cat_hasimage))) || - (this.query.contentdom == ContentDomain.APP && !(flags.get(Condenser.flag_cat_hasapp))))) { + ((this.query.contentdom == ContentDomain.AUDIO && !(flags.get(Tokenizer.flag_cat_hasaudio))) || + (this.query.contentdom == ContentDomain.VIDEO && !(flags.get(Tokenizer.flag_cat_hasvideo))) || + (this.query.contentdom == ContentDomain.IMAGE && !(flags.get(Tokenizer.flag_cat_hasimage))) || + (this.query.contentdom == ContentDomain.APP && !(flags.get(Tokenizer.flag_cat_hasapp))))) { if (log.isFine()) log.fine("dropped Node: content domain does not match"); continue pollloop; } @@ -1201,7 +1201,7 @@ public final class SearchEvent { } // check index-of constraint - if ((this.query.constraint != null) && (this.query.constraint.get(Condenser.flag_cat_indexof)) && (!(pagetitle.startsWith("index of")))) { + if ((this.query.constraint != null) && (this.query.constraint.get(Tokenizer.flag_cat_indexof)) && (!(pagetitle.startsWith("index of")))) { final Iterator wi = this.query.getQueryGoal().getIncludeHashes().iterator(); if (this.query.getSegment().termIndex() != null) { while (wi.hasNext()) { @@ -1214,7 +1214,7 @@ public final class SearchEvent { } // check location constraint - if ((this.query.constraint != null) && (this.query.constraint.get(Condenser.flag_cat_haslocation)) && (page.lat() == 0.0 || page.lon() == 0.0)) { + if ((this.query.constraint != null) && (this.query.constraint.get(Tokenizer.flag_cat_haslocation)) && (page.lat() == 0.0 || page.lon() == 0.0)) { if (log.isFine()) log.fine("dropped RWI: location constraint"); if (page.word().local()) this.local_rwi_available.decrementAndGet(); else this.remote_rwi_available.decrementAndGet(); continue; @@ -1443,7 +1443,7 @@ public final class SearchEvent { page, this.snippetFetchWordHashes, null, - ((this.query.constraint != null) && (this.query.constraint.get(Condenser.flag_cat_indexof))), + ((this.query.constraint != null) && (this.query.constraint.get(Tokenizer.flag_cat_indexof))), SearchEvent.SNIPPET_MAX_LENGTH, !this.query.isLocal()); return page.makeResultEntry(this.query.getSegment(), this.peers, snippet); // result without snippet @@ -1459,7 +1459,7 @@ public final class SearchEvent { page, this.snippetFetchWordHashes, cacheStrategy, - ((this.query.constraint != null) && (this.query.constraint.get(Condenser.flag_cat_indexof))), + ((this.query.constraint != null) && (this.query.constraint.get(Tokenizer.flag_cat_indexof))), 180, !this.query.isLocal()); SearchEvent.log.info("text snippet load time for " + page.url().toNormalform(true) + ": " + (System.currentTimeMillis() - startTime) + " ms, " + (!snippet.getErrorCode().fail() ? "snippet found" : ("no snippet found (" + snippet.getError() + ")"))); @@ -1479,7 +1479,7 @@ public final class SearchEvent { } final String reason = "no text snippet; errorCode = " + snippet.getErrorCode(); if (this.deleteIfSnippetFail) { - this.workTables.failURLsRegisterMissingWord(this.query.getSegment().termIndex(), page.url(), this.query.getQueryGoal().getIncludeHashes(), reason); + this.workTables.failURLsRegisterMissingWord(this.query.getSegment().termIndex(), page.url(), this.query.getQueryGoal().getIncludeHashes()); } SearchEvent.log.info("sorted out url " + page.url().toNormalform(true) + " during search: " + reason); return null; diff --git a/source/net/yacy/search/ranking/ReferenceOrder.java b/source/net/yacy/search/ranking/ReferenceOrder.java index 23ffa7f08..fd6cf5be8 100644 --- a/source/net/yacy/search/ranking/ReferenceOrder.java +++ b/source/net/yacy/search/ranking/ReferenceOrder.java @@ -38,8 +38,8 @@ import net.yacy.cora.document.id.DigestURL; import net.yacy.cora.sorting.ConcurrentScoreMap; import net.yacy.cora.util.ByteBuffer; import net.yacy.cora.util.ConcurrentLog; -import net.yacy.document.Condenser; import net.yacy.document.LargeNumberCache; +import net.yacy.document.Tokenizer; import net.yacy.kelondro.data.meta.URIMetadataNode; import net.yacy.kelondro.data.word.WordReference; import net.yacy.kelondro.data.word.WordReferenceRow; @@ -253,11 +253,11 @@ public class ReferenceOrder { + ((flags.get(WordReferenceRow.flag_app_dc_subject)) ? 255 << this.ranking.coeff_app_dc_subject : 0) + ((flags.get(WordReferenceRow.flag_app_dc_description)) ? 255 << this.ranking.coeff_app_dc_description : 0) + ((flags.get(WordReferenceRow.flag_app_emphasized)) ? 255 << this.ranking.coeff_appemph : 0) - + ((flags.get(Condenser.flag_cat_indexof)) ? 255 << this.ranking.coeff_catindexof : 0) - + ((flags.get(Condenser.flag_cat_hasimage)) ? 255 << this.ranking.coeff_cathasimage : 0) - + ((flags.get(Condenser.flag_cat_hasaudio)) ? 255 << this.ranking.coeff_cathasaudio : 0) - + ((flags.get(Condenser.flag_cat_hasvideo)) ? 255 << this.ranking.coeff_cathasvideo : 0) - + ((flags.get(Condenser.flag_cat_hasapp)) ? 255 << this.ranking.coeff_cathasapp : 0) + + ((flags.get(Tokenizer.flag_cat_indexof)) ? 255 << this.ranking.coeff_catindexof : 0) + + ((flags.get(Tokenizer.flag_cat_hasimage)) ? 255 << this.ranking.coeff_cathasimage : 0) + + ((flags.get(Tokenizer.flag_cat_hasaudio)) ? 255 << this.ranking.coeff_cathasaudio : 0) + + ((flags.get(Tokenizer.flag_cat_hasvideo)) ? 255 << this.ranking.coeff_cathasvideo : 0) + + ((flags.get(Tokenizer.flag_cat_hasapp)) ? 255 << this.ranking.coeff_cathasapp : 0) + ((ByteBuffer.equals(t.getLanguage(), ASCII.getBytes(this.language))) ? 255 << this.ranking.coeff_language : 0); //if (searchWords != null) r += (yacyURL.probablyWordURL(t.urlHash(), searchWords) != null) ? 256 << ranking.coeff_appurl : 0; @@ -286,11 +286,11 @@ public class ReferenceOrder { + ((flags.get(WordReferenceRow.flag_app_dc_subject)) ? 255 << this.ranking.coeff_app_dc_subject : 0) + ((flags.get(WordReferenceRow.flag_app_dc_description)) ? 255 << this.ranking.coeff_app_dc_description : 0) + ((flags.get(WordReferenceRow.flag_app_emphasized)) ? 255 << this.ranking.coeff_appemph : 0) - + ((flags.get(Condenser.flag_cat_indexof)) ? 255 << this.ranking.coeff_catindexof : 0) - + ((flags.get(Condenser.flag_cat_hasimage)) ? 255 << this.ranking.coeff_cathasimage : 0) - + ((flags.get(Condenser.flag_cat_hasaudio)) ? 255 << this.ranking.coeff_cathasaudio : 0) - + ((flags.get(Condenser.flag_cat_hasvideo)) ? 255 << this.ranking.coeff_cathasvideo : 0) - + ((flags.get(Condenser.flag_cat_hasapp)) ? 255 << this.ranking.coeff_cathasapp : 0) + + ((flags.get(Tokenizer.flag_cat_indexof)) ? 255 << this.ranking.coeff_catindexof : 0) + + ((flags.get(Tokenizer.flag_cat_hasimage)) ? 255 << this.ranking.coeff_cathasimage : 0) + + ((flags.get(Tokenizer.flag_cat_hasaudio)) ? 255 << this.ranking.coeff_cathasaudio : 0) + + ((flags.get(Tokenizer.flag_cat_hasvideo)) ? 255 << this.ranking.coeff_cathasvideo : 0) + + ((flags.get(Tokenizer.flag_cat_hasapp)) ? 255 << this.ranking.coeff_cathasapp : 0) + ((this.language.equals(t.language())) ? 255 << this.ranking.coeff_language : 0); return r; // the higher the number the better the ranking. } diff --git a/source/net/yacy/utils/cryptbig.java b/source/net/yacy/utils/cryptbig.java index cb077d29f..3ec3cdd23 100644 --- a/source/net/yacy/utils/cryptbig.java +++ b/source/net/yacy/utils/cryptbig.java @@ -388,7 +388,7 @@ public class cryptbig { return salt + ((gzFlag) ? "1" : "0") + Base64Order.enhancedCoder.encode(enc); } - public static String descrambleString(final String key, String s) throws IOException { + public static String descrambleString(final String key, String s) { final String salt = s.substring(0, 8); final boolean gzFlag = (s.charAt(8) == '1'); s = s.substring(9); @@ -425,7 +425,7 @@ public class cryptbig { return null; } - public static String simpleDecode(String encoded, final String key) throws IOException { + public static String simpleDecode(String encoded, final String key) { if ((encoded == null) || (encoded.length() < 3)) return null; if (encoded.charAt(1) != '|') return encoded; // not encoded final char method = encoded.charAt(0); @@ -611,12 +611,7 @@ public class cryptbig { // 'descramble' string if (s.length != 3) {help(); System.exit(-1);} final long t = System.currentTimeMillis(); - try { - System.out.println(descrambleString(s[1], s[2])); - } catch (final IOException e) { - // TODO Auto-generated catch block - ConcurrentLog.logException(e); - } + System.out.println(descrambleString(s[1], s[2])); System.out.println("Calculation time: " + (System.currentTimeMillis() - t) + " milliseconds"); System.exit(0); }