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/08/23 01:34:23 UTC

svn commit: r829806 - in /websites/staging/lucene/trunk/content: ./ pylucene/features.html

Author: buildbot
Date: Wed Aug 22 23:34:23 2012
New Revision: 829806

Log:
Staging update by buildbot for lucene

Modified:
    websites/staging/lucene/trunk/content/   (props changed)
    websites/staging/lucene/trunk/content/pylucene/features.html

Propchange: websites/staging/lucene/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Aug 22 23:34:23 2012
@@ -1 +1 @@
-1376312
+1376317

Modified: websites/staging/lucene/trunk/content/pylucene/features.html
==============================================================================
--- websites/staging/lucene/trunk/content/pylucene/features.html (original)
+++ websites/staging/lucene/trunk/content/pylucene/features.html Wed Aug 22 23:34:23 2012
@@ -203,11 +203,11 @@ array values after the call, a Java arra
 first.<br/>
 For example, accessing termDocs:</p>
 <p><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
+termDocs = reader.termDocs(Term("isbn", isbn))<br/>
+docs = JArray('int')(1)   # allocate an int[1] array<br/>
+freq = JArray('int')(1)   # allocate an int[1] array<br/>
+if termDocs.read(docs, freq) == 1:<br/>
+&nbsp;&nbsp;bits.set(docs[0])     # access the array's first element<br/>
 </code></p>
 <p>In addition to <i>int</i>, the <i>JArray</i>
 function accepts <i>object</i>, <i>string</i>,
@@ -265,24 +265,24 @@ iteration, the zero-based number of the 
 instance and the document instance itself.<br/>
 The Java loop:
 <code>
-  for (int i = 0; i &lt; hits.length(); i++) {<br/>
-      Document doc = hits.doc(i);<br/>
-      System.out.println(hits.score(i) + " : " + doc.get("title"));<br/>
-  }<br/>
+for (int i = 0; i &lt; hits.length(); i++) {<br/>
+&nbsp;&nbsp;Document doc = hits.doc(i);<br/>
+&nbsp;&nbsp;System.out.println(hits.score(i) + " : " + doc.get("title"));<br/>
+}<br/>
 </code>
 can be written in Python:
 <code>
- for hit in hits:<br/>
-     hit = Hit.cast_(hit)<br/>
-     print hit.getScore(), ':', hit.getDocument['title']<br/>
- </code>
+for hit in hits:<br/>
+&nbsp;&nbsp;hit = Hit.cast_(hit)<br/>
+&nbsp;&nbsp;print hit.getScore(), ':', hit.getDocument['title']<br/>
+</code>
 if hit.iterator()'s next() method were declared to return
 <i>Hit</i> instead of <i>Object</i>, the above
 cast_() call would not be unnecessary.<br/>
 The same java loop can also be written:
 <code>
-  for i xrange(len(hits)):<br/>
-      print hits.score(i), ':', hits[i]['title']<br/>
+for i xrange(len(hits)):<br/>
+&nbsp;&nbsp;print hits.score(i), ':', hits[i]['title']<br/>
 </code></p>
 </li>
 <li>
@@ -290,13 +290,13 @@ The same java loop can also be written:
 protocol.<br/>
 The Java expressions:
 <code>
-  hits.length();<br/>
-  doc = hits.get(i);<br/>
+hits.length();<br/>
+doc = hits.get(i);<br/>
 </code>
 are better written in Python:
 <code>
-  len(hits)<br/>
-  doc = hits[i]<br/>
+len(hits)<br/>
+doc = hits[i]<br/>
 </code></p>
 </li>
 <li>
@@ -304,28 +304,28 @@ are better written in Python:
 through the mapping protocol.<br/>
 The Java expression:
 <code>
-  doc.get("title")
+doc.get("title")
 </code>
 is better written in Python:
 <code>
-  doc['title']
+doc['title']
 </code></p>
 </li>
 <li>
 <p>Document instances can be iterated over for their fields.<br/>
 The Java loop:
 <code>
-  Enumeration fields = doc.getFields();<br/>
-  while (fields.hasMoreElements()) {<br/>
-      Field field = (Field) fields.nextElement();<br/>
-      ...<br/>
-  }<br/>
+Enumeration fields = doc.getFields();<br/>
+while (fields.hasMoreElements()) {<br/>
+&nbsp;&nbsp;Field field = (Field) fields.nextElement();<br/>
+&nbsp;&nbsp;...<br/>
+}<br/>
 </code>
 is better written in Python:
 <code>
-  for field in doc.getFields():<br/>
-      field = Field.cast_(field)<br/>
-      ...<br/>
+for field in doc.getFields():<br/>
+&nbsp;&nbsp;field = Field.cast_(field)<br/>
+&nbsp;&nbsp;...<br/>
 </code>
 Once JCC heeds Java 1.5 type parameters and once Java Lucene
 makes use of them, such casting should become unncessary.</p>