You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/08/23 01:00:29 UTC
svn commit: r1376302 - in /lucene/cms/trunk/content/pylucene:
features.mdtext index.mdtext install.mdtext mailing-lists.mdtext
Author: rmuir
Date: Wed Aug 22 23:00:29 2012
New Revision: 1376302
URL: http://svn.apache.org/viewvc?rev=1376302&view=rev
Log:
try to sanify formatting
Modified:
lucene/cms/trunk/content/pylucene/features.mdtext
lucene/cms/trunk/content/pylucene/index.mdtext
lucene/cms/trunk/content/pylucene/install.mdtext
lucene/cms/trunk/content/pylucene/mailing-lists.mdtext
Modified: lucene/cms/trunk/content/pylucene/features.mdtext
URL: http://svn.apache.org/viewvc/lucene/cms/trunk/content/pylucene/features.mdtext?rev=1376302&r1=1376301&r2=1376302&view=diff
==============================================================================
--- lucene/cms/trunk/content/pylucene/features.mdtext (original)
+++ lucene/cms/trunk/content/pylucene/features.mdtext Wed Aug 22 23:00:29 2012
@@ -1,10 +1,10 @@
<warning>
Before calling any PyLucene API that requires the Java VM, start it by
-calling <code>initVM(classpath, ...)</code>. More about this function
-in <a href="jcc/features.html">here</a>.
+calling _initVM(classpath, ...)_.
+More about this function in <a href="jcc/features.html">here</a>.
</warning>
-#Installing PyLucene
+##Installing PyLucene
PyLucene is a Python extension built with
<a href="jcc/">JCC</a>.
@@ -20,7 +20,7 @@ are <a href="install.html">here</a>.
-#API documentation
+##API documentation
PyLucene is closely tracking Java Lucene releases. It intends to
supports the entire Lucene API.
@@ -42,7 +42,7 @@ To help with debugging and to support so
exposes some Java runtime APIs.
-#Samples
+##Samples
The best way to learn PyLucene is to look at the many samples
included with the PyLucene source release or on the web at:
@@ -74,13 +74,13 @@ available from
-#Threading support with attachCurrentThread
+##Threading support with attachCurrentThread
Before PyLucene APIs can be used from a thread other than the main
thread that was not created by the Java Runtime, the
-<code>attachCurrentThread()</code> method must be called on the
-<code>JCCEnv</code> object returned by the <code>initVM()</code>
-or <code>getVMEnv()</code> functions.
+_attachCurrentThread()_ method must be called on the
+_JCCEnv_ object returned by the _initVM()_
+or _getVMEnv()_ functions.
@@ -92,9 +92,9 @@ actual Java Exception instance.
-#Handling Java arrays
+##Handling Java arrays
-Java arrays are returned to Python in a <code>JArray</code>
+Java arrays are returned to Python in a _JArray_
wrapper instance that implements the Python sequence protocol. It
is possible to change array elements but not to change the array
size.
@@ -106,26 +106,26 @@ array values after the call, a Java arra
first.<br/>
For example, accessing termDocs:
-<source>
+<code>
termDocs = reader.termDocs(Term("isbn", isbn))
docs = JArray('int')(1) # allocate an int[1] array
freq = JArray('int')(1) # allocate an int[1] array
if termDocs.read(docs, freq) == 1:
bits.set(docs[0]) # access the array's first element
-</source>
+</code>
-In addition to <code>'int'</code>, the <code>'JArray'</code>
-function accepts <code>'object'</code>, <code>'string'</code>,
-<code>'bool'</code>, <code>'byte'</code>, <code>'char'</code>,
-<code>'double'</code>, <code>'float'</code>, <code>'long'</code>
-and <code>'short'</code> to create an array of the corresponding
-type. The <code>JArray('object')</code> constructor takes a second
+In addition to _int_, the _JArray_
+function accepts _object_, _string_,
+_bool_, _byte_, _char_,
+_double_, _float_, _long_
+and _short_ to create an array of the corresponding
+type. The _JArray('object')_ constructor takes a second
argument denoting the class of the object elements. This argument
is optional and defaults to Object.
To convert a char array to a Python string use a
-<code>''.join(array)</code> construct.
+_''.join(array)_ construct.
Instead of an integer denoting the size of the desired Java array,
@@ -133,10 +133,10 @@ a sequence of objects of the expected el
in to the array constructor.<br/>
For example:
-<source>
+<code>
# creating a Java array of double from the [1.5, 2.5] list
JArray('double')([1.5, 2.5])
-</source>
+</code>
All methods that expect an array also accept a sequence of Python
objects of the expected element type. If no values are expected
@@ -149,7 +149,7 @@ information about handling arrays.
-#Differences between the Java Lucene and PyLucene APIs
+##Differences between the Java Lucene and PyLucene APIs
- The PyLucene API exposes all Java Lucene classes in a flat namespace
in the PyLucene module. For example, the Java import
@@ -167,7 +167,7 @@ verify and cast an instance respectively
-#Pythonic extensions to the Java Lucene APIs
+##Pythonic extensions to the Java Lucene APIs
Java is a very verbose language. Python, on the other hand, offers
many syntactically attractive constructs for iteration, property
@@ -181,73 +181,73 @@ are iterable in Python. Two values are r
iteration, the zero-based number of the document in the Hits
instance and the document instance itself.<br/>
The Java loop:
-<source>
+<code>
for (int i = 0; i < hits.length(); i++) {
Document doc = hits.doc(i);
System.out.println(hits.score(i) + " : " + doc.get("title"));
}
-</source>
+</code>
can be written in Python:
-<source>
+<code>
for hit in hits:
hit = Hit.cast_(hit)
print hit.getScore(), ':', hit.getDocument['title']
- </source>
+ </code>
if hit.iterator()'s next() method were declared to return
-<code>Hit</code> instead of <code>Object</code>, the above
+_Hit_ instead of _Object_, the above
cast_() call would not be unnecessary.<br/>
The same java loop can also be written:
-<source>
+<code>
for i xrange(len(hits)):
print hits.score(i), ':', hits[i]['title']
-</source>
+</code>
- Hits instances partially implement the Python 'sequence'
protocol.<br/>
The Java expressions:
-<source>
+<code>
hits.length()
doc = hits.get(i)
-</source>
+</code>
are better written in Python:
-<source>
+<code>
len(hits)
doc = hits[i]
-</source>
+</code>
- Document instances have fields whose values can be accessed
through the mapping protocol.<br/>
The Java expression:
-<source>
+<code>
doc.get("title")
-</source>
+</code>
is better written in Python:
-<source>
+<code>
doc['title']
-</source>
+</code>
- Document instances can be iterated over for their fields.<br/>
The Java loop:
-<source>
+<code>
Enumeration fields = doc.getFields();
while (fields.hasMoreElements()) {
Field field = (Field) fields.nextElement();
...
}
-</source>
+</code>
is better written in Python:
-<source>
+<code>
for field in doc.getFields():
field = Field.cast_(field)
...
-</source>
+</code>
Once JCC heeds Java 1.5 type parameters and once Java Lucene
makes use of them, such casting should become unncessary.
-#Extending Java Lucene classes from Python
+##Extending Java Lucene classes from Python
Many areas of the Lucene API expect the programmer to provide
their own implementation or specialization of a feature where
Modified: lucene/cms/trunk/content/pylucene/index.mdtext
URL: http://svn.apache.org/viewvc/lucene/cms/trunk/content/pylucene/index.mdtext?rev=1376302&r1=1376301&r2=1376302&view=diff
==============================================================================
--- lucene/cms/trunk/content/pylucene/index.mdtext (original)
+++ lucene/cms/trunk/content/pylucene/index.mdtext Wed Aug 22 23:00:29 2012
@@ -13,7 +13,7 @@ version of Java Lucene, version 3.6 as o
PyLucene is not a Lucene port but a Python wrapper around
Java Lucene. PyLucene embeds a Java VM with Lucene into a Python
process. The PyLucene Python extension, a Python module called
-`lucene` is machine-generated by JCC.
+**lucene** is machine-generated by JCC.
PyLucene is built with [JCC](jcc/index.html), a C++
Modified: lucene/cms/trunk/content/pylucene/install.mdtext
URL: http://svn.apache.org/viewvc/lucene/cms/trunk/content/pylucene/install.mdtext?rev=1376302&r1=1376301&r2=1376302&view=diff
==============================================================================
--- lucene/cms/trunk/content/pylucene/install.mdtext (original)
+++ lucene/cms/trunk/content/pylucene/install.mdtext Wed Aug 22 23:00:29 2012
@@ -1,11 +1,11 @@
-#Building PyLucene
+##Building PyLucene
PyLucene is completely code-generated by JCC whose sources are
included with the PyLucene sources.<br/>
-#Requirements
+##Requirements
To build PyLucene a Java Development Kit (JDK)
and <a href="http://ant.apache.org">Ant</a> are required; use of the
@@ -20,20 +20,20 @@ mode. See JCC's <a href="jcc/install.htm
instructions</a> for more information.
-#For the Impatient Ones
+##For the Impatient Ones
-- <code>pushd jcc</code>
-- <edit <code>setup.py</code> to match your environment>
-- <code>python setup.py build</code>
-- <code>sudo python setup.py install</code>
-- <code>popd</code>
-- <edit <code>Makefile</code> to match your environment>
-- <code>make</code>
-- <code>sudo make install</code>
-- <code>make test</code> (look for failures)
+- _pushd jcc_
+- <edit _setup.py_ to match your environment>
+- _python setup.py build_
+- _sudo python setup.py install_
+- _popd_
+- <edit _Makefile_ to match your environment>
+- _make_
+- _sudo make install_
+- _make test_ (look for failures)
-#For the Rest of Us
+##For the Rest of Us
Before building PyLucene, JCC must be
built first. See
@@ -41,8 +41,8 @@ JCC's <a href="jcc/install.html">install
instructions</a> for building and installing it.
Once JCC is built and installed, PyLucene is built
-via <code>make</code> which invokes JCC. See PyLucene's
-<code>Makefile</code> for configuration instructions.
+via _make_ which invokes JCC. See PyLucene's
+_Makefile_ for configuration instructions.
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.
@@ -63,16 +63,16 @@ tuned to workaround various limits, for
<code>--files separate</code>
-#Notes for Solaris
+##Notes for Solaris
PyLucene's Makefile is a GNU Makefile. Be sure to
-use <code>gmake</code> instead of plain <code>make</code>.
+use _gmake_ instead of plain _make_.
Just as when building JCC, Python's distutils must be nudged a bit to
invoke the correct compiler. Sun Studio's C compiler is
-called <code>cc</code> while its C++ compiler is
-called <code>CC</code>.<br/>
+called _cc_ while its C++ compiler is
+called _CC_.<br/>
To build PyLucene, use the following shell command to ensure that
Modified: lucene/cms/trunk/content/pylucene/mailing-lists.mdtext
URL: http://svn.apache.org/viewvc/lucene/cms/trunk/content/pylucene/mailing-lists.mdtext?rev=1376302&r1=1376301&r2=1376302&view=diff
==============================================================================
--- lucene/cms/trunk/content/pylucene/mailing-lists.mdtext (original)
+++ lucene/cms/trunk/content/pylucene/mailing-lists.mdtext Wed Aug 22 23:00:29 2012
@@ -1,6 +1,6 @@
Title: Mailing Lists
-#Users
+##Users
Historically, Lucene user issues or questions have almost always
been best addressed on the Java Lucene User mailing list. PyLucene
@@ -18,7 +18,7 @@ In order to post to the <a href="#Develo
list, it is necessary to first <a href="mailto:pylucene-dev-subscribe@lucene.apache.org">subscribe</a> to it. See below for more information.
</note>
-#Developers
+##Developers
If you'd like to contribute to PyLucene or are having questions
specific to PyLucene or JCC, please subscribe to the PyLucene
@@ -38,7 +38,7 @@ The PyLucene developer mailing list is:
In order to post to the list, it is necessary to first <a href="mailto:pylucene-dev-subscribe@lucene.apache.org">subscribe</a> to it.
</note>
-#Commits
+##Commits
If you'd like to be notified when source code changes are committed
to PyLucene's <a href="version_control.html">version control