Index: /trunk/gsdl/src/java/org/nzdl/gsdl/LuceneWrap/GS2LuceneQuery.java
===================================================================
--- /trunk/gsdl/src/java/org/nzdl/gsdl/LuceneWrap/GS2LuceneQuery.java	(revision 12986)
+++ /trunk/gsdl/src/java/org/nzdl/gsdl/LuceneWrap/GS2LuceneQuery.java	(revision 12987)
@@ -55,5 +55,5 @@
     {
 	if (args.length == 0) {
-	    System.out.println("Usage: GS2LuceneQuery <index directory> [-fuzziness value] [-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] [query]");
 	    return;
 	}
@@ -67,4 +67,7 @@
 	    QueryParser query_parser_no_stop_words = new QueryParser(TEXTFIELD, new StandardAnalyzer(new String[] { }));
 
+	    String query_string = null;
+
+	    // Parse the command-line arguments
             for (int i = 1; i < args.length; i++) {
 		if (args[i].equals("-sort")) {
@@ -95,4 +98,7 @@
 			end_results = Integer.parseInt(args[i]);
 		    }
+		}
+		else {
+		    query_string = args[i];
 		}
 	    }
@@ -104,13 +110,21 @@
 	    }
 
-	    BufferedReader in = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
-	    while (true) {
-		// Read the query from STDIN
-		String query_string = in.readLine();
-		if (query_string == null || query_string.length() == -1) {
-		    break;
-		}
-
+	    // The query string has been specified as a command-line argument
+	    if (query_string != null) {
 		runQuery(searcher, reader, query_parser, query_parser_no_stop_words, query_string);
+	    }
+
+	    // Read queries from STDIN
+	    else {
+		BufferedReader in = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
+		while (true) {
+		    // Read the query from STDIN
+		    query_string = in.readLine();
+		    if (query_string == null || query_string.length() == -1) {
+			break;
+		    }
+
+		    runQuery(searcher, reader, query_parser, query_parser_no_stop_words, query_string);
+		}
 	    }
 	}
Index: /trunk/indexers/lucene-gs/src/org/greenstone/LuceneWrapper/GS2LuceneQuery.java
===================================================================
--- /trunk/indexers/lucene-gs/src/org/greenstone/LuceneWrapper/GS2LuceneQuery.java	(revision 12986)
+++ /trunk/indexers/lucene-gs/src/org/greenstone/LuceneWrapper/GS2LuceneQuery.java	(revision 12987)
@@ -55,5 +55,5 @@
     {
 	if (args.length == 0) {
-	    System.out.println("Usage: GS2LuceneQuery <index directory> [-fuzziness value] [-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] [query]");
 	    return;
 	}
@@ -67,4 +67,7 @@
 	    QueryParser query_parser_no_stop_words = new QueryParser(TEXTFIELD, new StandardAnalyzer(new String[] { }));
 
+	    String query_string = null;
+
+	    // Parse the command-line arguments
             for (int i = 1; i < args.length; i++) {
 		if (args[i].equals("-sort")) {
@@ -95,4 +98,7 @@
 			end_results = Integer.parseInt(args[i]);
 		    }
+		}
+		else {
+		    query_string = args[i];
 		}
 	    }
@@ -104,13 +110,21 @@
 	    }
 
-	    BufferedReader in = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
-	    while (true) {
-		// Read the query from STDIN
-		String query_string = in.readLine();
-		if (query_string == null || query_string.length() == -1) {
-		    break;
-		}
-
+	    // The query string has been specified as a command-line argument
+	    if (query_string != null) {
 		runQuery(searcher, reader, query_parser, query_parser_no_stop_words, query_string);
+	    }
+
+	    // Read queries from STDIN
+	    else {
+		BufferedReader in = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
+		while (true) {
+		    // Read the query from STDIN
+		    query_string = in.readLine();
+		    if (query_string == null || query_string.length() == -1) {
+			break;
+		    }
+
+		    runQuery(searcher, reader, query_parser, query_parser_no_stop_words, query_string);
+		}
 	    }
 	}
