Project

General

Profile

« Previous | Next » 

Revision 8098

revert NCEAS skin to use traditional pathquery.

View differences:

lib/style/skins/nceas/search.js
1
/**
2
 * Performs the search 
3
 */
4
function doSearch(serviceURL, searchFormId, browseAll) {
5
	var solrQuery = getSolrQuery(searchFormId);
6
	//alert(solrQuery);
7
	var url = serviceURL + "/" + solrQuery;
8
	// go directly there!
9
	document.location = url;
1
function trim(stringToTrim) {
2
    return stringToTrim.replace(/^\s*/, '').replace(/\s*$/,'');
10 3
}
11 4

  
12
/**
13
 * Constructs the SOLR query to use
14
 */
15
function getSolrQuery(searchFormId, browseAll) {
16
	var submitFormObj = document.getElementById(searchFormId);
5
function checkSearch(submitFormObj) {
17 6
    var searchString = trim(submitFormObj.searchstring.value);
18
    if (browseAll) {
19
    	searchString = "";
20
    }
21
    var qformat = submitFormObj.qformat.value;
7
    var checkBox = document.getElementById("searchAll");
22 8

  
23 9
    if (searchString=="") {
24
        if (confirm("Show *all* data?")) {
25
            searchString = "*";
10
        if (confirm("Show *all* data in the KNB?")) {
11
            searchString = "%";
26 12
        } else {
27 13
            return false;
28 14
        }
29 15
    }
30 16

  
31
    var formats = 
32
    	"("
33
        +"formatId: \"eml\\://ecoinformatics.org/eml-2.1.1\""
34
        +" OR "
35
        +"formatId: \"eml\\://ecoinformatics.org/eml-2.1.0\""
36
        +" OR "
37
        +"formatId: \"eml\\://ecoinformatics.org/eml-2.0.1\""
38
        +" OR "
39
        +"formatId: \"eml\\://ecoinformatics.org/eml-2.0.0\""
40
        +" OR "
41
        +"formatId: \"-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN\""
42
        +" OR "
43
        +"formatId: \"-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN\""
44
        +" OR "
45
        +"formatId: \"-//NCEAS//resource//EN\""
46
        +" OR "
47
        +"formatId: \"-//NCEAS//eml-dataset//EN\""
48
        +" OR "
49
        +"formatId: \"metadata\""
50
    	+")";
51
    
52
	var solrQuery = "q="
53
		+ searchString
54
		+" AND "
55
    	+ formats
56
    	+" AND "         
57
    	+"("
58
            +"contactOrganization: \"National Center for Ecological Analysis and Synthesis\""	                    
59
        +")"
60
        +"&wt=" + qformat;
61
    	
62
    	solrQuery = encodeURIComponent(solrQuery);
63
    
64
    return solrQuery;
17
    if (!checkBox.checked && searchString!="%") {
18
        submitFormObj.query.value = "<pathquery version=\"1.2\">"
19
            +"<querytitle>Web-Search</querytitle>"
20
            +"<returndoctype>eml://ecoinformatics.org/eml-2.1.1</returndoctype>"
21
            +"<returndoctype>eml://ecoinformatics.org/eml-2.1.0</returndoctype>"
22
            +"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>"
23
            +"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>"
24
            +"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>"
25
            +"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>"
26
            +"<returndoctype>-//NCEAS//resource//EN</returndoctype>"
27
            +"<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>"
28
            +"<returndoctype>metadata</returndoctype>"
29
            +"<returnfield>originator/individualName/surName</returnfield>"
30
            +"<returnfield>originator/individualName/givenName</returnfield>"
31
            +"<returnfield>creator/individualName/surName</returnfield>"
32
            +"<returnfield>creator/individualName/givenName</returnfield>"
33
            +"<returnfield>originator/organizationName</returnfield>"
34
            +"<returnfield>creator/organizationName</returnfield>"
35
            +"<returnfield>dataset/title</returnfield>"
36
            +"<returnfield>dataset/title/value</returnfield>"
37
            +"<returnfield>keyword</returnfield>"
38
            +"<returnfield>keyword/value</returnfield>"
39
            //fgdc fields
40
            +"<returnfield>idinfo/citation/citeinfo/title</returnfield>"
41
            +"<returnfield>idinfo/citation/citeinfo/origin</returnfield>"
42
			+"<returnfield>idinfo/keywords/theme/themekey</returnfield>"
43
            +"<querygroup operator=\"INTERSECT\">"
44
            	+"<querygroup operator=\"UNION\">"
45
	                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
46
	                    +"<value>National Center for Ecological Analysis and Synthesis</value>"
47
	                    +"<pathexpr>organizationName</pathexpr>"
48
	                +"</queryterm>"
49
	                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
50
	                    //+"<value>%</value>"
51
	                    +"<value>National Center for Ecological Analysis and Synthesis</value>"	                    
52
	                    +"<pathexpr>placekey</pathexpr>"
53
	                +"</queryterm>"
54
                +"</querygroup>"
55
                +"<querygroup operator=\"UNION\">"
56
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
57
                        +"<value>" + searchString + "</value>"
58
                        +"<pathexpr>surName</pathexpr>"
59
                    +"</queryterm>"
60
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
61
                        +"<value>" + searchString + "</value>"
62
                        +"<pathexpr>givenName</pathexpr>"
63
                    +"</queryterm>"
64
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
65
                        +"<value>" + searchString + "</value>"
66
                        +"<pathexpr>keyword</pathexpr>"
67
                    +"</queryterm>"
68
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
69
	                    +"<value>" + searchString + "</value>"
70
	                    +"<pathexpr>keyword/value</pathexpr>"
71
	                +"</queryterm>"
72
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
73
                        +"<value>" + searchString + "</value>"
74
                        +"<pathexpr>para</pathexpr>"
75
                    +"</queryterm>"
76
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
77
                        +"<value>" + searchString + "</value>"
78
                        +"<pathexpr>geographicDescription</pathexpr>"
79
                    +"</queryterm>"
80
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
81
                        +"<value>" + searchString + "</value>"
82
                        +"<pathexpr>literalLayout</pathexpr>"
83
                    +"</queryterm>"
84
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
85
                        +"<value>" + searchString + "</value>"
86
                        +"<pathexpr>title</pathexpr>"
87
                    +"</queryterm>"
88
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
89
	                    +"<value>" + searchString + "</value>"
90
	                    +"<pathexpr>title/value</pathexpr>"
91
	                +"</queryterm>"
92
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
93
                        +"<value>" + searchString + "</value>"
94
                        +"<pathexpr>@packageId</pathexpr>"
95
                    +"</queryterm>"
96
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
97
                        +"<value>" + searchString + "</value>"
98
                        +"<pathexpr>abstract/para</pathexpr>"
99
                    +"</queryterm>"
100
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
101
	                    +"<value>" + searchString + "</value>"
102
	                    +"<pathexpr>abstract/para/value</pathexpr>"
103
	                +"</queryterm>"
104
                    
105
                    //FGDC fields
106
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
107
                        +"<value>" + searchString + "</value>"
108
                        +"<pathexpr>abstract</pathexpr>"
109
                    +"</queryterm>"
110
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
111
                        +"<value>" + searchString + "</value>"
112
                        +"<pathexpr>idinfo/citation/citeinfo/title</pathexpr>"
113
                    +"</queryterm>"
114
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
115
                        +"<value>" + searchString + "</value>"
116
                        +"<pathexpr>idinfo/citation/citeinfo/origin</pathexpr>"
117
                    +"</queryterm>"
118
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
119
                        +"<value>" + searchString + "</value>"
120
                        +"<pathexpr>idinfo/keywords/theme/themekey</pathexpr>"
121
                    +"</queryterm>"
122
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
123
                        +"<value>" + searchString + "</value>"
124
                        +"<pathexpr>placekey</pathexpr>"
125
                    +"</queryterm>"
126
                +"</querygroup>"
127
            +"</querygroup>"
128
            +"</pathquery>";
129

  
130
    } else {
131
        queryTermString = "";
132
        if (searchString != "%"){
133
            queryTermString = "<queryterm searchmode=\"contains\" casesensitive=\"false\">"
134
                                  +"<value>" + searchString + "</value>"
135
                              +"</queryterm>";
136
        }
137
        submitFormObj.query.value = "<pathquery version=\"1.2\">"
138
            +"<querytitle>Web-Search</querytitle>"
139
            +"<returndoctype>eml://ecoinformatics.org/eml-2.1.1</returndoctype>"
140
            +"<returndoctype>eml://ecoinformatics.org/eml-2.1.0</returndoctype>"
141
            +"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>"
142
            +"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>"
143
            +"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>"
144
            +"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>"
145
            +"<returndoctype>-//NCEAS//resource//EN</returndoctype>"
146
            +"<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>"
147
            +"<returndoctype>metadata</returndoctype>"
148
            +"<returnfield>originator/individualName/surName</returnfield>"
149
            +"<returnfield>originator/individualName/givenName</returnfield>"
150
            +"<returnfield>creator/individualName/surName</returnfield>"
151
            +"<returnfield>creator/individualName/givenName</returnfield>"
152
            +"<returnfield>originator/organizationName</returnfield>"
153
            +"<returnfield>creator/organizationName</returnfield>"
154
            +"<returnfield>dataset/title</returnfield>"
155
            +"<returnfield>dataset/title/value</returnfield>"
156
            +"<returnfield>keyword</returnfield>"
157
            +"<returnfield>keyword/value</returnfield>"
158
            //fgdc fields
159
            +"<returnfield>idinfo/citation/citeinfo/title</returnfield>"
160
            +"<returnfield>idinfo/citation/citeinfo/origin</returnfield>"
161
			+"<returnfield>idinfo/keywords/theme/themekey</returnfield>"
162
            +"<querygroup operator=\"INTERSECT\">"
163
                +"<querygroup operator=\"UNION\">"
164
	                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
165
	                    +"<value>National Center for Ecological Analysis and Synthesis</value>"
166
	                    +"<pathexpr>organizationName</pathexpr>"
167
	                +"</queryterm>"
168
	                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
169
	                    //+"<value>%</value>"
170
	                    +"<value>National Center for Ecological Analysis and Synthesis</value>"	                    
171
	                    +"<pathexpr>placekey</pathexpr>"
172
	                +"</queryterm>"
173
                +"</querygroup>"
174
                + queryTermString
175
            +"</querygroup>"
176
            +"</pathquery>";
177

  
178
    }
179
    return true;
65 180
}
66 181

  
67
function trim(stringToTrim) {
68
    return stringToTrim.replace(/^\s*/, '').replace(/\s*$/,'');
182
function browseAll(searchFormId) {
183
	var searchForm = document.getElementById(searchFormId);
184
	var searchString = searchForm.searchstring;
185
    var checkBox = document.getElementById("searchAll");
186
    searchString.value="";
187
    checkBox.checked = true;
188
    if (checkSearch(searchForm)) {
189
		searchForm.submit();
190
	}
191

  
69 192
}
193

  
194
function searchAll(){
195
    var checkBox = document.getElementById("searchCheckBox");
196
    if (checkBox.checked == true) {
197
        alert("You have selected to search all possible existing fields. This search will take longer.");
198
    }
199
}
lib/style/skins/nceas/nceas.xml
3 3
<!-- general login & search -->
4 4
  <default-style>/style/common/ascii-treeview.xsl</default-style>
5 5

  
6
	<!-- rendered SOLR results -->
7
	<doctype publicid="solr">
8
		<target publicid="-//W3C//HTML//EN">/style/skins/nceas/nceas.xsl</target>
9
	</doctype>
10

  
11 6
  <doctype publicid="-//NCEAS//resultset//EN">
12 7
    <target publicid="-//W3C//HTML//EN">/style/skins/nceas/nceas.xsl</target>
13 8
  </doctype>
......
18 13
    <!-- <target publicid="-//W3C//HTML//EN">/style/common/fgdc/fgdc_1.xsl</target>-->
19 14
  </doctype>
20 15

  
16
<!--
17
    ARE THESE STILL NEEDED????????????
18

  
21 19
  <doctype publicid="-//NCEAS//login//EN">
20
    <target publicid="-//W3C//HTML//EN">/style/common/login.xsl</target>
21
  </doctype>
22

  
23
  <doctype publicid="-//NCEAS//eml-generic//EN">
24
    <target publicid="-//W3C//HTML//EN">/style/common/generic-morpho.xsl</target>
25
  </doctype>
26
-->
27
  <doctype publicid="-//NCEAS//login//EN">
22 28
    <target publicid="-//W3C//HTML//EN">/style/skins/nceas/nceas-login.xsl</target>
23 29
  </doctype>
24 30

  
lib/style/skins/nceas/nceas.xsl
32 32
                xmlns:eml="eml://ecoinformatics.org/eml-2.0.1" 
33 33
	            version="1.0">
34 34
    <xsl:import href="../../common/resultset-table.xsl"/>
35
    <xsl:import href="../../common/resultset-table-solr.xsl"/>
36 35
    <!-- xsl:import href="../../common/eml-2.0.1/emlroot.xsl"/ -->
37 36
    <xsl:import href="../../common/eml-2/emlroot.xsl"/>
38 37
    <xsl:import href="../../common/fgdc/fgdc-root.xsl"/>
......
54 53
                            <xsl:call-template name="emldocument"/>
55 54
                        </xsl:if>
56 55
                        
57
                        <xsl:if test="*[local-name()='response']">     	
58
                            <xsl:call-template name="resultstablesolr"/>
59
                        </xsl:if>
60
                        
61 56
                        <xsl:if test="*[local-name()='resultset']">     	
62 57
                            <xsl:call-template name="resultstable"/>
63 58
                        </xsl:if>
lib/style/skins/nceas/index.jsp
38 38
  <script language="JavaScript" type="text/JavaScript"
39 39
          src="<%=STYLE_SKINS_URL%>/nceas/nceas.js"></script>
40 40
  <script language="JavaScript" type="text/JavaScript"
41
          src="<%=STYLE_COMMON_URL%>/branding.js"></script>           
41
          src="<%=STYLE_COMMON_URL%>/branding.js"></script>
42 42
  <script type="text/javascript" 
43 43
          src="<%=STYLE_SKINS_URL%>/nceas/navigation.js"></script>
44 44
  <script type="text/javascript"
......
78 78
  <tr class="sectheader">
79 79
    <td class="borderbottom"><a name="search" ></a>
80 80
        <p align="center" class="largetext"> Search for Data Sets </p></td>
81
  </tr> 
82
  <tr>
81
  </tr>
82
  <tr class="sectbody"></tr>
83
 
84
  <tr >
83 85
    <td align="left">
84
    	<form id="searchForm" name="searchForm"
85
    		action="javascript:doSearch('<%=CONTEXT_URL%>/d1/mn/v1/query/solr', 'searchForm', true)" >
86
	        <div class="searchresultsdividerPale">
87
	        <p>
88
				&nbsp;
89
		        <input size="14" name="searchstring" type="text" value="" id="searchBox">
90
		        <input name="qformat" value="nceas" type="hidden">
91
		        <input value="Search" type="submit">
92
		        </p>
93
	        </div>
86
    <form method="POST" 
87
    	action="<%=SERVLET_URL%>" target="_top"
88
    	id="searchForm" name="searchForm" 
89
    	onSubmit="return checkSearch(this)">
90
        <div class="searchresultsdividerPale">
91
        <p>
92
        <input value="UNION" name="operator" type="hidden">
93
&nbsp;
94
        <input size="14" name="searchstring" type="text" value="" id="searchBox">
95
        <input name="query" type="hidden">
96
        <input name="qformat" value="nceas" type="hidden">
97
        <input name="enableediting" value="true" type="hidden">
98
        <input type="hidden" name="action" value="squery">
99
        <input value="Search" type="submit">
100
        </p>
101
        <p>
102
        <input name="search" type="radio" checked>
103
        Search Title, Abstract, Keywords, Personnel (Quicker) <br>
104
        <input name="search" type="radio" id="searchAll">
105
        Search all fields (Slower) <br>
106
        </p>
107
        </div>
94 108
        </form> 
95
      </td>
109
        <div align="center">
110
          <p align="left">This tool allows you to search the registry for data sets of interest. When you type text in the box and click on the "Search" button, the search will only be conducted within the title, author, abstract, and keyword fields. Checking the "Search All Fields" box will search on these and all other existing fields (this search will take more time). <br>
111
                <br>
112
          You can use the '%' character as a wildcard in your searches (e.g., '%biodiversity%' would locate any phrase with the word biodiversity embedded within it). </p>
113
      </div></td>
96 114
  </tr>
97 115
  <tr >
98
    <td class="borderbottom">
99
		<div align="center">
100
          <p align="left">
101
          You can use the '%' character as a wildcard in your searches (e.g., '%biodiversity%' would locate any phrase with the word biodiversity embedded within it). </p>
102
		</div>
103
		<div align="center">
104
	    	<a href="javascript:doSearch('<%=CONTEXT_URL%>/d1/mn/v1/query/solr', 'searchForm', true)">Browse existing NCEAS data sets</a>
105
			<br/><br/>
106
			<a href="<%=STYLE_SKINS_URL%>/nceas/map.jsp"> View Interactive Map </a>
107
		</div>
108
	</td>
109
  </tr>
110
</table>
111

  
116
    <td class="borderbottom"><div align="center">
117
    	<a href="javascript:browseAll('searchForm')">Browse existing NCEAS data sets</a>
118
<br/><br/>
119
<a href="<%=STYLE_SKINS_URL%>/nceas/map.jsp"> View Interactive Map </a> </div>
120
</td></tr></table>
112 121
<br><br>
113

  
114 122
<table class="tables regular" cellpadding="8" cellspacing="0">
115 123
  <tr class="sectheader">
116 124
    <td class="borderbottom" colspan="2" align="left"><span class="label"> </span>

Also available in: Unified diff