Index: /trunk/gsdl/bin/script/lucene_query.pl
===================================================================
--- /trunk/gsdl/bin/script/lucene_query.pl	(revision 12769)
+++ /trunk/gsdl/bin/script/lucene_query.pl	(revision 12770)
@@ -44,5 +44,5 @@
 {
     my $full_indexdir = shift(@_);
-    my $fuzzy = shift(@_);
+    my $fuzziness = shift(@_);
     my $filter_string = shift(@_);
     my $sort_field = shift(@_);
@@ -56,6 +56,6 @@
 
     my $cmd = "| " . $java_lucene . " \"" . $full_indexdir . "\"";
-    if (defined($fuzzy)) {
-        $cmd .= " -fuzzy";
+    if (defined($fuzziness)) {
+        $cmd .= " -fuzziness " . $fuzziness;
     }
     if (defined($filter_string)) {
@@ -94,5 +94,5 @@
     my $argc = scalar(@argv);
     if ($argc == 0) {
-	print STDERR "Usage: $PROGNAME full-index-dir [query] [-fuzzy] [-filter filter_string] [-sort sort_field] [-dco AND|OR] [-startresults number -endresults number] [-out out_file]\n";
+	print STDERR "Usage: $PROGNAME full-index-dir [query] [-fuzziness value] [-filter filter_string] [-sort sort_field] [-dco AND|OR] [-startresults number -endresults number] [-out out_file]\n";
 	exit 1;
     }
@@ -100,5 +100,5 @@
     my $full_indexdir = shift(@argv);
     my $query = undef;
-    my $fuzzy = undef;
+    my $fuzziness = undef;
     my $filter_string = undef;
     my $sort_field = undef;
@@ -109,6 +109,7 @@
     for (my $i = 0; $i < scalar(@argv); $i++)
     {
-	if ($argv[$i] eq "-fuzzy") {
-	    $fuzzy = 1;
+	if ($argv[$i] eq "-fuzziness") {
+	    $i++;
+	    $fuzziness = $argv[$i];
 	}
         elsif ($argv[$i] eq "-filter") {
@@ -141,5 +142,5 @@
     }
 
-    open_java_lucene($full_indexdir, $fuzzy, $filter_string, $sort_field, $dco, $start_results, $end_results, $out_file);
+    open_java_lucene($full_indexdir, $fuzziness, $filter_string, $sort_field, $dco, $start_results, $end_results, $out_file);
 
     if (defined $query) {
Index: /trunk/gsdl/src/colservr/lucenesearch.cpp
===================================================================
--- /trunk/gsdl/src/colservr/lucenesearch.cpp	(revision 12769)
+++ /trunk/gsdl/src/colservr/lucenesearch.cpp	(revision 12770)
@@ -123,8 +123,7 @@
     cmd += " -sort \"" + queryparams.sortfield + "\"";
   }
-  if (queryparams.fuzzysearch)
-    {
-      cmd += " -fuzzy";
-    }
+  if (!queryparams.fuzziness.empty()) {
+    cmd += " -fuzziness " + queryparams.fuzziness;
+  }
 
   // New code to support configuration of the default conjuction operator
Index: /trunk/gsdl/src/colservr/queryfilter.cpp
===================================================================
--- /trunk/gsdl/src/colservr/queryfilter.cpp	(revision 12769)
+++ /trunk/gsdl/src/colservr/queryfilter.cpp	(revision 12770)
@@ -92,5 +92,5 @@
   query.filterstring = filterOptions["FilterString"].defaultValue;  // Lucene specific
   query.sortfield = filterOptions["SortField"].defaultValue;  // Lucene specific
-  query.fuzzysearch = (filterOptions["FuzzySearch"].defaultValue == "true");  // Lucene specific
+  query.fuzziness = filterOptions["Fuzziness"].defaultValue;  // Lucene specific
   query.maxnumeric = maxnumeric;
   OptionValue_tarray::const_iterator options_here = request.filterOptions.begin();
@@ -121,5 +121,5 @@
       query.filterstring = filterOptions["FilterString"].defaultValue;  // Lucene specific
       query.sortfield = filterOptions["SortField"].defaultValue;  // Lucene specific
-      query.fuzzysearch = (filterOptions["FuzzySearch"].defaultValue == "true");  // Lucene specific
+      query.fuzziness = filterOptions["Fuzziness"].defaultValue;  // Lucene specific
       query.maxnumeric = maxnumeric;
       // "all", needed when combining queries where the document results are needed
@@ -158,6 +158,6 @@
     } else if ((*options_here).name == "SortField") {
       query.sortfield = (*options_here).value;
-    } else if ((*options_here).name == "FuzzySearch") {
-      query.fuzzysearch = ((*options_here).value == "true");
+    } else if ((*options_here).name == "Fuzziness") {
+      query.fuzziness = (*options_here).value;
     } else {
       logout << text_t2ascii
Index: /trunk/gsdl/src/colservr/queryinfo.cpp
===================================================================
--- /trunk/gsdl/src/colservr/queryinfo.cpp	(revision 12769)
+++ /trunk/gsdl/src/colservr/queryinfo.cpp	(revision 12770)
@@ -49,5 +49,5 @@
   filterstring.clear();
   sortfield.clear();
-  fuzzysearch = 0; // 0 = not fuzzy, 1 = fuzzy
+  fuzziness.clear();
   startresults = 1; // all
   endresults = 10; // all
@@ -71,5 +71,5 @@
   filterstring = q.filterstring;
   sortfield = q.sortfield;
-  fuzzysearch = q.fuzzysearch;
+  fuzziness = q.fuzziness;
   startresults = q.startresults;
   endresults = q.endresults;
@@ -94,5 +94,5 @@
 	  (x.filterstring == y.filterstring) &&
           (x.sortfield == y.sortfield) &&
-          (x.fuzzysearch == y.fuzzysearch) &&
+          (x.fuzziness == y.fuzziness) &&
           (x.startresults == y.startresults) &&
           (x.startresults == y.startresults));
@@ -123,5 +123,5 @@
   outs << " filterstring = \"" << q.filterstring << "\"\n";
   outs << " sortfield = \"" << q.sortfield << "\"\n";
-  outs << " fuzzysearch = \"" << q.fuzzysearch << "\"\n";
+  outs << " fuzziness = \"" << q.fuzziness << "\"\n";
   outs << " startresults = \"" << q.startresults << "\"\n";
   outs << " endresults = \"" << q.endresults << "\"\n";
Index: /trunk/gsdl/src/colservr/queryinfo.h
===================================================================
--- /trunk/gsdl/src/colservr/queryinfo.h	(revision 12769)
+++ /trunk/gsdl/src/colservr/queryinfo.h	(revision 12770)
@@ -68,5 +68,5 @@
   text_t filterstring; // Filter specified (currently only used by Lucene)
   text_t sortfield; // Field to use for sorting result set (currently used by lucene)
-  int fuzzysearch; // Should search be fuzzy (only used by Lucene)
+  text_t fuzziness; // Search fuzziness amount between 0.0 and 1.0 (only used by Lucene)
 
   int startresults;
Index: /trunk/gsdl/src/java/org/nzdl/gsdl/LuceneWrap/GS2LuceneQuery.java
===================================================================
--- /trunk/gsdl/src/java/org/nzdl/gsdl/LuceneWrap/GS2LuceneQuery.java	(revision 12769)
+++ /trunk/gsdl/src/java/org/nzdl/gsdl/LuceneWrap/GS2LuceneQuery.java	(revision 12770)
@@ -44,5 +44,5 @@
     {
 	if (args.length == 0) {
-	    System.out.println("Usage: GS2LuceneQuery <index directory> [-fuzzy] [-filter filter_string] [-sort sort_field] [-dco AND|OR] [-startresults number -endresults number]");
+	    System.out.println("Usage: GS2LuceneQuery <index directory> [-fuzziness value] [-filter filter_string] [-sort sort_field] [-dco AND|OR] [-startresults number -endresults number]");
 	    return;
 	}
@@ -58,5 +58,5 @@
 	    Sort sorter = new Sort();
 	    Filter filter = null;
-            boolean fuzzy = false;
+	    String fuzziness = null;
 
 	    // Paging
@@ -86,7 +86,8 @@
                             default_conjuction_operator = args[i];
                         }
-                    if (args[i].equals("-fuzzy"))
+                    if (args[i].equals("-fuzziness"))
                         {
-                            fuzzy = true;
+			    i++;
+			    fuzziness = args[i];
                         }
 		    if (args[i].equals("-startresults"))
@@ -133,5 +134,5 @@
 		    query_including_stop_words = query_including_stop_words.rewrite(reader);
 
-		    Query query = parseQuery(reader, query_parser, query_string, fuzzy);
+		    Query query = parseQuery(reader, query_parser, query_string, fuzziness);
 		    query = query.rewrite(reader);
 
@@ -271,5 +272,5 @@
 
 
-    private static Query parseQuery(IndexReader reader, QueryParser query_parser, String query_string, boolean fuzzy)
+    private static Query parseQuery(IndexReader reader, QueryParser query_parser, String query_string, String fuzziness)
 	throws java.io.IOException, org.apache.lucene.queryParser.ParseException
     {
@@ -304,5 +305,5 @@
 	// If this is a fuzzy search, then we need to add the fuzzy
 	// flag to each of the query terms
-	if (fuzzy && query.toString().length() > 0)
+	if (fuzziness != null && query.toString().length() > 0)
 	    {
 		// Revert the query to a string
@@ -363,5 +364,5 @@
 				    {
 					///ystem.err.println("Yahoo! Found fuzzy term.");
-					mutable_query_string.insert(o, '~');
+					mutable_query_string.insert(o, '~' + fuzziness);
 					o++;
 					s = 0; // Reset
@@ -374,5 +375,5 @@
 		if (s == 3)
 		    {
-			mutable_query_string.append('~');
+			mutable_query_string.append('~' + fuzziness);
 		    }
 		// Reparse the query
Index: /trunk/gsdl/src/recpt/queryaction.cpp
===================================================================
--- /trunk/gsdl/src/recpt/queryaction.cpp	(revision 12769)
+++ /trunk/gsdl/src/recpt/queryaction.cpp	(revision 12770)
@@ -430,11 +430,11 @@
   argsinfo.addarginfo (NULL, arg_ainfo);
 
-  // "fuzzy" controls whether the search is fuzzy logic or not
-  // (only implemented for Lucene collection... umm.. ever).
-  arg_ainfo.shortname = "fuzzy";
-  arg_ainfo.longname = "is this search be fuzzy";
-  arg_ainfo.multiplechar = false;
-  arg_ainfo.defaultstatus = cgiarginfo::weak;
-  arg_ainfo.argdefault = "0";
+  // "fuzziness" controls how closely the search terms must match
+  // 1.0 = exact match, 0.1 = very inexact match (only implemented for Lucene)
+  arg_ainfo.shortname = "fuzziness";
+  arg_ainfo.longname = "Lucene fuzziness value";
+  arg_ainfo.multiplechar = true;
+  arg_ainfo.defaultstatus = cgiarginfo::weak;
+  arg_ainfo.argdefault = "1.0";
   arg_ainfo.savedarginfo = cgiarginfo::must;
   argsinfo.addarginfo (NULL, arg_ainfo);
Index: /trunk/gsdl/src/recpt/querytools.cpp
===================================================================
--- /trunk/gsdl/src/recpt/querytools.cpp	(revision 12769)
+++ /trunk/gsdl/src/recpt/querytools.cpp	(revision 12770)
@@ -153,8 +153,9 @@
   }
 
-  // sort field for lucene
-  option.name = "FuzzySearch";
-  option.value = (args.getintarg("fuzzy")) ? "true" : "false";
-  request.filterOptions.push_back (option);
+  if (!args["fuzziness"].empty()) { // fuzziness value for lucene
+    option.name = "Fuzziness";
+    option.value = args["fuzziness"];
+    request.filterOptions.push_back (option);
+  }
 
   set_more_queryfilter_options (request, args);
Index: /trunk/indexers/lucene-gs/src/org/greenstone/LuceneWrapper/GS2LuceneQuery.java
===================================================================
--- /trunk/indexers/lucene-gs/src/org/greenstone/LuceneWrapper/GS2LuceneQuery.java	(revision 12769)
+++ /trunk/indexers/lucene-gs/src/org/greenstone/LuceneWrapper/GS2LuceneQuery.java	(revision 12770)
@@ -44,5 +44,5 @@
     {
 	if (args.length == 0) {
-	    System.out.println("Usage: GS2LuceneQuery <index directory> [-fuzzy] [-filter filter_string] [-sort sort_field] [-dco AND|OR] [-startresults number -endresults number]");
+	    System.out.println("Usage: GS2LuceneQuery <index directory> [-fuzziness value] [-filter filter_string] [-sort sort_field] [-dco AND|OR] [-startresults number -endresults number]");
 	    return;
 	}
@@ -58,5 +58,5 @@
 	    Sort sorter = new Sort();
 	    Filter filter = null;
-            boolean fuzzy = false;
+	    String fuzziness = null;
 
 	    // Paging
@@ -86,7 +86,8 @@
                             default_conjuction_operator = args[i];
                         }
-                    if (args[i].equals("-fuzzy"))
+                    if (args[i].equals("-fuzziness"))
                         {
-                            fuzzy = true;
+			    i++;
+			    fuzziness = args[i];
                         }
 		    if (args[i].equals("-startresults"))
@@ -133,5 +134,5 @@
 		    query_including_stop_words = query_including_stop_words.rewrite(reader);
 
-		    Query query = parseQuery(reader, query_parser, query_string, fuzzy);
+		    Query query = parseQuery(reader, query_parser, query_string, fuzziness);
 		    query = query.rewrite(reader);
 
@@ -271,5 +272,5 @@
 
 
-    private static Query parseQuery(IndexReader reader, QueryParser query_parser, String query_string, boolean fuzzy)
+    private static Query parseQuery(IndexReader reader, QueryParser query_parser, String query_string, String fuzziness)
 	throws java.io.IOException, org.apache.lucene.queryParser.ParseException
     {
@@ -304,5 +305,5 @@
 	// If this is a fuzzy search, then we need to add the fuzzy
 	// flag to each of the query terms
-	if (fuzzy && query.toString().length() > 0)
+	if (fuzziness != null && query.toString().length() > 0)
 	    {
 		// Revert the query to a string
@@ -363,5 +364,5 @@
 				    {
 					///ystem.err.println("Yahoo! Found fuzzy term.");
-					mutable_query_string.insert(o, '~');
+					mutable_query_string.insert(o, '~' + fuzziness);
 					o++;
 					s = 0; // Reset
@@ -374,5 +375,5 @@
 		if (s == 3)
 		    {
-			mutable_query_string.append('~');
+			mutable_query_string.append('~' + fuzziness);
 		    }
 		// Reparse the query
