From 1de7b02e98b25baeb6373fb936b03a1cc9715088 Mon Sep 17 00:00:00 2001 From: Doron Cohen Date: Tue, 5 Jun 2007 23:52:05 +0000 Subject: [PATCH] LUCENE-909: Demo targets for running the demo. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@544685 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 + src/demo/demo-build.template | 87 ++++++++++++++++++- .../org/apache/lucene/demo/SearchFiles.java | 8 +- 3 files changed, 94 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4cfacbcc3af..8db53d880fa 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -265,6 +265,8 @@ Build 6. LUCENE-907: Include LICENSE.TXT and NOTICE.TXT in the META-INF dirs of demo war, demo jar, and the contrib jars. (Michael Busch) + + 7. LUCENE-909: Demo targets for running the demo. (Doron Cohen) ======================= Release 2.1.0 2007-02-14 ======================= diff --git a/src/demo/demo-build.template b/src/demo/demo-build.template index 810bbde6d4b..da4197356b3 100644 --- a/src/demo/demo-build.template +++ b/src/demo/demo-build.template @@ -90,9 +90,72 @@ + + - + + + + + + + ----- (1) Prepare dir ----- + cd ${common.dir} + rmdir demo-text-dir + + mkdir demo-text-dir + + cd demo-text-dir + ----- (2) Index the files located under ${common.dir}/src ----- + + + + + + + + + + ----- Interactive search ----- + cd demo-text-dir + + + + + + + + + + + ----- (1) Prepare dir ----- + cd ${common.dir} + rmdir demo-html-dir + + mkdir demo-html-dir + + cd demo-html-dir + ----- (2) Index the files located under ${common.dir}/src ----- + + + + + + + + + + ----- Interactive search ----- + cd demo-html-dir + + + + @@ -115,4 +178,26 @@ + + + + + + + java -classpath "../${core.name}.jar;../${demo.name}.jar" org.apache.lucene.demo.@{class} @{paramsDisplay} + + + + + + + + + + diff --git a/src/demo/org/apache/lucene/demo/SearchFiles.java b/src/demo/org/apache/lucene/demo/SearchFiles.java index 182c8c56059..7308908ac04 100644 --- a/src/demo/org/apache/lucene/demo/SearchFiles.java +++ b/src/demo/org/apache/lucene/demo/SearchFiles.java @@ -111,13 +111,17 @@ public class SearchFiles { QueryParser parser = new QueryParser(field, analyzer); while (true) { if (queries == null) // prompt the user - System.out.print("Query: "); + System.out.println("Enter query: "); String line = in.readLine(); if (line == null || line.length() == -1) break; + line = line.trim(); + if (line.length() == 0) + break; + Query query = parser.parse(line); System.out.println("Searching for: " + query.toString(field)); @@ -161,7 +165,7 @@ public class SearchFiles { break; if (hits.length() > end) { - System.out.print("more (y/n) ? "); + System.out.println("more (y/n) ? "); line = in.readLine(); if (line.length() == 0 || line.charAt(0) == 'n') break;