From 1c31f33cce5c38559678859ebbc955b2f427f1b3 Mon Sep 17 00:00:00 2001 From: Doug Cutting Date: Fri, 19 Oct 2001 17:15:19 +0000 Subject: [PATCH] Added source code into distribution. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149612 13f79535-47bb-0310-9956-ffa450edef68 --- build.properties | 2 +- build.xml | 13 +++-- src/java/overview.html | 14 +++--- src/test/org/apache/lucene/HighFreqTerms.java | 47 ++++++++----------- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/build.properties b/build.properties index e9c5f95792b..ad06f559a49 100644 --- a/build.properties +++ b/build.properties @@ -3,7 +3,7 @@ # --------------------------------------------------------- name=lucene Name=Lucene -version=1.2-rc1 +version=1.2-dev year=2000-2001 final.name=${name}-${version} debug=off diff --git a/build.xml b/build.xml index b1a639d0783..1cece54514f 100644 --- a/build.xml +++ b/build.xml @@ -299,8 +299,8 @@ - + @@ -311,9 +311,16 @@ - - + + + + + + + + + diff --git a/src/java/overview.html b/src/java/overview.html index adfcf832774..df01c23c500 100644 --- a/src/java/overview.html +++ b/src/java/overview.html @@ -82,19 +82,19 @@ method. Some simple examples of code which does this are: To demonstrate these, try something like: @@ -128,7 +128,7 @@ field. ] ]
    [ Note: "+" and "-" are canonical, but "AND", "OR" and "NOT" may be used. ] -The IndexHtml demo is more sophisticated.  +The IndexHtml demo is more sophisticated.  It incrementally maintains an index of HTML files, adding new files as they appear, deleting old files as they disappear and re-indexing files as they change. @@ -139,7 +139,7 @@ as they change.

> java -cp lucene.jar:demo/classes org.apache.lucene.IndexFilesIndexHTML java/jdk1.1.6/docs/relnotes
deleting java/jdk1.1.6/docs/relnotes/SMICopyright.html HTML indexes are searched using SUN's JavaWebServer -(JWS) and Search.jhtml.  To use +(JWS) and Search.jhtml.  To use this:

  • @@ -158,7 +158,7 @@ launch JWS, with the demo directory on CLASSPATH (only one class is actually needed);
  • -visit Search.html.
  • +visit Search.html.
Note that indexes can be updated while searches are going on.  Search.jhtml will re-open the index when it is updated so that the latest version is diff --git a/src/test/org/apache/lucene/HighFreqTerms.java b/src/test/org/apache/lucene/HighFreqTerms.java index 24206fc1271..b13b9b2a9a7 100644 --- a/src/test/org/apache/lucene/HighFreqTerms.java +++ b/src/test/org/apache/lucene/HighFreqTerms.java @@ -64,37 +64,30 @@ import org.apache.lucene.index.TermEnum; class HighFreqTerms { public static int numTerms = 100; - public static void main(String[] args) { - try { - Directory directory = new FSDirectory("demo index", false); - IndexReader reader = IndexReader.open(directory); + public static void main(String[] args) throws Exception { + IndexReader reader = IndexReader.open("index"); - TermInfoQueue tiq = new TermInfoQueue(numTerms); - TermEnum terms = reader.terms(); + TermInfoQueue tiq = new TermInfoQueue(numTerms); + TermEnum terms = reader.terms(); - int minFreq = 0; - while (terms.next()) { - if (terms.docFreq() > minFreq) { - tiq.put(new TermInfo(terms.term(), terms.docFreq())); - if (tiq.size() > numTerms) { // if tiq overfull - tiq.pop(); // remove lowest in tiq - minFreq = ((TermInfo)tiq.top()).docFreq; // reset minFreq - } - } + int minFreq = 0; + while (terms.next()) { + if (terms.docFreq() > minFreq) { + tiq.put(new TermInfo(terms.term(), terms.docFreq())); + if (tiq.size() > numTerms) { // if tiq overfull + tiq.pop(); // remove lowest in tiq + minFreq = ((TermInfo)tiq.top()).docFreq; // reset minFreq + } } - - while (tiq.size() != 0) { - TermInfo termInfo = (TermInfo)tiq.pop(); - System.out.println(termInfo.term + " " + termInfo.docFreq); - } - - reader.close(); - directory.close(); - - } catch (Exception e) { - System.out.println(" caught a " + e.getClass() + - "\n with message: " + e.getMessage()); } + + while (tiq.size() != 0) { + TermInfo termInfo = (TermInfo)tiq.pop(); + System.out.println(termInfo.term + " " + termInfo.docFreq); + } + + reader.close(); + } }