enhanced sample, but validator is acting up it seems. kelvin - am i doing something wrong?

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150938 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2004-01-23 16:59:38 +00:00
parent 5320408426
commit 8c1b134a7a
2 changed files with 67 additions and 26 deletions

View File

@ -2,27 +2,67 @@
<head>
<title>Demo Lucene Query Constructor</title>
<script type="text/javascript" src="luceneQueryConstructor.js"></script>
<script type="text/javascript" src="../queryValidator/luceneQueryValidator.js"></script>
</head>
<body>
<form>
<p>
<input type="hidden" name="query">
Name:
<input type="text" name="name">
<select name="nameModifier">
<option value="And" />And
<option value="Or" selected/>Or
<option value="Not" />Not
<option value="And">And</option>
<option value="Or" selected="selected">Or</option>
<option value="Not">Not</option>
</select>
</p>
<p>
Description:
<input type="text" name="description">
<select name="descriptionModifier">
<option value="And" />And
<option value="Or" selected/>Or
<option value="Not" />Not
<option value="And">And</option>
<option value="Or" selected="selected">Or</option>
<option value="Not">Not</option>
</select>
<input type="button" name="Search" value="Search" onClick="doMakeQuery(this.form.query)" />
</p>
<p>
Required Select:
<select name="choice">
<option value="one">One</option>
<option value="two">Two</option>
</select>
<input type="hidden" name="choiceModifier" value="And"/>
</p>
<p>
Multi-select:
<select name="multi" multiple="true" size="5">
<option value="multi1">multi1</option>
<option value="multi2">multi2</option>
<option value="multi3">multi3</option>
<option value="multi4">multi4</option>
</select>
<input type="hidden" name="multiModifier" value="Or"/>
</p>
<p>
Radio:
<!-- TODO: something fishy happens if none selected -->
<input type="radio" name="radio" value="wnrn" checked="checked" />WNRN
<input type="radio" name="radio" value="klpx" />KLPX
<input type="hidden" name="radioModifier" value="And"/>
</p>
<p>
Current Query:
<pre id="curQuery"></pre>
</p>
<input type="button" name="Update" value="Update Query" onClick="doMakeQuery(this.form.query); curQuery.innerText = this.form.query.value" />
<input type="button" name="Validate" value="Validate" onClick="doCheckLuceneQuery(this.form.query);" />
</form>
</body>
</html>

View File

@ -50,8 +50,9 @@ function doMakeQuery( query, dbg )
dict[dict.length] = elementName;
// ensure we get the whole group (of checkboxes, radio, etc), if applicable
var elementValue = getFieldValue(frm[element.name]);
if(elementValue.length > 0)
var elementValue = trim(getFieldValue(frm[element.name]));
if(elementValue.length > 0 && elementValue != ' ')
{
var subElement = frm[elementName + modifierSuffix];
if(typeof(subElement) != "undefined") // found a field/fieldModifier pair