You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by bu...@apache.org on 2012/06/30 08:15:08 UTC
svn commit: r823810 - in /websites/staging/lucene/trunk/content: ./
pylucene/jcc/features.html
Author: buildbot
Date: Sat Jun 30 06:15:08 2012
New Revision: 823810
Log:
Staging update by buildbot for lucene
Modified:
websites/staging/lucene/trunk/content/ (props changed)
websites/staging/lucene/trunk/content/pylucene/jcc/features.html
Propchange: websites/staging/lucene/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sat Jun 30 06:15:08 2012
@@ -1 +1 @@
-1352203
+1355647
Modified: websites/staging/lucene/trunk/content/pylucene/jcc/features.html
==============================================================================
--- websites/staging/lucene/trunk/content/pylucene/jcc/features.html (original)
+++ websites/staging/lucene/trunk/content/pylucene/jcc/features.html Sat Jun 30 06:15:08 2012
@@ -270,75 +270,76 @@ declared in a flat namespace at the top
Python extension module.</p>
<p>JCC's command-line arguments are best illustrated via the PyLucene
example:</p>
-<p><source>
+<pre><code>
$ python -m jcc # run JCC to wrap
---jar lucene.jar # all public classes in the lucene jar file
---jar analyzers.jar # and the lucene analyzers contrib package
---jar snowball.jar # and the snowball contrib package
---jar highlighter.jar # and the highlighter contrib package
---jar regex.jar # and the regex search contrib package
---jar queries.jar # and the queries contrib package
---jar extensions.jar # and the Python extensions package
---package java.lang # including all dependencies found in the
- # java.lang package
---package java.util # and the java.util package
---package java.io # and the java.io package
-java.lang.System # and to explicitely wrap java.lang.System
-java.lang.Runtime # as well as java.lang.Runtime
-java.lang.Boolean # and java.lang.Boolean
-java.lang.Byte # and java.lang.Byte
-java.lang.Character # and java.lang.Character
-java.lang.Integer # and java.lang.Integer
-java.lang.Short # and java.lang.Short
-java.lang.Long # and java.lang.Long
-java.lang.Double # and java.lang.Double
-java.lang.Float # and java.lang.Float
-java.text.SimpleDateFormat
- # and java.text.SimpleDateFormat
-java.io.StringReader
- # and java.io.StringReader
-java.io.InputStreamReader
- # and java.io.InputStreamReader
-java.io.FileInputStream
- # and java.io.FileInputStream
-java.util.Arrays # and java.util.Arrays
---exclude org.apache.lucene.queryParser.Token
- # while explicitely not wrapping
- # org.apache.lucene.queryParser.Token
---exclude org.apache.lucene.queryParser.TokenMgrError
- # nor org.apache.lucene.queryParser.TokenMgrError
---exclude org.apache.lucene.queryParser.ParseException
- # nor.apache.lucene.queryParser.ParseException
---python lucene # generating Python wrappers into a module
- # called lucene
---version 2.4.0 # giving the Python extension egg version 2.4.0
---mapping org.apache.lucene.document.Document
- 'get:(Ljava/lang/String;)Ljava/lang/String;'
- # asking for a Python mapping protocol wrapper
- # for get access on the Document class by
- # calling its get method
---mapping java.util.Properties
- 'getProperty:(Ljava/lang/String;)Ljava/lang/String;'
- # asking for a Python mapping protocol wrapper
- # for get access on the Properties class by
- # calling its getProperty method
---sequence org.apache.lucene.search.Hits
- 'length:()I'
- 'doc:(I)Lorg/apache/lucene/document/Document;'
- # asking for a Python sequence protocol wrapper
- # for length and get access on the Hits class by
- # calling its length and doc methods
---files 2 # generating all C++ classes into about 2 .cpp
- # files
---build # and finally compiling the generated C++ code
- # into a Python egg via setuptools - when
- # installed - or a regular Python extension via
- # distutils or setuptools otherwise
---module collections.py
- # copying the collections.py module into the egg
---install # installing it into Python's site-packages
- # directory.
-</source></p>
+ --jar lucene.jar # all public classes in the lucene jar file
+ --jar analyzers.jar # and the lucene analyzers contrib package
+ --jar snowball.jar # and the snowball contrib package
+ --jar highlighter.jar # and the highlighter contrib package
+ --jar regex.jar # and the regex search contrib package
+ --jar queries.jar # and the queries contrib package
+ --jar extensions.jar # and the Python extensions package
+ --package java.lang # including all dependencies found in the
+ # java.lang package
+ --package java.util # and the java.util package
+ --package java.io # and the java.io package
+ java.lang.System # and to explicitely wrap java.lang.System
+ java.lang.Runtime # as well as java.lang.Runtime
+ java.lang.Boolean # and java.lang.Boolean
+ java.lang.Byte # and java.lang.Byte
+ java.lang.Character # and java.lang.Character
+ java.lang.Integer # and java.lang.Integer
+ java.lang.Short # and java.lang.Short
+ java.lang.Long # and java.lang.Long
+ java.lang.Double # and java.lang.Double
+ java.lang.Float # and java.lang.Float
+ java.text.SimpleDateFormat
+ # and java.text.SimpleDateFormat
+ java.io.StringReader
+ # and java.io.StringReader
+ java.io.InputStreamReader
+ # and java.io.InputStreamReader
+ java.io.FileInputStream
+ # and java.io.FileInputStream
+ java.util.Arrays # and java.util.Arrays
+ --exclude org.apache.lucene.queryParser.Token
+ # while explicitely not wrapping
+ # org.apache.lucene.queryParser.Token
+ --exclude org.apache.lucene.queryParser.TokenMgrError
+ # nor org.apache.lucene.queryParser.TokenMgrError
+ --exclude org.apache.lucene.queryParser.ParseException
+ # nor.apache.lucene.queryParser.ParseException
+ --python lucene # generating Python wrappers into a module
+ # called lucene
+ --version 2.4.0 # giving the Python extension egg version 2.4.0
+ --mapping org.apache.lucene.document.Document
+ 'get:(Ljava/lang/String;)Ljava/lang/String;'
+ # asking for a Python mapping protocol wrapper
+ # for get access on the Document class by
+ # calling its get method
+ --mapping java.util.Properties
+ 'getProperty:(Ljava/lang/String;)Ljava/lang/String;'
+ # asking for a Python mapping protocol wrapper
+ # for get access on the Properties class by
+ # calling its getProperty method
+ --sequence org.apache.lucene.search.Hits
+ 'length:()I'
+ 'doc:(I)Lorg/apache/lucene/document/Document;'
+ # asking for a Python sequence protocol wrapper
+ # for length and get access on the Hits class by
+ # calling its length and doc methods
+ --files 2 # generating all C++ classes into about 2 .cpp
+ # files
+ --build # and finally compiling the generated C++ code
+ # into a Python egg via setuptools - when
+ # installed - or a regular Python extension via
+ # distutils or setuptools otherwise
+ --module collections.py
+ # copying the collections.py module into the egg
+ --install # installing it into Python's site-packages
+ # directory.
+</code></pre>
+
<p>There are limits to both how many files can fit on the command line
and how large a C++ file the C++ compiler can handle. By default,
JCC generates one large C++ file containing the source code for all
@@ -386,7 +387,7 @@ the one with the shared classes by using
command line parameter. This ensures that only one copy of the
wrappers for the shared classes are generated and that they are
compatible among all extension modules sharing them.</p>
-<h2 id="using-wzxhzdk75distutilswzxhzdk76-vs-wzxhzdk77setuptoolswzxhzdk78">Using <code>distutils</code> vs <code>setuptools</code></h2>
+<h2 id="using-wzxhzdk86distutilswzxhzdk87-vs-wzxhzdk88setuptoolswzxhzdk89">Using <code>distutils</code> vs <code>setuptools</code></h2>
<p>By default, when building a Python extension,
if <code>setuptools</code> is found to be installed, it is used
over <code>distutils</code>. If you want to force the use
@@ -423,34 +424,22 @@ invoked with the <code>--install</code>
This parameter is optional and defaults to the
<code>CLASSPATH</code> string exported by the module
<code>initVM</code> is imported from.
-<source></p>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>import lucene
-lucene.initVM(classpath=lucene.CLASSPATH)
-</source></p>
-</blockquote>
-</blockquote>
-</blockquote>
+<pre><code>
+ >>> import lucene
+ >>> lucene.initVM(classpath=lucene.CLASSPATH)
+</code></pre></p>
</li>
<li>
<p><code>initialheap</code><br/>
The initial amount of Java heap to start the Java VM with. This
argument is a string that follows the same syntax as the
similar <code>-Xms</code> java command line argument.
-<source></p>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>import lucene
-lucene.initVM(initialheap='32m')
-lucene.Runtime.getRuntime().totalMemory()
- 33357824L
-</source></p>
-</blockquote>
-</blockquote>
-</blockquote>
+<pre><code>
+ >>> import lucene
+ >>> lucene.initVM(initialheap='32m')
+ >>> lucene.Runtime.getRuntime().totalMemory()
+ 33357824L
+</code></pre></p>
</li>
<li>
<p><code>maxheap</code><br/>
@@ -468,16 +457,10 @@ similar <code>-Xss</code> java command l
<p><code>vmargs</code><br/>
A string of comma separated additional options to pass to the VM
startup rountine. These are passed through as-is. For example:
-<source></p>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>import lucene
-lucene.initVM(vmargs='-Xcheck:jni,-verbose:jni,-verbose:gc')
-</source></p>
-</blockquote>
-</blockquote>
-</blockquote>
+<pre><code>
+ >>> import lucene
+ >>> lucene.initVM(vmargs='-Xcheck:jni,-verbose:jni,-verbose:gc')
+</code></pre></p>
</li>
</ul>
<p>The <code>initVM()</code> and <code>getVMEnv()</code> functions
@@ -511,25 +494,19 @@ classes that <code>Class.forName()</code
</li>
</ul>
<p>For example:</p>
-<p><source></p>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>from lucene import *
-initVM(CLASSPATH)
-findClass('org/apache/lucene/document/Document')
-<Class: class org.apache.lucene.document.Document>
-Class.forName('org.apache.lucene.document.Document')
-Traceback (most recent call last):
-File "<stdin>", line 1, in <module>
-lucene.JavaError: java.lang.ClassNotFoundException:
- org/apache/lucene/document/Document
-Class.forName('java.lang.Object')
-<Class: class java.lang.Object>
-</source></p>
-</blockquote>
-</blockquote>
-</blockquote>
+<pre><code>
+ >>> from lucene import *
+ >>> initVM(CLASSPATH)
+ >>> findClass('org/apache/lucene/document/Document')
+ <Class: class org.apache.lucene.document.Document>
+ >>> Class.forName('org.apache.lucene.document.Document')
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ lucene.JavaError: java.lang.ClassNotFoundException: org/apache/lucene/document/Document
+ >>> Class.forName('java.lang.Object')
+ <Class: class java.lang.Object>
+</code></pre>
+
<h2 id="type-casting-and-instance-checks">Type casting and instance checks</h2>
<p>Many Java APIs are declared to return types that are less specific
than the types actually returned. In Java 1.5, this is worked around
@@ -543,11 +520,13 @@ called <code>cast_</code> that implement
<p>Similarly, each wrapped class has a class method
called <code>instance_</code> that tests whether the wrapped java
instance is of the given type. For example:</p>
-<p><source>
-if BooleanQuery.instance_(query):
- booleanQuery = BooleanQuery.cast_(query)</p>
-<p>print booleanQuery.getClauses()
-</source></p>
+<pre><code>
+ if BooleanQuery.instance_(query):
+ booleanQuery = BooleanQuery.cast_(query)
+
+ print booleanQuery.getClauses()
+</code></pre>
+
<h2 id="handling-generic-classes">Handling generic classes</h2>
<p>Java 1.5 added support for parameterized types. JCC generates code
to heed type parameters unless the <code>--no-generics</code>
@@ -568,46 +547,36 @@ accept one type parameter. Its wrapper's
hence accepts one parameter, a Python class, to use as type
parameter for the return type of its <code>get()</code> method, among
others: </p>
-<p><source></p>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>a = ArrayList().of_(Document)
-a
-<ArrayList: []>
-a.parameters_
-(<type 'Document'>,)
-a.add(Document())
-True
-a.get(0)
-<Document: Document<>>
-</source></p>
-</blockquote>
-</blockquote>
-</blockquote>
+<pre><code>
+ >>> a = ArrayList().of_(Document)
+ >>> a
+ <ArrayList: []>
+ >>> a.parameters_
+ (<type 'Document'>,)
+ >>> a.add(Document())
+ True
+ >>> a.get(0)
+ <Document: Document<>>
+</code></pre>
+
<p>The use of type parameters is, of course, optional. A generic Java
class can still be used as before, without type parameters.
Downcasting from <code>Object</code> is then necessary:<br />
</p>
-<p><source></p>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>a = ArrayList()
-a
-<ArrayList: []>
-a.parameters_
-(None,)
-a.add(Document())
-True
-a.get(0)
-<Object: Document<>>
-Document.cast_(a.get(0))
-<Document: Document<>>
-</source></p>
-</blockquote>
-</blockquote>
-</blockquote>
+<pre><code>
+ >>> a = ArrayList()
+ >>> a
+ <ArrayList: []>
+ >>> a.parameters_
+ (None,)
+ >>> a.add(Document())
+ True
+ >>> a.get(0)
+ <Object: Document<>>
+ >>> Document.cast_(a.get(0))
+ <Document: Document<>>
+</code></pre>
+
<h2 id="handling-arrays">Handling arrays</h2>
<p>Java arrays are wrapped with a C++ JArray
template. The <code>[]</code> is available for read
@@ -624,25 +593,15 @@ a <code>''.join(array)</code> construct.
sequence object from python.</p>
<p>To instantiate a Java array from Python, use one of the following
forms:</p>
-<p><source></p>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>array = JArray('int')(size)</p>
-</blockquote>
-</blockquote>
-</blockquote>
-<h1 id="the-resulting-java-int-array-is-initialized-with-zeroes">the resulting Java int array is initialized with zeroes</h1>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>array = JArray('int')(sequence)</p>
-</blockquote>
-</blockquote>
-</blockquote>
-<h1 id="the-sequence-must-only-contain-ints">the sequence must only contain ints</h1>
-<h1 id="the-resulting-java-int-array-contains-the-ints-in-the-sequence">the resulting Java int array contains the ints in the sequence</h1>
-<p></source></p>
+<pre><code>
+ >>> array = JArray('int')(size)
+ # the resulting Java int array is initialized with zeroes
+
+ >>> array = JArray('int')(sequence)
+ # the sequence must only contain ints
+ # the resulting Java int array contains the ints in the sequence
+</code></pre>
+
<p>Instead of <code>'int'</code>, you may also use one
of <code>'object'</code>, <code>'string'</code>, <code>'bool'</code>,
<code>'byte'</code>, <code>'char'</code>, <code>'double'</code>,
@@ -659,110 +618,70 @@ plain <code>Object</code>. This is the c
nested arrays since there is no distinct Python type for every
different java object array class - all java object arrays are
wrapped by <code>JArray('object')</code>. For example:</p>
-<p><source></p>
-<h1 id="cast-obj-to-an-array-of-ints">cast obj to an array of ints</h1>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>JArray('int').cast_(obj)</p>
-</blockquote>
-</blockquote>
-</blockquote>
-<h1 id="cast-obj-to-an-array-of-document">cast obj to an array of Document</h1>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>JArray('object').cast_(obj, Document)
-</source></p>
-</blockquote>
-</blockquote>
-</blockquote>
+<pre><code>
+# cast obj to an array of ints
+>>> JArray('int').cast_(obj)
+# cast obj to an array of Document
+>>> JArray('object').cast_(obj, Document)
+</code></pre>
+
<p>In both cases, the java type of obj must be compatible with the
array type it is being cast to.</p>
-<p><source></p>
-<h1 id="using-nested-array">using nested array:</h1>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>d = JArray('object')(1, Document)
-d[0] = Document()
-d
-JArray<object>[<Document: Document<>>]
-d[0]
-<Document: Document<>>
-a = JArray('object')(2)
-a[0] = d
-a[1] = JArray('int')([0, 1, 2])
-a
-JArray<object>[<Object: [Lorg.apache.lucene.document.Document;@694f12>, <Object: [I@234265>]
-a[0]
-<Object: [Lorg.apache.lucene.document.Document;@694f12>
-a[1]
-<Object: [I@234265>
-JArray('object').cast_(a[0])[0]
-<Object: Document<>>
-JArray('object').cast_(a[0], Document)[0]
-<Document: Document<>>
-JArray('int').cast_(a[1])
-JArray<int>[0, 1, 2]
-JArray('int').cast_(a[1])[0]
-0
-</source></p>
-</blockquote>
-</blockquote>
-</blockquote>
+<pre><code>
+ # using nested array:
+
+ >>> d = JArray('object')(1, Document)
+ >>> d[0] = Document()
+ >>> d
+ JArray<object>[<Document: Document<>>]
+ >>> d[0]
+ <Document: Document<>>
+ >>> a = JArray('object')(2)
+ >>> a[0] = d
+ >>> a[1] = JArray('int')([0, 1, 2])
+ >>> a
+ JArray<object>[<Object: [Lorg.apache.lucene.document.Document;@694f12>, <Object: [I@234265>]
+ >>> a[0]
+ <Object: [Lorg.apache.lucene.document.Document;@694f12>
+ >>> a[1]
+ <Object: [I@234265>
+ >>> JArray('object').cast_(a[0])[0]
+ <Object: Document<>>
+ >>> JArray('object').cast_(a[0], Document)[0]
+ <Document: Document<>>
+ >>> JArray('int').cast_(a[1])
+ JArray<int>[0, 1, 2]
+ >>> JArray('int').cast_(a[1])[0]
+ 0
+</code></pre>
+
<p>To verify that a Java object is of a given array type, use
the <code>instance_()</code> method available on the array
type. This is not the same as verifying that it is assignable with
elements of a given type. For example, using the arrays created
above:</p>
-<p><source></p>
-<h1 id="is-d-array-of-object-are-ds-elements-of-type-object">is d array of Object ? are d's elements of type Object ?</h1>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>JArray('object').instance_(d)
-True</p>
-</blockquote>
-</blockquote>
-</blockquote>
-<h1 id="can-it-receive-object-instances">can it receive Object instances ?</h1>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>JArray('object').assignable_(d)
-False</p>
-</blockquote>
-</blockquote>
-</blockquote>
-<h1 id="is-it-array-of-document-are-ds-elements-of-type-document">is it array of Document ? are d's elements of type Document ?</h1>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>JArray('object').instance_(d, Document)
-True</p>
-</blockquote>
-</blockquote>
-</blockquote>
-<h1 id="is-it-array-of-class-are-ds-elements-of-type-class">is it array of Class ? are d's elements of type Class ?</h1>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>JArray('object').instance_(d, Class)
-False</p>
-</blockquote>
-</blockquote>
-</blockquote>
-<h1 id="can-it-receive-document-instances">can it receive Document instances ?</h1>
-<blockquote>
-<blockquote>
-<blockquote>
-<p>JArray('object').assignable_(d, Document)
-True
-</source></p>
-</blockquote>
-</blockquote>
-</blockquote>
+<pre><code>
+ # is d array of Object ? are d's elements of type Object ?
+ >>> JArray('object').instance_(d)
+ True
+
+ # can it receive Object instances ?
+ >>> JArray('object').assignable_(d)
+ False
+
+ # is it array of Document ? are d's elements of type Document ?
+ >>> JArray('object').instance_(d, Document)
+ True
+
+ # is it array of Class ? are d's elements of type Class ?
+ >>> JArray('object').instance_(d, Class)
+ False
+
+ # can it receive Document instances ?
+ >>> JArray('object').assignable_(d, Document)
+ True
+</code></pre>
+
<h2 id="exception-reporting">Exception reporting</h2>
<p>Exceptions that occur in the Java VM and that escape to C++ are
reported as a <code>javaError</code> C++ exception. When using
@@ -793,33 +712,40 @@ methods call the corresponding Python me
in parameters and returning the result to the Java VM caller.</p>
<p>For example, to implement a Lucene analyzer in Python, one would
implement first such an extension class in Java:</p>
-<p><source>
-package org.apache.pylucene.analysis;</p>
-<p>import org.apache.lucene.analysis.Analyzer;
+<pre><code>
+package org.apache.pylucene.analysis;
+
+import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
-import java.io.Reader;</p>
-<p>public class PythonAnalyzer extends Analyzer {
-private long pythonObject;</p>
-<p>public PythonAnalyzer()
-{
-}</p>
-<p>public void pythonExtension(long pythonObject)
-{
- this.pythonObject = pythonObject;
-}
-public long pythonExtension()
-{
- return this.pythonObject;
-}</p>
-<p>public void finalize()
- throws Throwable
-{
- pythonDecRef();
-}</p>
-<p>public native void pythonDecRef();
-public native TokenStream tokenStream(String fieldName, Reader reader);
+import java.io.Reader;
+
+public class PythonAnalyzer extends Analyzer {
+ private long pythonObject;
+
+ public PythonAnalyzer()
+ {
+ }
+
+ public void pythonExtension(long pythonObject)
+ {
+ this.pythonObject = pythonObject;
+ }
+ public long pythonExtension()
+ {
+ return this.pythonObject;
+ }
+
+ public void finalize()
+ throws Throwable
+ {
+ pythonDecRef();
+ }
+
+ public native void pythonDecRef();
+ public native TokenStream tokenStream(String fieldName, Reader reader);
}
-</source></p>
+</code></pre>
+
<p>The <code>pythonExtension()</code> methods is what makes this class
recognized as an extension class by JCC. They should be included
verbatim as above along with the declaration of
@@ -836,12 +762,12 @@ implementation should always be included
class and the other native methods, <code>tokenStream()</code> in
the example above.</p>
<p>The corresponding Python class(es) are implemented as follows:</p>
-<p><source>
-class <em>analyzer(PythonAnalyzer):
+<pre><code>
+class _analyzer(PythonAnalyzer):
def tokenStream(_self, fieldName, reader):
class _tokenStream(PythonTokenStream):
- def <strong>init</strong>(self</em>):
- super(<em>tokenStream, self</em>).<strong>init</strong>()
+ def __init__(self_):
+ super(_tokenStream, self_).__init__()
self_.TOKENS = ["1", "2", "3", "4", "5"]
self_.INCREMENTS = [1, 2, 1, 0, 1]
self_.i = 0
@@ -863,7 +789,8 @@ class <em>analyzer(PythonAnalyzer):
def close(self_):
pass
return _tokenStream()
-</source></p>
+</code></pre>
+
<p>When an <code><strong>init</strong>()</code> is declared, <code>super()</code>
must be called or else the Java wrapper class will not know about
the Python instance it needs to invoke.</p>
@@ -974,30 +901,32 @@ followed by ':' and its Java
<a href="http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/types.html#wp16432">signature</a>.</p>
<p>For example, <code>System.getProperties()['java.class.path']</code> is
made possible by:</p>
-<p><source>
+<pre><code>
--mapping java.util.Properties
'getProperty:(Ljava/lang/String;)Ljava/lang/String;'
# asking for a Python mapping protocol wrapper
# for get access on the Properties class by
# calling its getProperty method
-</source></p>
+</code></pre>
+
<p>JCC generates Python sequence length and get methods for a class
when requested to do so via the <code>--sequence</code> command line
option which takes three arguments, the class to generate the
sequence length and get for and the two java methods to use. The
methods are specified with their name followed by ':' and their Java
<a href="http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/types.html#wp16432">signature</a>. For example:</p>
-<p><source>
+<pre><code>
for i in xrange(len(hits)):
doc = hits[i]
...
-</source></p>
-<p>is made possible by:</p>
-<p><source>
+</code></pre>
+
+<p>is made possible by:
+<pre><code>
--sequence org.apache.lucene.search.Hits
'length:()I'
'doc:(I)Lorg/apache/lucene/document/Document;'
-</source></p></div>
+</code></pre></p></div>