cluster_search/commit

Search target is now a parameter.

authorChris Dijkshoorn
Wed Mar 11 14:01:31 2015 +0000
committerChris Dijkshoorn
Wed Mar 11 14:01:31 2015 +0000
commit32532a41fd215e16c53f82e4f682ec51b4d233e0
tree8b2ef982aff4090a511e105a586af7a8f6974cee
parent2b15711db3aa2fe8476ecae2f659fa112a9976c2
Diff style: patch stat
diff --git a/api/cluster_search.pl b/api/cluster_search.pl
index 5c7e7cc..1891731 100644
--- a/api/cluster_search.pl
+++ b/api/cluster_search.pl
@@ -36,9 +36,13 @@ cluster_search_api(Request) :-
 %
 %	Retrieves an option list of parameters from the url.
 get_parameters(Request, Options) :-
+	setting(cluster_search:basic_search_target, SearchTarget),
     http_parameters(Request,
-	[query(Query, [description('Entered Query'), optional(false)])]),
-    Options = [query(Query)].
+	[query(Query,
+	     [description('Entered Query'), optional(false)]),
+	 target(Target,
+		 [default(SearchTarget)])]),
+    Options = [query(Query), target(Target)].
 
 %%	cluster_search(-Clusters, +Options)
 %
@@ -48,8 +52,10 @@ get_parameters(Request, Options) :-
 %	including the search graph.
 cluster_search(Clusters, Options) :-
     option(query(Query), Options),
+	option(target(Target), Options),
     debug(query, 'cluster_search Query: ~p', [Query]),
-    SearchOptions = [graphOutput(spo),
+    SearchOptions = [target(Target),
+		             graphOutput(spo),
 					 edge_limit(30),
 					 threshold(0.001)],
     graph_search(Query, State, SearchOptions),
diff --git a/lib/cluster_search/graph_search.pl b/lib/cluster_search/graph_search.pl
index 4502d08..836b543 100644
--- a/lib/cluster_search/graph_search.pl
+++ b/lib/cluster_search/graph_search.pl
@@ -47,7 +47,7 @@ graph_search(Keyword, State, Options) :-
     ).
 
 do_graph_search(Keyword, State, Options) :-
-    setting(cluster_search:basic_search_target, SearchTarget),
+	option(target(SearchTarget), Options),
     filter_to_goal([type(SearchTarget)], R, Goal, Options),
     TargetCond = target_goal(Goal, R),
     rdf_backward_search(Keyword, TargetCond, State, Options),