Author: j16sdiz
Date: 2008-12-11 08:00:28 +0000 (Thu, 11 Dec 2008)
New Revision: 24198
Modified:
trunk/plugins/XMLSpider/XMLSpider.java
Log:
memory optimization: move lastPosition to inner class
Modified: trunk/plugins/XMLSpider/XMLSpider.java
===================================================================
--- trunk/plugins/XMLSpider/XMLSpider.java 2008-12-11 07:56:25 UTC (rev
24197)
+++ trunk/plugins/XMLSpider/XMLSpider.java 2008-12-11 08:00:28 UTC (rev
24198)
@@ -182,7 +182,6 @@
private static final String indexOwnerEmail = null;
// private final HashMap lastPositionByURI = new HashMap(); /* String
(URI) -> Integer */ /* Use to determine word position on each uri */
- private final HashMap<Long, Long> lastPositionById = new HashMap<Long,
Long>();
// private final HashMap positionsByWordByURI = new HashMap(); /* String
(URI) -> HashMap (String (word) -> Integer[] (Positions)) */
private final HashMap<Long, HashMap<String, Long[]>>
positionsByWordById = new HashMap<Long, HashMap<String, Long[]>>();
// Can have many; this limit only exists to save memory.
@@ -1239,7 +1238,8 @@
startSomeRequests();
}
-
+ Long lastPosition = null;
+
public void onText(String s, String type, URI baseURI){
Logger.debug(this, "onText on " + page.id + " (" +
baseURI + ")");
@@ -1257,8 +1257,6 @@
* FIXME - replace with a real tokenizor
*/
String[] words = s.split("[^\\p{L}\\{N}]");
- Long lastPosition = null;
- lastPosition = lastPositionById.get(page.id);
if(lastPosition == null)
lastPosition = 1L;
@@ -1279,9 +1277,7 @@
if(type == null) {
lastPosition = lastPosition + words.length;
- lastPositionById.put(page.id, lastPosition);
}
-
}
private void addWord(String word, long position, Long id)
throws Exception {
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs