Project

General

Profile

« Previous | Next » 

Revision 3777

limit searching to "common" fields that are indexed.
include checkbox to search all fields.
see bug #3174

View differences:

lib/style/skins/saeon/SaeonLogin.jspx
204 204
		<input type="hidden" name="qformat" value="saeon"/>
205 205
		<input type="hidden" name="action" value="squery" />  
206 206
		<input type="submit" value="Search"  />
207
		<br/>
208
		<input type="checkbox" id="searchAll" name="searchAll" />Search all fields (slower)
207 209
		<p class="regtext">
208 210
		-Or-
209 211
		<br />
lib/style/skins/saeon/searchPathQuery.js
1
function generateQueryString(organizationScope, anyValue) {
1
function generateQueryString(organizationScope, anyValue, searchFields) {
2 2
	var queryString = ""; 
3 3
	queryString += "<pathquery version='1.2'>";
4 4
	queryString += "<returndoctype>metadata</returndoctype>";
......
21 21
	queryString += "<returnfield>idinfo/keywords/theme/themekey</returnfield>";
22 22
	
23 23
	queryString += "<querygroup operator='INTERSECT'>";
24
	queryString += "<queryterm casesensitive='false' searchmode='contains'>";
25 24
	
26
	queryString += "<value>" + anyValue + "</value>";
27
			
28
	queryString += "</queryterm>";
25
	//search particular fields, or all?
26
	if (searchFields.length > 0) {
27
		queryString += "<querygroup operator='UNION'>";
28
		for (var i = 0; i < searchFields.length; i++) {
29
			queryString += "<queryterm casesensitive='false' searchmode='contains'>";
30
			queryString += "<value>" + anyValue + "</value>";
31
			queryString += "<pathexpr>" + searchFields[i] +"</pathexpr>";
32
			queryString += "</queryterm>";
33
		}
34
		queryString += "</querygroup>";
35
	}
36
	else {
37
		queryString += "<queryterm casesensitive='false' searchmode='contains'>";
38
		queryString += "<value>" + anyValue + "</value>";
39
		queryString += "</queryterm>";
40
	}
29 41
	
42
	//now limit by the organization
30 43
	queryString += "<querygroup operator='UNION'>";
31 44
	
32 45
	for (var i = 0; i < organizationScope.length; i++) {
......
60 73
	//alert('anyfieldField=' + anyfieldField);
61 74
	var organizationScopeField = document.getElementById("organizationScope");
62 75
	//alert('organizationScopeField=' + organizationScopeField.value);
76
	var searchAll = document.getElementById("searchAll");
77
	//alert('searchAll=' + searchAll.checked);
63 78
	
64
	//make the array
79
	//make the array for organization
65 80
	var orgArray = new Array();
66 81
	orgArray[0] = organizationScopeField.value;
67 82
	//if "All", include multiple entries
......
70 85
		orgArray[1] = "SAEON, South Africa";
71 86
	}
72 87
	
88
	//make the array for paths to search
89
	var searchFieldArray = new Array();
90
	if (!searchAll.checked) {
91
		var counter = 0;
92
		//EML fields
93
		searchFieldArray[counter++] = "abstract/para";
94
		searchFieldArray[counter++] = "surName";
95
		searchFieldArray[counter++] = "givenName";
96
		searchFieldArray[counter++] = "organizationName";		
97
		searchFieldArray[counter++] = "title";
98
		searchFieldArray[counter++] = "keyword";
99
		searchFieldArray[counter++] = "para";
100
		searchFieldArray[counter++] = "geographicDescription";
101
		searchFieldArray[counter++] = "literalLayout";
102
		searchFieldArray[counter++] = "@packageId";
103
		
104
		//FGDC fields
105
		searchFieldArray[counter++] = "abstract";
106
		searchFieldArray[counter++] = "idinfo/citation/citeinfo/title";
107
		searchFieldArray[counter++] = "idinfo/citation/citeinfo/origin";
108
		searchFieldArray[counter++] = "idinfo/keywords/theme/themekey";
109
		searchFieldArray[counter++] = "idinfo/keywords/theme/placekey";
110
	}
111
	
112
	//generate the query
73 113
	queryField.value = 
74 114
		generateQueryString(
75 115
			orgArray,
76
			anyfieldField.value);
116
			anyfieldField.value,
117
			searchFieldArray);
77 118
	
78 119
	//alert(queryField.value);
79 120
}

Also available in: Unified diff