mirror of https://github.com/apache/lucene.git
Added source code into distribution.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149612 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2a5c45947d
commit
1c31f33cce
|
@ -3,7 +3,7 @@
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
name=lucene
|
name=lucene
|
||||||
Name=Lucene
|
Name=Lucene
|
||||||
version=1.2-rc1
|
version=1.2-dev
|
||||||
year=2000-2001
|
year=2000-2001
|
||||||
final.name=${name}-${version}
|
final.name=${name}-${version}
|
||||||
debug=off
|
debug=off
|
||||||
|
|
13
build.xml
13
build.xml
|
@ -299,8 +299,8 @@
|
||||||
<mkdir dir="${dist.dir}/docs"/>
|
<mkdir dir="${dist.dir}/docs"/>
|
||||||
<mkdir dir="${dist.dir}/docs/api"/>
|
<mkdir dir="${dist.dir}/docs/api"/>
|
||||||
<mkdir dir="${dist.dir}/demo"/>
|
<mkdir dir="${dist.dir}/demo"/>
|
||||||
<mkdir dir="${dist.dir}/demo/src"/>
|
|
||||||
<mkdir dir="${dist.dir}/demo/classes"/>
|
<mkdir dir="${dist.dir}/demo/classes"/>
|
||||||
|
<mkdir dir="${dist.dir}/src"/>
|
||||||
|
|
||||||
<copy todir="${dist.dir}/docs">
|
<copy todir="${dist.dir}/docs">
|
||||||
<fileset dir="${docs.dir}"/>
|
<fileset dir="${docs.dir}"/>
|
||||||
|
@ -311,9 +311,16 @@
|
||||||
<copy todir="${dist.dir}/demo/classes">
|
<copy todir="${dist.dir}/demo/classes">
|
||||||
<fileset dir="${build.demo.classes}"/>
|
<fileset dir="${build.demo.classes}"/>
|
||||||
</copy>
|
</copy>
|
||||||
<copy todir="${dist.dir}/demo/src">
|
|
||||||
<fileset dir="${build.demo.src}"/>
|
<copy todir="${dist.dir}/src">
|
||||||
|
<fileset dir="src"/>
|
||||||
</copy>
|
</copy>
|
||||||
|
<copy todir="${dist.dir}/lib">
|
||||||
|
<fileset dir="lib"/>
|
||||||
|
</copy>
|
||||||
|
<copy todir="${dist.dir}/" file="build.xml"/>
|
||||||
|
<copy todir="${dist.dir}/" file="build.properties"/>
|
||||||
|
|
||||||
<copy file="${build.dir}/${final.name}.jar" todir="${dist.dir}"/>
|
<copy file="${build.dir}/${final.name}.jar" todir="${dist.dir}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
|
@ -82,19 +82,19 @@ method.</li>
|
||||||
Some simple examples of code which does this are:
|
Some simple examples of code which does this are:
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="../../demo/src/org/apache/lucene/FileDocument.java">FileDocument.java</a> contains
|
<a href="../../src/demo/org/apache/lucene/FileDocument.java">FileDocument.java</a> contains
|
||||||
code to create a Document for a file.</li>
|
code to create a Document for a file.</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="../../demo/src/org/apache/lucene/IndexFiles.java">IndexFiles.java</a> creates an
|
<a href="../../src/demo/org/apache/lucene/IndexFiles.java">IndexFiles.java</a> creates an
|
||||||
index for all the files contained in a directory.</li>
|
index for all the files contained in a directory.</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="../../demo/src/org/apache/lucene/DeleteFiles.java">DeleteFiles.java</a> deletes some
|
<a href="../../src/demo/org/apache/lucene/DeleteFiles.java">DeleteFiles.java</a> deletes some
|
||||||
of these files from the index.</li>
|
of these files from the index.</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="../../demo/src/org/apache/lucene/SearchFiles.java">SearchFiles.java</a> prompts for
|
<a href="../../src/demo/org/apache/lucene/SearchFiles.java">SearchFiles.java</a> prompts for
|
||||||
queries and searches an index.</li>
|
queries and searches an index.</li>
|
||||||
</ul>
|
</ul>
|
||||||
To demonstrate these, try something like:
|
To demonstrate these, try something like:
|
||||||
|
@ -128,7 +128,7 @@ field. ]
|
||||||
]
|
]
|
||||||
<br> [ Note: "+" and "-" are canonical, but "AND", "OR"
|
<br> [ Note: "+" and "-" are canonical, but "AND", "OR"
|
||||||
and "NOT" may be used. ]</blockquote>
|
and "NOT" may be used. ]</blockquote>
|
||||||
The <a href="../../demo/src/org/apache/lucene/IndexHTML.java">IndexHtml</a> demo is more sophisticated.
|
The <a href="../../src/demo/org/apache/lucene/IndexHTML.java">IndexHtml</a> demo is more sophisticated.
|
||||||
It incrementally maintains an index of HTML files, adding new files as
|
It incrementally maintains an index of HTML files, adding new files as
|
||||||
they appear, deleting old files as they disappear and re-indexing files
|
they appear, deleting old files as they disappear and re-indexing files
|
||||||
as they change.
|
as they change.
|
||||||
|
@ -139,7 +139,7 @@ as they change.
|
||||||
<p><tt>> <b>java -cp lucene.jar:demo/classes org.apache.lucene.IndexFilesIndexHTML java/jdk1.1.6/docs/relnotes</b></tt>
|
<p><tt>> <b>java -cp lucene.jar:demo/classes org.apache.lucene.IndexFilesIndexHTML java/jdk1.1.6/docs/relnotes</b></tt>
|
||||||
<br><tt>deleting java/jdk1.1.6/docs/relnotes/SMICopyright.html</tt></blockquote>
|
<br><tt>deleting java/jdk1.1.6/docs/relnotes/SMICopyright.html</tt></blockquote>
|
||||||
HTML indexes are searched using SUN's <a href="http://jserv.javasoft.com/products/webserver/index.html">JavaWebServer</a>
|
HTML indexes are searched using SUN's <a href="http://jserv.javasoft.com/products/webserver/index.html">JavaWebServer</a>
|
||||||
(JWS) and <a href="../../demo/src/org/apache/lucene/Search.jhtml">Search.jhtml</a>. To use
|
(JWS) and <a href="../../src/demo/org/apache/lucene/Search.jhtml">Search.jhtml</a>. To use
|
||||||
this:
|
this:
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
@ -158,7 +158,7 @@ launch JWS, with the <tt>demo</tt> directory on CLASSPATH (only one class
|
||||||
is actually needed);</li>
|
is actually needed);</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
visit <a href="../../demo/src/org/apache/lucene/Search.html">Search.html</a>.</li>
|
visit <a href="../../src/demo/org/apache/lucene/Search.html">Search.html</a>.</li>
|
||||||
</ul>
|
</ul>
|
||||||
Note that indexes can be updated while searches are going on. <tt>Search.jhtml</tt>
|
Note that indexes can be updated while searches are going on. <tt>Search.jhtml</tt>
|
||||||
will re-open the index when it is updated so that the latest version is
|
will re-open the index when it is updated so that the latest version is
|
||||||
|
|
|
@ -64,37 +64,30 @@ import org.apache.lucene.index.TermEnum;
|
||||||
class HighFreqTerms {
|
class HighFreqTerms {
|
||||||
public static int numTerms = 100;
|
public static int numTerms = 100;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws Exception {
|
||||||
try {
|
IndexReader reader = IndexReader.open("index");
|
||||||
Directory directory = new FSDirectory("demo index", false);
|
|
||||||
IndexReader reader = IndexReader.open(directory);
|
|
||||||
|
|
||||||
TermInfoQueue tiq = new TermInfoQueue(numTerms);
|
TermInfoQueue tiq = new TermInfoQueue(numTerms);
|
||||||
TermEnum terms = reader.terms();
|
TermEnum terms = reader.terms();
|
||||||
|
|
||||||
int minFreq = 0;
|
int minFreq = 0;
|
||||||
while (terms.next()) {
|
while (terms.next()) {
|
||||||
if (terms.docFreq() > minFreq) {
|
if (terms.docFreq() > minFreq) {
|
||||||
tiq.put(new TermInfo(terms.term(), terms.docFreq()));
|
tiq.put(new TermInfo(terms.term(), terms.docFreq()));
|
||||||
if (tiq.size() > numTerms) { // if tiq overfull
|
if (tiq.size() > numTerms) { // if tiq overfull
|
||||||
tiq.pop(); // remove lowest in tiq
|
tiq.pop(); // remove lowest in tiq
|
||||||
minFreq = ((TermInfo)tiq.top()).docFreq; // reset minFreq
|
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue