Opened 9 years ago

Closed 2 years ago

Last modified 2 years ago

#716 closed enhancement (fixed)

Python Examples to Java

Reported by: Aakash Owned by: Aakash
Priority: normal Milestone:
Component: Xapian-bindings (Java) Version: 1.2.23
Severity: minor Keywords: Java, Examples
Cc: Blocked By:
Blocking: Operating System: All

Description

Converting the python examples in the "Getting Started" (http://getting-started-with-xapian.readthedocs.org/en/latest/practical_example/index.html) documentation to Java. The examples to be converted are

  1. index1.py
  2. search1.py
  3. delete1.py
  4. index_ranges.py, index_filters.py, index_sorting.py
  5. search_filters.py, search_ranges.py, search_sorting.py

Python example code: https://github.com/xapian/xapian-docsprint/tree/master/code/python

Attachments (3)

Index1.java (3.5 KB ) - added by Aakash 9 years ago.
Java implementation of index1.py
Search1.java (2.2 KB ) - added by Aakash 9 years ago.
Java implementation of search1.py
Delete1.java (972 bytes ) - added by Aakash 9 years ago.
Java implementation of delete1.py

Download all attachments as: .zip

Change History (6)

by Aakash, 9 years ago

Attachment: Index1.java added

Java implementation of index1.py

by Aakash, 9 years ago

Attachment: Search1.java added

Java implementation of search1.py

by Aakash, 9 years ago

Attachment: Delete1.java added

Java implementation of delete1.py

comment:1 by James Aylett, 9 years ago

Hi, just had a look at these. They're going in the right direction, but they really need to work identically to the python versions (so for instance no swapped argument orders), and have identical namings (because of how the user guide build and include system works). It's probably easiest if you drop these into a PR against the user guide (or just one to start off with would probably be even easier). Then we can discuss individual lines more easily.

It's also worth paying attention to consistency: some of your comments start with a leading space, some do not. I'd favour always having one: it looks neater.

Last edited 9 years ago by James Aylett (previous) (diff)

comment:2 by James Aylett, 9 years ago

The make invocation I'm using to build documentation using Java is as follows:

make clean html SPHINXOPTS=-tjava \
  JAVAC='javac -classpath ../build/xapian-bindings/java/built/xapian_jni.jar:./code/java/' \
  JAVA='java -Djava.library.path=../build/xapian-bindings/java/.libs -classpath ../build/xapian-bindings/java/built/xapian_jni.jar:./code/java/'

That's with the user manual repo checked out in the same directory as a 'build' directory where I built Xapian (and hence the bindings). Xapian is installed in /usr/local as normal. Ideally at some point we'd make the build system figure this out itself, but for now that's the way to do it. (You also have to comment out line 309 or thereabouts of conf.py, where it does sys.exit(1) if there are "bad characters" in the environment variables. We'll have to fix that properly at some point as well.)

Last edited 9 years ago by James Aylett (previous) (diff)

comment:3 by Olly Betts, 2 years ago

Resolution: fixed
Status: newclosed

This was merged back in 2016:

commit 91f8cf7057db61da6633e9fdefb9859e76007a6d
Merge: 77093a80 054e7b20
Author: Olly Betts <ojwbetts@gmail.com>
Date:   Mon Dec 19 00:44:11 2016 +1300

    Merge pull request #12 from mkash32/javaexamples
    
    Add Java Examples
Last edited 2 years ago by Olly Betts (previous) (diff)
Note: See TracTickets for help on using tickets.