- updated lucene libraries to 3.6.1

- added lucene-grouping which enables faceted search; try this:
http://localhost:8090/solr/select?q=*:*&start=0&rows=3&facet=true&facet.field=host_s
pull/1/head
Michael Peter Christen 13 years ago
parent 1754fbb6d9
commit e65cecc419

@ -47,13 +47,7 @@
<classpathentry kind="lib" path="lib/guava-r05.jar"/> <classpathentry kind="lib" path="lib/guava-r05.jar"/>
<classpathentry kind="lib" path="lib/log4j-over-slf4j-1.6.1.jar"/> <classpathentry kind="lib" path="lib/log4j-over-slf4j-1.6.1.jar"/>
<classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/> <classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/>
<classpathentry kind="lib" path="lib/lucene-core-3.6.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-phonetic-3.6.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-spatial-3.6.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-spellchecker-3.6.0.jar"/>
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/> <classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-highlighter-3.6.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-analyzers-3.6.0.jar"/>
<classpathentry kind="lib" path="lib/servlet-api-2.5-20081211.jar"/> <classpathentry kind="lib" path="lib/servlet-api-2.5-20081211.jar"/>
<classpathentry kind="lib" path="lib/jetty-6.1.26-patched-JETTY-1340.jar"/> <classpathentry kind="lib" path="lib/jetty-6.1.26-patched-JETTY-1340.jar"/>
<classpathentry kind="lib" path="lib/jetty-util-6.1.26-patched-JETTY-1340.jar"/> <classpathentry kind="lib" path="lib/jetty-util-6.1.26-patched-JETTY-1340.jar"/>
@ -62,6 +56,13 @@
<classpathentry kind="lib" path="lib/jempbox-1.7.0.jar"/> <classpathentry kind="lib" path="lib/jempbox-1.7.0.jar"/>
<classpathentry kind="lib" path="lib/apache-solr-core-3.6.1.jar" sourcepath="/Volumes/Raptor/Data/sourcecode/solr-3.6.1/core/src/java"/> <classpathentry kind="lib" path="lib/apache-solr-core-3.6.1.jar" sourcepath="/Volumes/Raptor/Data/sourcecode/solr-3.6.1/core/src/java"/>
<classpathentry kind="lib" path="lib/apache-solr-solrj-3.6.1.jar" sourcepath="/Volumes/Raptor/Data/sourcecode/solr-3.6.1/core/src/java"/> <classpathentry kind="lib" path="lib/apache-solr-solrj-3.6.1.jar" sourcepath="/Volumes/Raptor/Data/sourcecode/solr-3.6.1/core/src/java"/>
<classpathentry kind="lib" path="lib/lucene-core-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-analyzers-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-grouping-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-highlighter-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-phonetic-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-spatial-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-spellchecker-3.6.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="lib/icu4j-core.jar"/> <classpathentry kind="lib" path="lib/icu4j-core.jar"/>
<classpathentry kind="lib" path="lib/htmllexer.jar"/> <classpathentry kind="lib" path="lib/htmllexer.jar"/>

@ -73,12 +73,13 @@
<string>$JAVAROOT/lib/json-simple-1.1.jar</string> <string>$JAVAROOT/lib/json-simple-1.1.jar</string>
<string>$JAVAROOT/lib/log4j-1.2.16.jar</string> <string>$JAVAROOT/lib/log4j-1.2.16.jar</string>
<string>$JAVAROOT/lib/log4j-over-slf4j-1.6.1.jar</string> <string>$JAVAROOT/lib/log4j-over-slf4j-1.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-analyzers-3.6.0.jar</string> <string>$JAVAROOT/lib/lucene-analyzers-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-core-3.6.0.jar</string> <string>$JAVAROOT/lib/lucene-grouping-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-highlighter-3.6.0.jar</string> <string>$JAVAROOT/lib/lucene-core-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-phonetic-3.6.0.jar</string> <string>$JAVAROOT/lib/lucene-highlighter-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-spatial-3.6.0.jar</string> <string>$JAVAROOT/lib/lucene-phonetic-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-spellchecker-3.6.0.jar</string> <string>$JAVAROOT/lib/lucene-spatial-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-spellchecker-3.6.1.jar</string>
<string>$JAVAROOT/lib/metadata-extractor-2.4.0-beta-1.jar</string> <string>$JAVAROOT/lib/metadata-extractor-2.4.0-beta-1.jar</string>
<string>$JAVAROOT/lib/mysql-connector-java-5.1.12-bin.jar</string> <string>$JAVAROOT/lib/mysql-connector-java-5.1.12-bin.jar</string>
<string>$JAVAROOT/lib/pdfbox-1.7.0.jar</string> <string>$JAVAROOT/lib/pdfbox-1.7.0.jar</string>

@ -193,12 +193,13 @@
<pathelement location="${lib}/jsoup-1.6.3.jar" /> <pathelement location="${lib}/jsoup-1.6.3.jar" />
<pathelement location="${lib}/log4j-1.2.16.jar" /> <pathelement location="${lib}/log4j-1.2.16.jar" />
<pathelement location="${lib}/log4j-over-slf4j-1.6.1.jar" /> <pathelement location="${lib}/log4j-over-slf4j-1.6.1.jar" />
<pathelement location="${lib}/lucene-analyzers-3.6.0.jar" /> <pathelement location="${lib}/lucene-analyzers-3.6.1.jar" />
<pathelement location="${lib}/lucene-core-3.6.0.jar" /> <pathelement location="${lib}/lucene-grouping-3.6.1.jar" />
<pathelement location="${lib}/lucene-highlighter-3.6.0.jar" /> <pathelement location="${lib}/lucene-core-3.6.1.jar" />
<pathelement location="${lib}/lucene-phonetic-3.6.0.jar" /> <pathelement location="${lib}/lucene-highlighter-3.6.1.jar" />
<pathelement location="${lib}/lucene-spatial-3.6.0.jar" /> <pathelement location="${lib}/lucene-phonetic-3.6.1.jar" />
<pathelement location="${lib}/lucene-spellchecker-3.6.0.jar" /> <pathelement location="${lib}/lucene-spatial-3.6.1.jar" />
<pathelement location="${lib}/lucene-spellchecker-3.6.1.jar" />
<pathelement location="${lib}/metadata-extractor-2.4.0-beta-1.jar" /> <pathelement location="${lib}/metadata-extractor-2.4.0-beta-1.jar" />
<pathelement location="${lib}/mysql-connector-java-5.1.12-bin.jar" /> <pathelement location="${lib}/mysql-connector-java-5.1.12-bin.jar" />
<pathelement location="${lib}/pdfbox-1.7.0.jar" /> <pathelement location="${lib}/pdfbox-1.7.0.jar" />

Binary file not shown.

@ -63,7 +63,7 @@ public class Tables implements Iterable<String> {
public final static String CIDX = "_cidx"; public final static String CIDX = "_cidx";
public final static int NOINDEX = 50000; public final static int NOINDEX = 50000;
public final static int RAMINDEX = 100000; public final static int RAMINDEX = 100000;
private static final String suffix = ".bheap"; private static final String suffix = ".bheap";
private static final String system_table_pkcounter = "pkcounter"; private static final String system_table_pkcounter = "pkcounter";
private static final String system_table_pkcounter_counterName = "pk"; private static final String system_table_pkcounter_counterName = "pk";
@ -95,7 +95,7 @@ public class Tables implements Iterable<String> {
} }
this.cidx = new ConcurrentHashMap<String, TablesColumnIndex>(); this.cidx = new ConcurrentHashMap<String, TablesColumnIndex>();
} }
public TablesColumnIndex getIndex(final String tableName, TablesColumnIndex.INDEXTYPE indexType) throws Exception { public TablesColumnIndex getIndex(final String tableName, TablesColumnIndex.INDEXTYPE indexType) throws Exception {
final TablesColumnIndex index; final TablesColumnIndex index;
switch(indexType) { switch(indexType) {
@ -104,7 +104,7 @@ public class Tables implements Iterable<String> {
break; break;
case BLOB: case BLOB:
final String idx_table = tableName+CIDX; final String idx_table = tableName+CIDX;
BEncodedHeap bheap; BEncodedHeap bheap;
bheap = this.getHeap(idx_table); bheap = this.getHeap(idx_table);
index = new TablesColumnBLOBIndex(bheap); index = new TablesColumnBLOBIndex(bheap);
break; break;
@ -113,13 +113,13 @@ public class Tables implements Iterable<String> {
} }
return index; return index;
} }
public TablesColumnIndex getIndex(final String tableName) throws Exception { public TablesColumnIndex getIndex(final String tableName) throws Exception {
// return an existing index // return an existing index
if(this.cidx.containsKey(tableName)) { if(this.cidx.containsKey(tableName)) {
return this.cidx.get(tableName); return this.cidx.get(tableName);
} }
// create a new index // create a new index
int size; int size;
try { try {
@ -129,15 +129,15 @@ public class Tables implements Iterable<String> {
} }
final TablesColumnIndex index; final TablesColumnIndex index;
if(size < NOINDEX) { if(size < NOINDEX) {
throw new Exception("TableColumnIndex not available for tables with less than "+NOINDEX+" rows: "+tableName); throw new RuntimeException("TableColumnIndex not available for tables with less than "+NOINDEX+" rows: "+tableName);
} }
if(size < RAMINDEX) { if(size < RAMINDEX) {
index = new TablesColumnRAMIndex(); index = new TablesColumnRAMIndex();
} else { } else {
final String idx_table = tableName+CIDX; final String idx_table = tableName+CIDX;
BEncodedHeap bheap; BEncodedHeap bheap;
try { try {
bheap = this.getHeap(idx_table); bheap = this.getHeap(idx_table);
} catch (IOException e) { } catch (IOException e) {
@ -146,20 +146,20 @@ public class Tables implements Iterable<String> {
} }
if(bheap != null) { if(bheap != null) {
index = new TablesColumnBLOBIndex(bheap); index = new TablesColumnBLOBIndex(bheap);
} else { } else {
index = new TablesColumnRAMIndex(); index = new TablesColumnRAMIndex();
} }
} }
this.cidx.put(tableName, index); this.cidx.put(tableName, index);
return index; return index;
} }
public boolean hasIndex (final String tableName) { public boolean hasIndex (final String tableName) {
return this.cidx.contains(tableName); return this.cidx.contains(tableName);
} }
public boolean hasIndex (final String tableName, final String columnName) { public boolean hasIndex (final String tableName, final String columnName) {
if(this.cidx.containsKey(tableName)) { if(this.cidx.containsKey(tableName)) {
return this.cidx.get(tableName).hasIndex(columnName); return this.cidx.get(tableName).hasIndex(columnName);
} }
try { try {
@ -168,22 +168,22 @@ public class Tables implements Iterable<String> {
} }
} catch (IOException e) { } catch (IOException e) {
Log.logException(e); Log.logException(e);
} }
return false; return false;
} }
public Iterator<Row> getByIndex(final String table, final String whereColumn, final String separator, final String whereValue) { public Iterator<Row> getByIndex(final String table, final String whereColumn, final String separator, final String whereValue) {
final HashSet<Tables.Row> rows = new HashSet<Tables.Row>(); final HashSet<Tables.Row> rows = new HashSet<Tables.Row>();
final TreeSet<byte[]> set1 = new TreeSet<byte[]>(TablesColumnIndex.NATURALORDER); final TreeSet<byte[]> set1 = new TreeSet<byte[]>(TablesColumnIndex.NATURALORDER);
final TreeSet<byte[]> set2 = new TreeSet<byte[]>(TablesColumnIndex.NATURALORDER); final TreeSet<byte[]> set2 = new TreeSet<byte[]>(TablesColumnIndex.NATURALORDER);
final String[] values = whereValue.split(separator); final String[] values = whereValue.split(separator);
if(this.hasIndex(table, whereColumn)) { if(this.hasIndex(table, whereColumn)) {
try { try {
final TablesColumnIndex index = this.getIndex(table); final TablesColumnIndex index = this.getIndex(table);
for(int i=0; i<values.length; i++) { for(int i=0; i<values.length; i++) {
if(index.containsKey(whereColumn, values[i])) { if(index.containsKey(whereColumn, values[i])) {
final Iterator<byte[]> biter = index.get(whereColumn, values[i]).iterator(); final Iterator<byte[]> biter = index.get(whereColumn, values[i]).iterator();
while(biter.hasNext()) { while(biter.hasNext()) {
set1.add(biter.next()); set1.add(biter.next());
} }
if(i==0) { if(i==0) {
@ -192,12 +192,12 @@ public class Tables implements Iterable<String> {
set2.retainAll(set1); set2.retainAll(set1);
} }
set1.clear(); set1.clear();
} }
} }
for(byte[] pk : set2) { for(byte[] pk : set2) {
rows.add(this.select(table, pk)); rows.add(this.select(table, pk));
} }
} catch (Exception e) { } catch (Exception e) {
Log.logException(e); Log.logException(e);
return new HashSet<Row>().iterator(); return new HashSet<Row>().iterator();
@ -214,10 +214,10 @@ public class Tables implements Iterable<String> {
patternBuilder.append(p3); patternBuilder.append(p3);
patternBuilder.append(values.length); patternBuilder.append(values.length);
patternBuilder.append('}'); patternBuilder.append('}');
final Pattern p = Pattern.compile(patternBuilder.toString(), Pattern.CASE_INSENSITIVE); final Pattern p = Pattern.compile(patternBuilder.toString(), Pattern.CASE_INSENSITIVE);
try { try {
return this.iterator(table, whereColumn, p); return this.iterator(table, whereColumn, p);
} catch (IOException e) { } catch (IOException e) {
Log.logException(e); Log.logException(e);
return new HashSet<Row>().iterator(); return new HashSet<Row>().iterator();
} }

Loading…
Cancel
Save