90 IriSP.JSONSerializer.prototype.searchTweets = function(title, description, keyword) { |
90 IriSP.JSONSerializer.prototype.searchTweets = function(title, description, keyword) { |
91 /* we can have many types of annotations. We want search to only look for regular segments */ |
91 /* we can have many types of annotations. We want search to only look for regular segments */ |
92 /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either |
92 /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either |
93 null or undefined. |
93 null or undefined. |
94 */ |
94 */ |
95 var view; |
95 |
96 |
96 var searchViewType = this.getTweets(); |
97 if (typeof(this._data.views) !== "undefined" && this._data.views !== null) |
97 if (typeof(searchViewType) === "undefined") { |
98 view = this._data.views[0]; |
98 var view; |
99 |
99 |
100 var searchViewType = ""; |
100 if (typeof(this._data.views) !== "undefined" && this._data.views !== null) |
101 |
101 view = this._data.views[0]; |
102 if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { |
102 |
103 searchViewType = view.annotation_types[0]; |
103 if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { |
104 } |
104 searchViewType = view.annotation_types[0]; |
105 |
105 } |
|
106 } |
106 var filterfn = function(annotation) { |
107 var filterfn = function(annotation) { |
107 if( searchViewType != "" && |
108 if( searchViewType != "" && |
108 typeof(annotation.meta) !== "undefined" && |
109 typeof(annotation.meta) !== "undefined" && |
109 typeof(annotation.meta["id-ref"]) !== "undefined" && |
110 typeof(annotation.meta["id-ref"]) !== "undefined" && |
110 annotation.meta["id-ref"] !== searchViewType) { |
111 annotation.meta["id-ref"] === searchViewType) { |
111 return false; // pass |
112 return false; // pass |
112 } else { |
113 } else { |
113 return true; |
114 return true; |
114 } |
115 } |
115 }; |
116 }; |