- added attributes to /xml/bookmarks/tags/get.xml

- top=number returns the number most frequent tags
- sort=comporator lets you choose between "size" and "alpha" as comporator function
- tag=tagName returns all tags associated with bookmarks tagged with tagName

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4790 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
apfelmaennchen 17 years ago
parent 2080ff72b7
commit 6c79edcd56

@ -50,17 +50,27 @@ package xml.bookmarks.tags;
import java.util.Iterator;
import de.anomic.data.bookmarksDB;
import de.anomic.data.bookmarksDB.Tag;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class get {
final static int SORT_ALPHA = 1;
final static int SORT_SIZE = 2;
final static int SHOW_ALL = -1;
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch<?> env) {
// return variable that accumulates replacements
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
boolean isAdmin=switchboard.verifyAuthentication(header, true);
serverObjects prop = new serverObjects();
Iterator<Tag> it = null;
String tagName = "";
int top = SHOW_ALL;
int comp = SORT_ALPHA;
if(post != null){
if(!isAdmin){
@ -71,7 +81,26 @@ public class get {
}
}
Iterator<bookmarksDB.Tag> it = switchboard.bookmarksDB.getTagIterator(isAdmin);
if(post.containsKey("top")) {
String s_top = (String) post.get("top");
top = Integer.parseInt(s_top);
}
if(post.containsKey("sort")) {
String sort = (String) post.get("sort");
if (sort.equals("size"))
comp = SORT_SIZE;
}
if(post.containsKey("tag")) {
tagName=(String) post.get("tag");
if (!tagName.equals("")) {
it = switchboard.bookmarksDB.getTagIterator(tagName, isAdmin, comp, top);
}
} else {
it = switchboard.bookmarksDB.getTagIterator(isAdmin, comp, top);
}
// Iterator<bookmarksDB.Tag> it = switchboard.bookmarksDB.getTagIterator(isAdmin);
int count=0;
bookmarksDB.Tag tag;
while (it.hasNext()) {

Loading…
Cancel
Save