Revision 5533
Added by ben leinfelder over 14 years ago
search.js | ||
---|---|---|
3 | 3 |
} |
4 | 4 |
|
5 | 5 |
function checkSearch(submitFormObj) { |
6 |
//var searchString = trim(submitFormObj.entity.value); |
|
7 |
var searchString = submitFormObj.entity.value; |
|
8 | 6 |
|
9 |
if (searchString=="") { |
|
10 |
if (confirm("Show *all* data in the KNB?")) { |
|
11 |
searchString = "%"; |
|
12 |
} else { |
|
13 |
return false; |
|
14 |
} |
|
15 |
} |
|
16 |
|
|
17 |
if (true) { |
|
18 |
submitFormObj.query.value = "<pathquery version=\"1.2\">" |
|
19 |
+"<querytitle>Web-Search</querytitle>" |
|
20 |
+"<returndoctype>eml://ecoinformatics.org/eml-2.1.0</returndoctype>" |
|
21 |
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>" |
|
22 |
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>" |
|
23 |
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>" |
|
24 |
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>" |
|
25 |
+"<returndoctype>-//NCEAS//resource//EN</returndoctype>" |
|
26 |
+"<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>" |
|
27 |
+"<returndoctype>metadata</returndoctype>" |
|
28 |
+"<returnfield>originator/individualName/surName</returnfield>" |
|
29 |
+"<returnfield>originator/individualName/givenName</returnfield>" |
|
30 |
+"<returnfield>creator/individualName/surName</returnfield>" |
|
31 |
+"<returnfield>creator/individualName/givenName</returnfield>" |
|
32 |
+"<returnfield>originator/organizationName</returnfield>" |
|
33 |
+"<returnfield>creator/organizationName</returnfield>" |
|
34 |
+"<returnfield>dataset/title</returnfield>" |
|
35 |
+"<returnfield>keyword</returnfield>" |
|
36 |
//fgdc fields |
|
37 |
+"<returnfield>idinfo/citation/citeinfo/title</returnfield>" |
|
38 |
+"<returnfield>idinfo/citation/citeinfo/origin</returnfield>" |
|
39 |
+"<returnfield>idinfo/keywords/theme/themekey</returnfield>" |
|
40 |
+"<querygroup operator=\"INTERSECT\">" |
|
41 |
+"<querygroup operator=\"UNION\">" |
|
42 |
// EML fields |
|
43 |
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">" |
|
44 |
+"<value>" + searchString + "</value>" |
|
45 |
+"<pathexpr>keyword</pathexpr>" |
|
46 |
+"</queryterm>" |
|
47 |
|
|
48 |
//FGDC fields |
|
49 |
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">" |
|
50 |
+"<value>" + searchString + "</value>" |
|
51 |
+"<pathexpr>idinfo/keywords/theme/themekey</pathexpr>" |
|
52 |
+"</queryterm>" |
|
53 |
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">" |
|
54 |
+"<value>" + searchString + "</value>" |
|
55 |
+"<pathexpr>placekey</pathexpr>" |
|
56 |
+"</queryterm>" |
|
57 |
+"</querygroup>" |
|
58 |
+"</querygroup>" |
|
59 |
+"</pathquery>"; |
|
60 |
} |
|
7 |
var operator = "OR"; |
|
8 |
if (submitFormObj.matchAll.checked) { |
|
9 |
operator = "AND"; |
|
10 |
} |
|
11 |
var strict = "false"; |
|
12 |
if (submitFormObj.strict.checked) { |
|
13 |
strict = "true"; |
|
14 |
} |
|
15 |
submitFormObj.query.value = |
|
16 |
"<sq:query queryId='query.1' system='semtools' " + |
|
17 |
"xmlns:sq='http://ecoinformatics.org/semQuery-1.0.0' " + |
|
18 |
"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " + |
|
19 |
"xsi:schemaLocation='http://ecoinformatics.org/semQuery-1.0.0 semQuery.xsd '>" + |
|
20 |
"<namespace prefix='sms'>http://ecoinformatics.org/sms/annotation.0.9</namespace>" + |
|
21 |
"<returnField>/@id</returnField>" + |
|
22 |
"<returnField>/@emlPackage</returnField>" + |
|
23 |
"<returnField>/@dataTable</returnField>" + |
|
24 |
"<title>Semantic Search Example</title>" + |
|
25 |
"<!-- Match all criteria, must be on same observation -->" + |
|
26 |
"<" + operator + " strict='" + strict + "'>"; |
|
27 |
for (var i=0; i < submitFormObj.dynamicClass.length; i++) { |
|
28 |
var searchClass = submitFormObj.dynamicClass[i].value; |
|
29 |
var searchValue = submitFormObj.dynamicValue[i].value; |
|
30 |
if (searchValue!="") { |
|
31 |
submitFormObj.query.value += |
|
32 |
"<condition " + |
|
33 |
"concept='" + searchClass + "' " + |
|
34 |
"operator='EQUALS'>" + |
|
35 |
searchValue + |
|
36 |
"</condition>"; |
|
37 |
} |
|
38 |
} |
|
39 |
submitFormObj.query.value += "</" + operator + ">"; |
|
40 |
submitFormObj.query.value += "</sq:query>"; |
|
41 |
|
|
61 | 42 |
alert("query: " + submitFormObj.query.value); |
62 | 43 |
|
63 | 44 |
return true; |
Also available in: Unified diff
basic query can be issued and includes:
-match any/all
-from same observation
-for Entity, Characteristic, Standard, Protocol, Measurement