mirror of https://github.com/apache/lucene.git
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
This commit is contained in:
parent
8c62eb41a4
commit
1de7b02e98
|
@ -266,6 +266,8 @@ Build
|
||||||
6. LUCENE-907: Include LICENSE.TXT and NOTICE.TXT in the META-INF dirs of
|
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)
|
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 =======================
|
======================= Release 2.1.0 2007-02-14 =======================
|
||||||
|
|
||||||
Changes in runtime behavior
|
Changes in runtime behavior
|
||||||
|
|
|
@ -90,6 +90,69 @@
|
||||||
<target name="clean"
|
<target name="clean"
|
||||||
description="Removes contents of build directory">
|
description="Removes contents of build directory">
|
||||||
<delete dir="${build.dir}"/>
|
<delete dir="${build.dir}"/>
|
||||||
|
<delete dir="${common.dir}/demo-text-dir"/>
|
||||||
|
<delete dir="${common.dir}/demo-html-dir"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<!-- R U N T E X T I N D E X I N G D E M O -->
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<target name="demo-index-text" depends="jar-demo"
|
||||||
|
description="Run text indexing demo (index the sources of the demo).">
|
||||||
|
<echo>----- (1) Prepare dir ----- </echo>
|
||||||
|
<echo>cd ${common.dir} </echo>
|
||||||
|
<echo>rmdir demo-text-dir </echo>
|
||||||
|
<delete dir="${common.dir}/demo-text-dir"/>
|
||||||
|
<echo>mkdir demo-text-dir </echo>
|
||||||
|
<mkdir dir="${common.dir}/demo-text-dir"/>
|
||||||
|
<echo>cd demo-text-dir </echo>
|
||||||
|
<echo>----- (2) Index the files located under ${common.dir}/src ----- </echo>
|
||||||
|
<invoke-java class="IndexFiles" params="${common.dir}/src/demo" paramsDisplay="../src/demo" type="text"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<!-- R U N T E X T S E A R C H D E M O -->
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<target name="demo-search-text" depends="jar-demo"
|
||||||
|
description="Run interactive search demo.">
|
||||||
|
<echo>----- Interactive search ----- </echo>
|
||||||
|
<echo>cd demo-text-dir </echo>
|
||||||
|
<invoke-java class="SearchFiles" params="-index index" paramsDisplay="-index index" type="text"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<!-- R U N H T M L I N D E X I N G D E M O -->
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<target name="demo-index-html" depends="jar-demo"
|
||||||
|
description="Run html indexing demo (index the javadocs).">
|
||||||
|
<echo>----- (1) Prepare dir ----- </echo>
|
||||||
|
<echo>cd ${common.dir} </echo>
|
||||||
|
<echo>rmdir demo-html-dir </echo>
|
||||||
|
<delete dir="${common.dir}/demo-html-dir"/>
|
||||||
|
<echo>mkdir demo-html-dir </echo>
|
||||||
|
<mkdir dir="${common.dir}/demo-html-dir"/>
|
||||||
|
<echo>cd demo-html-dir </echo>
|
||||||
|
<echo>----- (2) Index the files located under ${common.dir}/src ----- </echo>
|
||||||
|
<invoke-java class="IndexFiles" params="${common.dir}/docs/api" paramsDisplay="../docs/api" type="html"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<!-- R U N H T M L S E A R C H D E M O -->
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- ================================================================== -->
|
||||||
|
<target name="demo-search-html" depends="jar-demo"
|
||||||
|
description="Run interactive search demo.">
|
||||||
|
<echo>----- Interactive search ----- </echo>
|
||||||
|
<echo>cd demo-html-dir </echo>
|
||||||
|
<invoke-java class="SearchFiles" params="-index index" paramsDisplay="-index index" type="html"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,4 +178,26 @@
|
||||||
</sequential>
|
</sequential>
|
||||||
</macrodef>
|
</macrodef>
|
||||||
|
|
||||||
|
<macrodef name="invoke-java">
|
||||||
|
<attribute name="class"/>
|
||||||
|
<attribute name="params"/>
|
||||||
|
<attribute name="paramsDisplay"/>
|
||||||
|
<attribute name="type"/>
|
||||||
|
<sequential>
|
||||||
|
<echo>java -classpath "../${core.name}.jar;../${demo.name}.jar" org.apache.lucene.demo.@{class} @{paramsDisplay} </echo>
|
||||||
|
<java classname="org.apache.lucene.demo.@{class}"
|
||||||
|
dir="${common.dir}/demo-@{type}-dir"
|
||||||
|
fork="true"
|
||||||
|
failonerror="true"
|
||||||
|
maxmemory="128m"
|
||||||
|
>
|
||||||
|
<arg value="@{params}"/>
|
||||||
|
<classpath>
|
||||||
|
<pathelement location="${common.dir}/${core.name}.jar"/>
|
||||||
|
<pathelement location="${common.dir}/${demo.name}.jar"/>
|
||||||
|
</classpath>
|
||||||
|
</java>
|
||||||
|
</sequential>
|
||||||
|
</macrodef>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -111,13 +111,17 @@ public class SearchFiles {
|
||||||
QueryParser parser = new QueryParser(field, analyzer);
|
QueryParser parser = new QueryParser(field, analyzer);
|
||||||
while (true) {
|
while (true) {
|
||||||
if (queries == null) // prompt the user
|
if (queries == null) // prompt the user
|
||||||
System.out.print("Query: ");
|
System.out.println("Enter query: ");
|
||||||
|
|
||||||
String line = in.readLine();
|
String line = in.readLine();
|
||||||
|
|
||||||
if (line == null || line.length() == -1)
|
if (line == null || line.length() == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
line = line.trim();
|
||||||
|
if (line.length() == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
Query query = parser.parse(line);
|
Query query = parser.parse(line);
|
||||||
System.out.println("Searching for: " + query.toString(field));
|
System.out.println("Searching for: " + query.toString(field));
|
||||||
|
|
||||||
|
@ -161,7 +165,7 @@ public class SearchFiles {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (hits.length() > end) {
|
if (hits.length() > end) {
|
||||||
System.out.print("more (y/n) ? ");
|
System.out.println("more (y/n) ? ");
|
||||||
line = in.readLine();
|
line = in.readLine();
|
||||||
if (line.length() == 0 || line.charAt(0) == 'n')
|
if (line.length() == 0 || line.charAt(0) == 'n')
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue