mirror of https://github.com/apache/lucene.git
adding setMaxFieldLength() to the example; Jakarta -> Apache
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@178245 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9d2d4ead75
commit
30051ef3b5
|
@ -1,10 +1,10 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Jakarta Lucene API</title>
|
<title>Apache Lucene API</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>Jakarta Lucene is a high-performance, full-featured text search engine library.
|
<p>Apache Lucene is a high-performance, full-featured text search engine library.
|
||||||
Here's a simple example how to use Lucene for indexing and searching (using JUnit
|
Here's a simple example how to use Lucene for indexing and searching (using JUnit
|
||||||
to check if the results are what we expect):</p>
|
to check if the results are what we expect):</p>
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ to check if the results are what we expect):</p>
|
||||||
<font color="#ffffff"> </font><font color="#3f7f5f">// if one exists):</font><br/>
|
<font color="#ffffff"> </font><font color="#3f7f5f">// if one exists):</font><br/>
|
||||||
<font color="#ffffff"> </font><font color="#3f7f5f">//Directory directory = FSDirectory.getDirectory("/tmp/testindex", true);</font><br/>
|
<font color="#ffffff"> </font><font color="#3f7f5f">//Directory directory = FSDirectory.getDirectory("/tmp/testindex", true);</font><br/>
|
||||||
<font color="#ffffff"> </font><font color="#000000">IndexWriter iwriter = </font><font color="#7f0055"><b>new </b></font><font color="#000000">IndexWriter</font><font color="#000000">(</font><font color="#000000">directory, analyzer, </font><font color="#7f0055"><b>true</b></font><font color="#000000">)</font><font color="#000000">;</font><br/>
|
<font color="#ffffff"> </font><font color="#000000">IndexWriter iwriter = </font><font color="#7f0055"><b>new </b></font><font color="#000000">IndexWriter</font><font color="#000000">(</font><font color="#000000">directory, analyzer, </font><font color="#7f0055"><b>true</b></font><font color="#000000">)</font><font color="#000000">;</font><br/>
|
||||||
|
<font color="#ffffff"> </font><font color="#000000">iwriter.setMaxFieldLength</font><font color="#000000">(</font><font color="#990000">25000</font><font color="#000000">)</font><font color="#000000">;</font><br/>
|
||||||
<font color="#ffffff"> </font><font color="#000000">Document doc = </font><font color="#7f0055"><b>new </b></font><font color="#000000">Document</font><font color="#000000">()</font><font color="#000000">;</font><br/>
|
<font color="#ffffff"> </font><font color="#000000">Document doc = </font><font color="#7f0055"><b>new </b></font><font color="#000000">Document</font><font color="#000000">()</font><font color="#000000">;</font><br/>
|
||||||
<font color="#ffffff"> </font><font color="#000000">String text = </font><font color="#2a00ff">"This is the text to be indexed."</font><font color="#000000">;</font><br/>
|
<font color="#ffffff"> </font><font color="#000000">String text = </font><font color="#2a00ff">"This is the text to be indexed."</font><font color="#000000">;</font><br/>
|
||||||
<font color="#ffffff"> </font><font color="#000000">doc.add</font><font color="#000000">(</font><font color="#7f0055"><b>new </b></font><font color="#000000">Field</font><font color="#000000">(</font><font color="#2a00ff">"fieldname"</font><font color="#000000">, text, Field.Store.YES,</font><br/>
|
<font color="#ffffff"> </font><font color="#000000">doc.add</font><font color="#000000">(</font><font color="#7f0055"><b>new </b></font><font color="#000000">Field</font><font color="#000000">(</font><font color="#2a00ff">"fieldname"</font><font color="#000000">, text, Field.Store.YES,</font><br/>
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class TestDemo extends TestCase {
|
||||||
// if one exists):
|
// if one exists):
|
||||||
//Directory directory = FSDirectory.getDirectory("/tmp/testindex", true);
|
//Directory directory = FSDirectory.getDirectory("/tmp/testindex", true);
|
||||||
IndexWriter iwriter = new IndexWriter(directory, analyzer, true);
|
IndexWriter iwriter = new IndexWriter(directory, analyzer, true);
|
||||||
|
iwriter.setMaxFieldLength(25000);
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
String text = "This is the text to be indexed.";
|
String text = "This is the text to be indexed.";
|
||||||
doc.add(new Field("fieldname", text, Field.Store.YES,
|
doc.add(new Field("fieldname", text, Field.Store.YES,
|
||||||
|
|
Loading…
Reference in New Issue