Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
#17 #48 upgrade to lucene 5.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryKey committed Feb 14, 2016
1 parent 9c30957 commit b30a0fd
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 28 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<properties>
<jdk.version>1.6</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lucene.version>5.2.1</lucene.version>
<lucene.version>5.3.0</lucene.version>
<ehcache.version>2.9.0</ehcache.version>
<hadoop.version>1.2.1</hadoop.version>
<log4j.version>1.2.17</log4j.version>
Expand Down
24 changes: 24 additions & 0 deletions src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<assembly>
<id>luke-release</id>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<includes>
<include>luke.sh</include>
<include>luke.bat</include>
</includes>
</fileSet>
<fileSet>
<directory>target</directory>
<outputDirectory>target</outputDirectory>
<includes>
<include>luke-with-deps.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>
4 changes: 1 addition & 3 deletions src/main/java/org/apache/lucene/luke/core/IndexInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.apache.lucene.luke.core.decoders.*;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Bits;

import java.util.*;

Expand Down Expand Up @@ -215,7 +214,6 @@ private void guessDecoders() throws Exception {
decoders = new HashMap<String, Decoder>();

Fields fields = MultiFields.getFields(reader);
Bits liveDocs = MultiFields.getLiveDocs(reader);

// if there are no postings, throw an exception
if (fields == null) {
Expand All @@ -231,7 +229,7 @@ private void guessDecoders() throws Exception {
if (terms != null) {
te = terms.iterator();
te.next();
pe = MultiFields.getTermDocsEnum(reader, liveDocs, fld, te.term());
pe = MultiFields.getTermDocsEnum(reader, fld, te.term());
IndexableField field = null;
while (field == null && pe.nextDoc() != DocsEnum.NO_MORE_DOCS) {
// look up first document which has this field value.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/lucene/luke/ui/DocumentsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ public Object execute() throws TaskExecutionException {
@Override
public void taskExecuted(Task<Object> task) {
try {
PostingsEnum pe = MultiFields.getTermDocsEnum(ir, null, lastTerm.field(), lastTerm.bytes());
PostingsEnum pe = MultiFields.getTermDocsEnum(ir, lastTerm.field(), lastTerm.bytes());
pe.nextDoc();
tdNum.setText("1");
DocumentsTab.this.pe = pe;
Expand Down Expand Up @@ -822,7 +822,7 @@ private void showPositionsWindow() {
Alert.alert(MessageType.WARNING, (String) resources.get("documentsTab_msg_docNotSelected"), getWindow());
} else {
// create new Enum to show positions info
PostingsEnum pe2 = MultiFields.getTermPositionsEnum(ir, null, lastTerm.field(), lastTerm.bytes());
PostingsEnum pe2 = MultiFields.getTermPositionsEnum(ir, lastTerm.field(), lastTerm.bytes());
if (pe2 == null) {
Alert.alert(MessageType.INFO, (String) resources.get("documentsTab_msg_positionNotIndexed"), getWindow());
} else {
Expand Down
18 changes: 3 additions & 15 deletions src/main/java/org/apache/lucene/luke/ui/LukeWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,17 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.Version;
import org.apache.pivot.beans.BXML;
import org.apache.pivot.beans.BXMLSerializer;
import org.apache.pivot.beans.Bindable;
import org.apache.pivot.collections.Map;
import org.apache.pivot.serialization.SerializationException;
import org.apache.pivot.util.Resources;
import org.apache.pivot.wtk.*;
import org.apache.pivot.wtk.Checkbox;
import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.Container;
import org.apache.pivot.wtk.Frame;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.MenuBar;
import org.apache.pivot.wtk.Mouse.Button;
import org.apache.pivot.wtk.ScrollPane;
import org.apache.pivot.wtk.TablePane.Row;
import org.apache.pivot.wtk.TextArea;
import org.apache.pivot.wtk.Window;

import java.awt.*;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
Expand All @@ -59,8 +49,6 @@
import java.util.Arrays;
import java.util.HashSet;

import org.apache.pivot.wtk.Mouse.Button;

public class LukeWindow extends Frame implements Bindable {

// private static final String MSG_READONLY = "FAILED: Read-Only index.";
Expand Down Expand Up @@ -302,7 +290,7 @@ public void openIndex(boolean force, String dirImpl, boolean readOnly, boolean r
return;
}
if (force) {
d.makeLock(IndexWriter.WRITE_LOCK_NAME).close();
d.obtainLock(IndexWriter.WRITE_LOCK_NAME).close();
} else {
errorMsg("Index is locked. Try 'Force unlock' when opening.");
d.close();
Expand Down Expand Up @@ -333,7 +321,7 @@ public void openIndex(boolean force, String dirImpl, boolean readOnly, boolean r
return;
}
if (force) {
d1.makeLock(IndexWriter.WRITE_LOCK_NAME).close();
d1.obtainLock(IndexWriter.WRITE_LOCK_NAME).close();
} else {
errorMsg("Index is locked. Try 'Force unlock' when opening.");
d1.close();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/getopt/luke/Luke.java
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ public void openIndex(String name, boolean force, String dirImpl, boolean ro,
// IndexWriter.unlock() was removed.
// https://issues.apache.org/jira/browse/LUCENE-6060
//IndexWriter.unlock(d);
d.makeLock(IndexWriter.WRITE_LOCK_NAME).close();
d.obtainLock(IndexWriter.WRITE_LOCK_NAME).close();
} else {
errorMsg("Index is locked. Try 'Force unlock' when opening.");
d.close();
Expand Down Expand Up @@ -884,7 +884,7 @@ public void openIndex(String name, boolean force, String dirImpl, boolean ro,
if (IndexWriter.isLocked(d1)) {
if (!ro) {
if (force) {
d1.makeLock(IndexWriter.WRITE_LOCK_NAME).close();
d1.obtainLock(IndexWriter.WRITE_LOCK_NAME).close();
} else {
errorMsg("Index is locked. Try 'Force unlock' when opening.");
d1.close();
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/getopt/luke/plugins/FsDirectory.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ public IndexInput openInput(String name, IOContext ctx) throws IOException {
return new DfsIndexInput(new Path(directory, name), bufSize, reporter);
}

public Lock makeLock(final String name) {
if (lock == null) {
lock = lockFactory.makeLock(this, name);
}
return lock;
public Lock obtainLock(final String name) throws IOException {
if (lock == null) {
lock = lockFactory.obtainLock(this, name);
}
return lock;
}

public synchronized void close() throws IOException {
Expand Down

0 comments on commit b30a0fd

Please sign in to comment.