r1 - 29 Mar 2007 - 22:29:59 - OferNaveYou are here: OSAF >  PyLucene Web  >  APIDocs > APIDocsJavaAPIDifferences

Java API Differences

  • The PyLucene API exposes all Java Lucene classes in a flat namespace in the PyLucene module. For example, the Java import statement: import org.apache.lucene.index.IndexReader; corresponds to the Python import statement: from PyLucene import IndexReader?

  • the static 'parse' method defined on org.apache.lucene.queryParser.MultiFieldQueryParser was renamed to 'parseQueries'.

  • Because 'delete' is a C++ keyword, the delete(int) and delete(org.apache.lucene.index.Term) methods defined on org.apache.lucene.index.IndexReader were renamed deleteDocument(int) and deleteDocuments(org.apache.lucene.index.Term) respectively.

  • Instead of taking array arguments the readBytes and readChars methods defined on org.apache.lucene.store.IndexInput take the number of bytes or unicode characters to read and return Python 'str' and 'unicode' objects instead respectively. For example:

         bytes = indexInput.readBytes(256)
         chars = indexInput.readChars(256)

  • Similarly, instead of taking array arguments the read method defined on org.apache.lucene.index.TermDocs takes the number of entries to read from the enumeration and returns two lists, the documents numbers and the term frequencies actually read. For example:

         docs, freqs = termDocs.read(16)

  • Downcasting is a common operation in Java but not a concept in Python. Because the wrapper objects implementing exactly the APIs of the declared type of the wrapped object, a number of downcasting and type checking methods were added to Lucene classes:

    • org.apache.lucene.analysis.Analyzer:

      • GermanAnalyzer? toGermanAnalyzer()
      • PerFieldAnalyzerWrapper? toPerFieldAnalyzerWrapper()
      • RussianAnalyzer? toRussianAnalyzer()
      • SimpleAnalyzer? toSimpleAnalyzer()
      • StandardAnalyzer? toStandardAnalyzer()
      • StopAnalyzer? toStopAnalyzer()
      • WhitespaceAnalyzer? toWhitespaceAnalyzer()
      • boolean isGermanAnalyzer()
      • boolean isPerFieldAnalyzerWrapper()
      • boolean isRussianAnalyzer()
      • boolean isSimpleAnalyzer()
      • boolean isStandardAnalyzer()
      • boolean isStopAnalyzer()
      • boolean isWhitespaceAnalyzer()

    • org.apache.lucene.search.Searchable:

      • Searcher toSearcher()
      • boolean isSearcher()

    • org.apache.lucene.search.Searcher:

      • Searchable toSearchable()
      • Searcher toSearcher()
      • IndexSearcher? toIndexSearcher()
      • MultiSearcher? toMultiSearcher()
      • ParallelMultiSearcher? toParallelMultiSearcher()
      • boolean isSearchable()
      • boolean isSearcher()
      • boolean isIndexSearcher()
      • boolean isMultiSearcher()
      • boolean isParallelMultiSearcher()

    • org.apache.lucene.search.Query:

      • Query toQuery()
      • BooleanQuery? toBooleanQuery()
      • PrefixQuery? toPrefixQuery()
      • TermQuery? toTermQuery()
      • PhraseQuery? toPhraseQuery()
      • FilteredQuery? toFilteredQuery()
      • RangeQuery? toRangeQuery()
      • MultiTermQuery? toMultiTermQuery()
      • FuzzyQuery? toFuzzyQuery()
      • WildcardQuery? toWildcardQuery()
      • SpanQuery? toSpanQuery()
      • SpanFirstQuery? toSpanFirstQuery()
      • SpanNearQuery? toSpanNearQuery()
      • SpanNotQuery? toSpanNotQuery()
      • SpanOrQuery? toSpanOrQuery()
      • SpanTermQuery? toSpanTermQuery()
      • boolean isQuery()
      • boolean isBooleanQuery()
      • boolean isPrefixQuery()
      • boolean isTermQuery()
      • boolean isPhraseQuery()
      • boolean isFilteredQuery()
      • boolean isRangeQuery()
      • boolean isMultiTermQuery()
      • boolean isFuzzyQuery()
      • boolean isWildcardQuery()
      • boolean isSpanQuery()
      • boolean isSpanFirstQuery()
      • boolean isSpanNearQuery()
      • boolean isSpanNotQuery()
      • boolean isSpanOrQuery()
      • boolean isSpanTermQuery()

    • org.apache.lucene.search.ScoreDoc:

      • FieldDoc? toFieldDoc()
      • boolean isFieldDoc()
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.