update QC filtering to be only selected quality flags (#8)

* update QC filtering to be only selected quality flags, don't include higher quality flags, and default to good if not specified

* remove SPURS and SPURS2 since they don't store quality flags
diff --git a/src/main/python/plugins/icoads/json/Writer.py b/src/main/python/plugins/icoads/json/Writer.py
index dfd5163..4d6d0de 100644
--- a/src/main/python/plugins/icoads/json/Writer.py
+++ b/src/main/python/plugins/icoads/json/Writer.py
@@ -23,6 +23,10 @@
         return response.generate(solrResponse, pretty=pretty)
 
     def _constructSolrQuery(self, startIndex, entriesPerPage, parameters, facets):
+        # if no QC flag is given, default to only good
+        if not "qualityFlag" in parameters.keys():
+            parameters['qualityFlag'] = 1
+
         queries = []
         filterQueries = []
         sort = None
@@ -65,11 +69,20 @@
                 elif key == "qualityFlag":
                     if 'variable' in parameters:
                         if parameters['variable'].lower() == 'sss':
-                            filterQueries.append('(sss_qc_flag:[*%20TO%20'+value+'])')
+                            if type(value) is list:
+                                filterQueries.append('(sss_qc_flag:(' + '+OR+'.join(value) + '))')
+                            else:
+                                filterQueries.append('(sss_qc_flag:('+value+'))')
                         elif parameters['variable'].lower() == 'sst':
-                            filterQueries.append('(sst_qc_flag:[*%20TO%20'+value+'])')
+                            if type(value) is list:
+                                filterQueries.append('(sst_qc_flag:(' + '+OR+'.join(value) + '))')
+                            else:
+                                filterQueries.append('(sst_qc_flag:('+value+'))')
                         elif parameters['variable'].lower() == 'wind':
-                            filterQueries.append('(wind_qc_flag:[*%20TO%20'+value+'])')
+                            if type(value) is list:
+                                filterQueries.append('(wind_qc_flag:(' + '+OR+'.join(value) + '))')
+                            else:
+                                filterQueries.append('(wind_qc_flag:(' + value + '))')
                 elif key == 'platform':
                     if type(value) is list:
                         filterQueries.append('platform:(' + '+OR+'.join(value) + ')')
diff --git a/src/main/python/plugins/samos/json/Writer.py b/src/main/python/plugins/samos/json/Writer.py
index b0a10ab..21dc337 100644
--- a/src/main/python/plugins/samos/json/Writer.py
+++ b/src/main/python/plugins/samos/json/Writer.py
@@ -23,6 +23,10 @@
         return response.generate(solrResponse, pretty=pretty)
 
     def _constructSolrQuery(self, startIndex, entriesPerPage, parameters, facets):
+        # if no QC flag is given, default to only good
+        if not "qualityFlag" in parameters.keys():
+            parameters['qualityFlag'] = 1
+
         queries = []
         filterQueries = []
         sort = None
@@ -65,12 +69,22 @@
                 elif key == "qualityFlag":
                     if 'variable' in parameters:
                         if parameters['variable'].lower() == 'sss':
-                            filterQueries.append('(SSS_quality:[*%20TO%20'+value+'])')
+                            if type(value) is list:
+                                filterQueries.append('(SSS_quality:(' + '+OR+'.join(value) + '))')
+                            else:
+                                filterQueries.append('(SSS_quality:(' + value + '))')
                         elif parameters['variable'].lower() == 'sst':
-                            filterQueries.append('(SST_quality:[*%20TO%20'+value+'])')
+                            if type(value) is list:
+                                filterQueries.append('(SST_quality:(' + '+OR+'.join(value) + '))')
+                            else:
+                                filterQueries.append('(SST_quality:(' + value + '))')
                         elif parameters['variable'].lower() == 'wind':
-                            filterQueries.append('(wind_speed_quality:[*%20TO%20'+value+'])')
-                            filterQueries.append('(wind_component_quality:[*%20TO%20'+value+'])')
+                            if type(value) is list:
+                                filterQueries.append('(wind_speed_quality:(' + '+OR+'.join(value) + '))')
+                                filterQueries.append('(wind_component_quality:(' + '+OR+'.join(value) + '))')
+                            else:
+                                filterQueries.append('(wind_speed_quality:(' + value + '))')
+                                filterQueries.append('(wind_component_quality:(' + value + '))')
                 elif key == 'platform':
                     if type(value) is list:
                         filterQueries.append('platform:(' + '+OR+'.join(value) + ')')
diff --git a/src/main/python/plugins/spurs/json/Writer.py b/src/main/python/plugins/spurs/json/Writer.py
index 126089f..b86096a 100644
--- a/src/main/python/plugins/spurs/json/Writer.py
+++ b/src/main/python/plugins/spurs/json/Writer.py
@@ -26,6 +26,10 @@
     def _constructSolrQuery(self, startIndex, entriesPerPage, parameters, facets):
         variable = json.loads(self._configuration.get('solr', 'variable'))
 
+        # if no QC flag is given, default to only good
+        if not "qualityFlag" in parameters.keys():
+            parameters['qualityFlag'] = 1
+
         queries = []
         filterQueries = []
         sort = None
diff --git a/src/main/python/plugins/spurs2/json/Writer.py b/src/main/python/plugins/spurs2/json/Writer.py
index 126089f..b86096a 100644
--- a/src/main/python/plugins/spurs2/json/Writer.py
+++ b/src/main/python/plugins/spurs2/json/Writer.py
@@ -26,6 +26,10 @@
     def _constructSolrQuery(self, startIndex, entriesPerPage, parameters, facets):
         variable = json.loads(self._configuration.get('solr', 'variable'))
 
+        # if no QC flag is given, default to only good
+        if not "qualityFlag" in parameters.keys():
+            parameters['qualityFlag'] = 1
+
         queries = []
         filterQueries = []
         sort = None