yaz/commit

FIX reconciliation API according to standard

authorMichiel Hildebrand
Mon Nov 7 15:45:28 2011 +0100
committerMichiel Hildebrand
Mon Nov 7 15:45:28 2011 +0100
commit6a68668f3d9a724496e0adae010a94ea68f92b21
treef311afba64f49edaf6ac24fadb9bbe00d2a8344b
parent57508f178160c0b5e119c0e61f0597807a7cbdd7
Diff style: patch stat
diff --git a/api/reconcile.pl b/api/reconcile.pl
index 492c3c2..89fbc4e 100644
--- a/api/reconcile.pl
+++ b/api/reconcile.pl
@@ -45,7 +45,7 @@ flush_reconcile_cache :-
 http_reconcile(Request) :-
 	http_parameters(Request,
 			[ query(Query,
-				[atom,
+				[json,
 				 optional(true),
 				 description('a string to search for')
 				]),
@@ -53,29 +53,29 @@ http_reconcile(Request) :-
 				[json,
 				 optional(true),
 				 description('a json object of the form {q1:{query:STRING}, ...}')]),
-			  limit(Limit,
-			      [number, default(3),
-			       description('Number of results to return per query')]),
-			  type(Type,
-			       [(atom;json), default([]),
-				description('A string or a array of strings specificing the types of result')]),
-			  /*type_strict(TypeStrict, optional(true), one_of([any,all,should]),
-				      [description('')]),*/
-			  properties(Properties,
-				     [json, default([]),
-				      descirption('array of json object literals')]),
 			  callback(Callback,
 				   [optional(true),
 				    description('callback function for JSONP results')
 				   ])
 			]),
+	Limit = 3,
+	Type = [],
+	Properties = [],
 	(   nonvar(Queries), Queries = json(QueryList)
 	->  reconcile_list(QueryList, Limit, Type, Properties, Results),
 	    reply(Callback, json(Results))
-	;   nonvar(Query)
+	;   atom(Query)
 	->  reconcile(Query, Limit, Type, Properties, Hits),
 	    hits_to_json_results(Hits, Results),
 	    reply(Callback, json([result=Results]))
+	;   Query = json(Options),
+	    option(query(Q), Options),
+	    option(limit(L), Options, Limit),
+	    option(type(T), Options, Type),
+	    option(properties(Ps), Options, Properties)
+	->  reconcile(Q, L, T, Ps, Hits),
+	    hits_to_json_results(Hits, Results),
+	    reply(Callback, json([result=Results]))
 	;   reply(Callback, json([]))
 	).
 
diff --git a/web/js/tagplayer/tagLinker.js b/web/js/tagplayer/tagLinker.js
index 0315cdb..044161f 100644
--- a/web/js/tagplayer/tagLinker.js
+++ b/web/js/tagplayer/tagLinker.js
@@ -170,7 +170,7 @@ YUI.add('tag-linker', function(Y) {
 
 			var html = "<input type=radio name='reconcileItem' value='"+id+"'>";
 			html += "<span class='name'>"+name+"</span>";
-			if(types) {
+			if(types&&!item.desc) {
 				html += "<div class='types'>";
 				html += "<span class='type'>"+types[0].name+"</span>";
 				html +=	"</div>";