2005-12-04 jrandom

* Bugfix in Syndie for a problem in the threaded indexer (thanks CofE!)
    * Always include ourselves in the favorite authors (since we don't
      bookmark ourselves)
This commit is contained in:
jrandom
2005-12-04 20:02:24 +00:00
committed by zzz
parent 5faca98176
commit fbd7feee61
4 changed files with 30 additions and 4 deletions

View File

@ -84,6 +84,7 @@ class ArchiveIndexer {
totalSize += entry.getCompleteSize(); totalSize += entry.getCompleteSize();
String entryTags[] = entry.getTags(); String entryTags[] = entry.getTags();
threads.addEntry(entry.getURI(), entryTags); threads.addEntry(entry.getURI(), entryTags);
log.debug("Adding entry " + entry.getURI() + " to the threads, with tag count " + (entryTags != null ? entryTags.length : 0));
for (int t = 0; t < entryTags.length; t++) { for (int t = 0; t < entryTags.length; t++) {
if (!tags.containsKey(entryTags[t])) { if (!tags.containsKey(entryTags[t])) {
tags.put(entryTags[t], new TreeMap()); tags.put(entryTags[t], new TreeMap());
@ -106,6 +107,7 @@ class ArchiveIndexer {
String forceNewThread = rec.getHeader(HTMLRenderer.HEADER_FORCE_NEW_THREAD); String forceNewThread = rec.getHeader(HTMLRenderer.HEADER_FORCE_NEW_THREAD);
if ( (forceNewThread != null) && (Boolean.valueOf(forceNewThread).booleanValue()) ) { if ( (forceNewThread != null) && (Boolean.valueOf(forceNewThread).booleanValue()) ) {
// ignore the parent // ignore the parent
log.warn("Ignore the parent of " + entry.getURI() + ": " + reply);
} else { } else {
BlogURI parent = new BlogURI(reply.trim()); BlogURI parent = new BlogURI(reply.trim());
if ( (parent.getKeyHash() != null) && (parent.getEntryId() >= 0) ) { if ( (parent.getKeyHash() != null) && (parent.getEntryId() >= 0) ) {

View File

@ -29,7 +29,12 @@ class WritableThreadIndex extends ThreadIndex {
void addParent(BlogURI parent, BlogURI child) { _parents.put(child, parent); } void addParent(BlogURI parent, BlogURI child) { _parents.put(child, parent); }
void addEntry(BlogURI entry, String tags[]) { void addEntry(BlogURI entry, String tags[]) {
if (tags == null) tags = NO_TAGS; if (tags == null) tags = NO_TAGS;
String oldTags[] = (String[])_tags.put(entry, tags); Object old = _tags.get(entry);
if (old != null) {
System.err.println("Old value: " + old + " new tags: " + tags + " entry: " + entry);
} else {
_tags.put(entry, tags);
}
} }
/** /**
@ -108,8 +113,10 @@ class WritableThreadIndex extends ThreadIndex {
while (node.getParent() != null) while (node.getParent() != null)
node = node.getParent(); node = node.getParent();
if (!roots.contains(node)) {
roots.add(node); roots.add(node);
} }
}
// store them, sorted by most recently updated thread first // store them, sorted by most recently updated thread first
for (Iterator iter = roots.iterator(); iter.hasNext(); ) for (Iterator iter = roots.iterator(); iter.hasNext(); )
@ -151,6 +158,12 @@ class WritableThreadIndex extends ThreadIndex {
ThreadNodeImpl right = (ThreadNodeImpl)rhs; ThreadNodeImpl right = (ThreadNodeImpl)rhs;
long l = left.getMostRecentPostDate(); long l = left.getMostRecentPostDate();
long r = right.getMostRecentPostDate(); long r = right.getMostRecentPostDate();
if (l > r) {
return -1;
} else if (l == r) {
// ok, the newest responses match, so lets fall back and compare the roots themselves
l = left.getEntry().getEntryId();
r = right.getEntry().getEntryId();
if (l > r) { if (l > r) {
return -1; return -1;
} else if (l == r) { } else if (l == r) {
@ -158,6 +171,9 @@ class WritableThreadIndex extends ThreadIndex {
} else { } else {
return 1; return 1;
} }
} else {
return 1;
}
} }
} }
} }

View File

@ -79,6 +79,9 @@ public class ViewThreadedServlet extends BaseServlet {
} }
} }
} }
// always include ourselves...
aindex.selectMatchesOrderByEntryId(rv, user.getBlog(), tags, dayBegin);
Collections.sort(rv, BlogURI.COMPARATOR); Collections.sort(rv, BlogURI.COMPARATOR);
} else { } else {
Hash loc = new Hash(); Hash loc = new Hash();

View File

@ -1,4 +1,9 @@
$Id: history.txt,v 1.344 2005/12/03 14:03:46 jrandom Exp $ $Id: history.txt,v 1.345 2005/12/03 22:18:09 jrandom Exp $
2005-12-04 jrandom
* Bugfix in Syndie for a problem in the threaded indexer (thanks CofE!)
* Always include ourselves in the favorite authors (since we don't
bookmark ourselves)
2005-12-03 jrandom 2005-12-03 jrandom
* Use newgroup-like tags by default in Syndie's interface * Use newgroup-like tags by default in Syndie's interface