You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2013/01/29 17:44:18 UTC
svn commit: r1439991 [2/2] - in /lucene/dev/branches/lucene4547: ./ lucene/
lucene/benchmark/ lucene/benchmark/conf/ lucene/benchmark/scripts/
lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/
lucene/benchmark/src/java/org/apache/lucene/ben...
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked6.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked6.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked6.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked6.java Tue Jan 29 16:44:16 2013
@@ -26,8 +26,6 @@ final class BulkOperationPacked6 extends
public BulkOperationPacked6() {
super(6);
- assert blockCount() == 3;
- assert valueCount() == 32;
}
@Override
@@ -73,7 +71,7 @@ final class BulkOperationPacked6 extends
@Override
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
- for (int i = 0; i < 8 * iterations; ++i) {
+ for (int i = 0; i < iterations; ++i) {
final int byte0 = blocks[blocksOffset++] & 0xFF;
values[valuesOffset++] = byte0 >>> 2;
final int byte1 = blocks[blocksOffset++] & 0xFF;
@@ -127,7 +125,7 @@ final class BulkOperationPacked6 extends
@Override
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
- for (int i = 0; i < 8 * iterations; ++i) {
+ for (int i = 0; i < iterations; ++i) {
final long byte0 = blocks[blocksOffset++] & 0xFF;
values[valuesOffset++] = byte0 >>> 2;
final long byte1 = blocks[blocksOffset++] & 0xFF;
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked7.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked7.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked7.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked7.java Tue Jan 29 16:44:16 2013
@@ -26,8 +26,6 @@ final class BulkOperationPacked7 extends
public BulkOperationPacked7() {
super(7);
- assert blockCount() == 7;
- assert valueCount() == 64;
}
@Override
@@ -109,7 +107,7 @@ final class BulkOperationPacked7 extends
@Override
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
- for (int i = 0; i < 8 * iterations; ++i) {
+ for (int i = 0; i < iterations; ++i) {
final int byte0 = blocks[blocksOffset++] & 0xFF;
values[valuesOffset++] = byte0 >>> 1;
final int byte1 = blocks[blocksOffset++] & 0xFF;
@@ -207,7 +205,7 @@ final class BulkOperationPacked7 extends
@Override
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
- for (int i = 0; i < 8 * iterations; ++i) {
+ for (int i = 0; i < iterations; ++i) {
final long byte0 = blocks[blocksOffset++] & 0xFF;
values[valuesOffset++] = byte0 >>> 1;
final long byte1 = blocks[blocksOffset++] & 0xFF;
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked8.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked8.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked8.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked8.java Tue Jan 29 16:44:16 2013
@@ -26,8 +26,6 @@ final class BulkOperationPacked8 extends
public BulkOperationPacked8() {
super(8);
- assert blockCount() == 1;
- assert valueCount() == 8;
}
@Override
@@ -42,7 +40,7 @@ final class BulkOperationPacked8 extends
@Override
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
- for (int j = 0; j < 8 * iterations; ++j) {
+ for (int j = 0; j < iterations; ++j) {
values[valuesOffset++] = blocks[blocksOffset++] & 0xFF;
}
}
@@ -59,7 +57,7 @@ final class BulkOperationPacked8 extends
@Override
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
- for (int j = 0; j < 8 * iterations; ++j) {
+ for (int j = 0; j < iterations; ++j) {
values[valuesOffset++] = blocks[blocksOffset++] & 0xFF;
}
}
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked9.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked9.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked9.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked9.java Tue Jan 29 16:44:16 2013
@@ -26,8 +26,6 @@ final class BulkOperationPacked9 extends
public BulkOperationPacked9() {
super(9);
- assert blockCount() == 9;
- assert valueCount() == 64;
}
@Override
@@ -111,7 +109,7 @@ final class BulkOperationPacked9 extends
@Override
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
- for (int i = 0; i < 8 * iterations; ++i) {
+ for (int i = 0; i < iterations; ++i) {
final int byte0 = blocks[blocksOffset++] & 0xFF;
final int byte1 = blocks[blocksOffset++] & 0xFF;
values[valuesOffset++] = (byte0 << 1) | (byte1 >>> 7);
@@ -213,7 +211,7 @@ final class BulkOperationPacked9 extends
@Override
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
- for (int i = 0; i < 8 * iterations; ++i) {
+ for (int i = 0; i < iterations; ++i) {
final long byte0 = blocks[blocksOffset++] & 0xFF;
final long byte1 = blocks[blocksOffset++] & 0xFF;
values[valuesOffset++] = (byte0 << 1) | (byte1 >>> 7);
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPackedSingleBlock.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPackedSingleBlock.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPackedSingleBlock.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPackedSingleBlock.java Tue Jan 29 16:44:16 2013
@@ -35,12 +35,22 @@ final class BulkOperationPackedSingleBlo
}
@Override
- public final int blockCount() {
+ public final int longBlockCount() {
return BLOCK_COUNT;
}
@Override
- public int valueCount() {
+ public final int byteBlockCount() {
+ return BLOCK_COUNT * 8;
+ }
+
+ @Override
+ public int longValueCount() {
+ return valueCount;
+ }
+
+ @Override
+ public final int byteValueCount() {
return valueCount;
}
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java Tue Jan 29 16:44:16 2013
@@ -140,9 +140,9 @@ class Packed64 extends PackedInts.Mutabl
final PackedInts.Decoder decoder = BulkOperation.of(PackedInts.Format.PACKED, bitsPerValue);
// go to the next block where the value does not span across two blocks
- final int offsetInBlocks = index % decoder.valueCount();
+ final int offsetInBlocks = index % decoder.longValueCount();
if (offsetInBlocks != 0) {
- for (int i = offsetInBlocks; i < decoder.valueCount() && len > 0; ++i) {
+ for (int i = offsetInBlocks; i < decoder.longValueCount() && len > 0; ++i) {
arr[off++] = get(index++);
--len;
}
@@ -152,12 +152,12 @@ class Packed64 extends PackedInts.Mutabl
}
// bulk get
- assert index % decoder.valueCount() == 0;
+ assert index % decoder.longValueCount() == 0;
int blockIndex = (int) ((long) index * bitsPerValue) >>> BLOCK_BITS;
assert (((long)index * bitsPerValue) & MOD_MASK) == 0;
- final int iterations = len / decoder.valueCount();
+ final int iterations = len / decoder.longValueCount();
decoder.decode(blocks, blockIndex, arr, off, iterations);
- final int gotValues = iterations * decoder.valueCount();
+ final int gotValues = iterations * decoder.longValueCount();
index += gotValues;
len -= gotValues;
assert len >= 0;
@@ -204,9 +204,9 @@ class Packed64 extends PackedInts.Mutabl
final PackedInts.Encoder encoder = BulkOperation.of(PackedInts.Format.PACKED, bitsPerValue);
// go to the next block where the value does not span across two blocks
- final int offsetInBlocks = index % encoder.valueCount();
+ final int offsetInBlocks = index % encoder.longValueCount();
if (offsetInBlocks != 0) {
- for (int i = offsetInBlocks; i < encoder.valueCount() && len > 0; ++i) {
+ for (int i = offsetInBlocks; i < encoder.longValueCount() && len > 0; ++i) {
set(index++, arr[off++]);
--len;
}
@@ -216,12 +216,12 @@ class Packed64 extends PackedInts.Mutabl
}
// bulk set
- assert index % encoder.valueCount() == 0;
+ assert index % encoder.longValueCount() == 0;
int blockIndex = (int) ((long) index * bitsPerValue) >>> BLOCK_BITS;
assert (((long)index * bitsPerValue) & MOD_MASK) == 0;
- final int iterations = len / encoder.valueCount();
+ final int iterations = len / encoder.longValueCount();
encoder.encode(arr, off, blocks, blockIndex, iterations);
- final int setValues = iterations * encoder.valueCount();
+ final int setValues = iterations * encoder.longValueCount();
index += setValues;
len -= setValues;
assert len >= 0;
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java Tue Jan 29 16:44:16 2013
@@ -92,8 +92,8 @@ abstract class Packed64SingleBlock exten
// bulk get
assert index % valuesPerBlock == 0;
final PackedInts.Decoder decoder = BulkOperation.of(PackedInts.Format.PACKED_SINGLE_BLOCK, bitsPerValue);
- assert decoder.blockCount() == 1;
- assert decoder.valueCount() == valuesPerBlock;
+ assert decoder.longBlockCount() == 1;
+ assert decoder.longValueCount() == valuesPerBlock;
final int blockIndex = index / valuesPerBlock;
final int nblocks = (index + len) / valuesPerBlock - blockIndex;
decoder.decode(blocks, blockIndex, arr, off, nblocks);
@@ -136,8 +136,8 @@ abstract class Packed64SingleBlock exten
// bulk set
assert index % valuesPerBlock == 0;
final BulkOperation op = BulkOperation.of(PackedInts.Format.PACKED_SINGLE_BLOCK, bitsPerValue);
- assert op.blockCount() == 1;
- assert op.valueCount() == valuesPerBlock;
+ assert op.longBlockCount() == 1;
+ assert op.longValueCount() == valuesPerBlock;
final int blockIndex = index / valuesPerBlock;
final int nblocks = (index + len) / valuesPerBlock - blockIndex;
op.encode(arr, off, blocks, blockIndex, nblocks);
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java Tue Jan 29 16:44:16 2013
@@ -280,15 +280,28 @@ public class PackedInts {
public static interface Decoder {
/**
- * The minimum number of long blocks to decode in a single call.
+ * The minimum number of long blocks to encode in a single iteration, when
+ * using long encoding.
*/
- int blockCount();
+ int longBlockCount();
/**
- * The number of values that can be stored in <code>blockCount()</code> long
+ * The number of values that can be stored in {@link #longBlockCount()} long
* blocks.
*/
- int valueCount();
+ int longValueCount();
+
+ /**
+ * The minimum number of byte blocks to encode in a single iteration, when
+ * using byte encoding.
+ */
+ int byteBlockCount();
+
+ /**
+ * The number of values that can be stored in {@link #byteBlockCount()} byte
+ * blocks.
+ */
+ int byteValueCount();
/**
* Read <code>iterations * blockCount()</code> blocks from <code>blocks</code>,
@@ -350,15 +363,28 @@ public class PackedInts {
public static interface Encoder {
/**
- * The minimum number of long blocks to encode in a single call.
+ * The minimum number of long blocks to encode in a single iteration, when
+ * using long encoding.
+ */
+ int longBlockCount();
+
+ /**
+ * The number of values that can be stored in {@link #longBlockCount()} long
+ * blocks.
+ */
+ int longValueCount();
+
+ /**
+ * The minimum number of byte blocks to encode in a single iteration, when
+ * using byte encoding.
*/
- int blockCount();
+ int byteBlockCount();
/**
- * The number of values that can be stored in <code>blockCount()</code> long
+ * The number of values that can be stored in {@link #byteBlockCount()} byte
* blocks.
*/
- int valueCount();
+ int byteValueCount();
/**
* Read <code>iterations * valueCount()</code> values from <code>values</code>,
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedReaderIterator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedReaderIterator.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedReaderIterator.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedReaderIterator.java Tue Jan 29 16:44:16 2013
@@ -39,14 +39,23 @@ final class PackedReaderIterator extends
this.format = format;
this.packedIntsVersion = packedIntsVersion;
bulkOperation = BulkOperation.of(format, bitsPerValue);
- iterations = bulkOperation.computeIterations(valueCount, mem);
+ iterations = iterations(mem);
assert valueCount == 0 || iterations > 0;
- nextBlocks = new byte[8 * iterations * bulkOperation.blockCount()];
- nextValues = new LongsRef(new long[iterations * bulkOperation.valueCount()], 0, 0);
+ nextBlocks = new byte[iterations * bulkOperation.byteBlockCount()];
+ nextValues = new LongsRef(new long[iterations * bulkOperation.byteValueCount()], 0, 0);
nextValues.offset = nextValues.longs.length;
position = -1;
}
+ private int iterations(int mem) {
+ int iterations = bulkOperation.computeIterations(valueCount, mem);
+ if (packedIntsVersion < PackedInts.VERSION_BYTE_ALIGNED) {
+ // make sure iterations is a multiple of 8
+ iterations = (iterations + 7) & 0xFFFFFFF8;
+ }
+ return iterations;
+ }
+
@Override
public LongsRef next(int count) throws IOException {
assert nextValues.length >= 0;
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedWriter.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedWriter.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/PackedWriter.java Tue Jan 29 16:44:16 2013
@@ -42,8 +42,8 @@ final class PackedWriter extends PackedI
this.format = format;
encoder = BulkOperation.of(format, bitsPerValue);
iterations = encoder.computeIterations(valueCount, mem);
- nextBlocks = new byte[8 * iterations * encoder.blockCount()];
- nextValues = new long[iterations * encoder.valueCount()];
+ nextBlocks = new byte[iterations * encoder.byteBlockCount()];
+ nextValues = new long[iterations * encoder.byteValueCount()];
off = 0;
written = 0;
finished = false;
Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/gen_BulkOperation.py
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/gen_BulkOperation.py?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/gen_BulkOperation.py (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/gen_BulkOperation.py Tue Jan 29 16:44:16 2013
@@ -57,28 +57,28 @@ FOOTER="""
* For every number of bits per value, there is a minimum number of
* blocks (b) / values (v) you need to write in order to reach the next block
* boundary:
- * - 16 bits per value -> b=1, v=4
- * - 24 bits per value -> b=3, v=8
- * - 50 bits per value -> b=25, v=32
- * - 63 bits per value -> b=63, v=64
+ * - 16 bits per value -> b=2, v=1
+ * - 24 bits per value -> b=3, v=1
+ * - 50 bits per value -> b=25, v=4
+ * - 63 bits per value -> b=63, v=8
* - ...
*
* A bulk read consists in copying <code>iterations*v</code> values that are
* contained in <code>iterations*b</code> blocks into a <code>long[]</code>
* (higher values of <code>iterations</code> are likely to yield a better
- * throughput) => this requires n * (b + v) longs in memory.
+ * throughput) => this requires n * (b + 8v) bytes of memory.
*
* This method computes <code>iterations</code> as
- * <code>ramBudget / (8 * (b + v))</code> (since a long is 8 bytes).
+ * <code>ramBudget / (b + 8v)</code> (since a long is 8 bytes).
*/
public final int computeIterations(int valueCount, int ramBudget) {
- final int iterations = (ramBudget >>> 3) / (blockCount() + valueCount());
+ final int iterations = ramBudget / (byteBlockCount() + 8 * byteValueCount());
if (iterations == 0) {
// at least 1
return 1;
- } else if ((iterations - 1) * blockCount() >= valueCount) {
+ } else if ((iterations - 1) * byteValueCount() >= valueCount) {
// don't allocate for more than the size of the reader
- return (int) Math.ceil((double) valueCount / valueCount());
+ return (int) Math.ceil((double) valueCount / byteValueCount());
} else {
return iterations;
}
@@ -131,14 +131,11 @@ def block_value_count(bpv, bits=64):
return (blocks, values)
def packed64(bpv, f):
- blocks, values = block_value_count(bpv)
mask = (1 << bpv) - 1
f.write("\n")
f.write(" public BulkOperationPacked%d() {\n" %bpv)
f.write(" super(%d);\n" %bpv)
- f.write(" assert blockCount() == %d;\n" %blocks)
- f.write(" assert valueCount() == %d;\n" %values)
f.write(" }\n\n")
if bpv == 64:
@@ -215,20 +212,19 @@ def p64_decode(bpv, f, bits):
if bits < bpv:
f.write(" throw new UnsupportedOperationException();\n")
else:
-
if is_power_of_two(bpv) and bpv < 8:
- f.write(" for (int j = 0; j < 8 * iterations; ++j) {\n")
+ f.write(" for (int j = 0; j < iterations; ++j) {\n")
f.write(" final byte block = blocks[blocksOffset++];\n")
for shift in xrange(8 - bpv, 0, -bpv):
f.write(" values[valuesOffset++] = (block >>> %d) & %d;\n" %(shift, mask))
f.write(" values[valuesOffset++] = block & %d;\n" %mask)
f.write(" }\n")
elif bpv == 8:
- f.write(" for (int j = 0; j < 8 * iterations; ++j) {\n")
+ f.write(" for (int j = 0; j < iterations; ++j) {\n")
f.write(" values[valuesOffset++] = blocks[blocksOffset++] & 0xFF;\n")
f.write(" }\n")
elif is_power_of_two(bpv) and bpv > 8:
- f.write(" for (int j = 0; j < %d * iterations; ++j) {\n" %(64 / bpv))
+ f.write(" for (int j = 0; j < iterations; ++j) {\n")
m = bits <= 32 and "0xFF" or "0xFFL"
f.write(" values[valuesOffset++] =")
for i in xrange(bpv / 8 - 1):
@@ -236,7 +232,7 @@ def p64_decode(bpv, f, bits):
f.write(" (blocks[blocksOffset++] & %s);\n" %m)
f.write(" }\n")
else:
- f.write(" for (int i = 0; i < 8 * iterations; ++i) {\n")
+ f.write(" for (int i = 0; i < iterations; ++i) {\n")
for i in xrange(0, byte_values):
byte_start = i * bpv / 8
bit_start = (i * bpv) % 8
Modified: lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java (original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java Tue Jan 29 16:44:16 2013
@@ -212,7 +212,7 @@ public class TestPackedInts extends Luce
if (!format.isSupported(bpv)) {
continue;
}
- final long byteCount = format.byteCount(version, valueCount, bpv);
+ final long byteCount = format.byteCount(version, valueCount, bpv);
String msg = "format=" + format + ",version=" + version + ",valueCount=" + valueCount + ",bpv=" + bpv;
// test iterator
@@ -706,16 +706,22 @@ public class TestPackedInts extends Luce
final PackedInts.Encoder encoder = PackedInts.getEncoder(format, PackedInts.VERSION_CURRENT, bpv);
final PackedInts.Decoder decoder = PackedInts.getDecoder(format, PackedInts.VERSION_CURRENT, bpv);
- final int blockCount = encoder.blockCount();
- final int valueCount = encoder.valueCount();
- assertEquals(blockCount, decoder.blockCount());
- assertEquals(valueCount, decoder.valueCount());
-
- final int iterations = random().nextInt(100);
+ final int longBlockCount = encoder.longBlockCount();
+ final int longValueCount = encoder.longValueCount();
+ final int byteBlockCount = encoder.byteBlockCount();
+ final int byteValueCount = encoder.byteValueCount();
+ assertEquals(longBlockCount, decoder.longBlockCount());
+ assertEquals(longValueCount, decoder.longValueCount());
+ assertEquals(byteBlockCount, decoder.byteBlockCount());
+ assertEquals(byteValueCount, decoder.byteValueCount());
+
+ final int longIterations = random().nextInt(100);
+ final int byteIterations = longIterations * longValueCount / byteValueCount;
+ assertEquals(longIterations * longValueCount, byteIterations * byteValueCount);
final int blocksOffset = random().nextInt(100);
final int valuesOffset = random().nextInt(100);
final int blocksOffset2 = random().nextInt(100);
- final int blocksLen = iterations * blockCount;
+ final int blocksLen = longIterations * longBlockCount;
// 1. generate random inputs
final long[] blocks = new long[blocksOffset + blocksLen];
@@ -729,8 +735,8 @@ public class TestPackedInts extends Luce
}
// 2. decode
- final long[] values = new long[valuesOffset + iterations * valueCount];
- decoder.decode(blocks, blocksOffset, values, valuesOffset, iterations);
+ final long[] values = new long[valuesOffset + longIterations * longValueCount];
+ decoder.decode(blocks, blocksOffset, values, valuesOffset, longIterations);
for (long value : values) {
assertTrue(value <= PackedInts.maxValue(bpv));
}
@@ -738,7 +744,7 @@ public class TestPackedInts extends Luce
final int[] intValues;
if (bpv <= 32) {
intValues = new int[values.length];
- decoder.decode(blocks, blocksOffset, intValues, valuesOffset, iterations);
+ decoder.decode(blocks, blocksOffset, intValues, valuesOffset, longIterations);
assertTrue(equals(intValues, values));
} else {
intValues = null;
@@ -746,21 +752,21 @@ public class TestPackedInts extends Luce
// 3. re-encode
final long[] blocks2 = new long[blocksOffset2 + blocksLen];
- encoder.encode(values, valuesOffset, blocks2, blocksOffset2, iterations);
+ encoder.encode(values, valuesOffset, blocks2, blocksOffset2, longIterations);
assertArrayEquals(msg, Arrays.copyOfRange(blocks, blocksOffset, blocks.length),
Arrays.copyOfRange(blocks2, blocksOffset2, blocks2.length));
// test encoding from int[]
if (bpv <= 32) {
final long[] blocks3 = new long[blocks2.length];
- encoder.encode(intValues, valuesOffset, blocks3, blocksOffset2, iterations);
+ encoder.encode(intValues, valuesOffset, blocks3, blocksOffset2, longIterations);
assertArrayEquals(msg, blocks2, blocks3);
}
// 4. byte[] decoding
final byte[] byteBlocks = new byte[8 * blocks.length];
ByteBuffer.wrap(byteBlocks).asLongBuffer().put(blocks);
- final long[] values2 = new long[valuesOffset + iterations * valueCount];
- decoder.decode(byteBlocks, blocksOffset * 8, values2, valuesOffset, iterations);
+ final long[] values2 = new long[valuesOffset + longIterations * longValueCount];
+ decoder.decode(byteBlocks, blocksOffset * 8, values2, valuesOffset, byteIterations);
for (long value : values2) {
assertTrue(msg, value <= PackedInts.maxValue(bpv));
}
@@ -768,18 +774,18 @@ public class TestPackedInts extends Luce
// test decoding to int[]
if (bpv <= 32) {
final int[] intValues2 = new int[values2.length];
- decoder.decode(byteBlocks, blocksOffset * 8, intValues2, valuesOffset, iterations);
+ decoder.decode(byteBlocks, blocksOffset * 8, intValues2, valuesOffset, byteIterations);
assertTrue(msg, equals(intValues2, values2));
}
// 5. byte[] encoding
final byte[] blocks3 = new byte[8 * (blocksOffset2 + blocksLen)];
- encoder.encode(values, valuesOffset, blocks3, 8 * blocksOffset2, iterations);
+ encoder.encode(values, valuesOffset, blocks3, 8 * blocksOffset2, byteIterations);
assertEquals(msg, LongBuffer.wrap(blocks2), ByteBuffer.wrap(blocks3).asLongBuffer());
// test encoding from int[]
if (bpv <= 32) {
final byte[] blocks4 = new byte[blocks3.length];
- encoder.encode(intValues, valuesOffset, blocks4, 8 * blocksOffset2, iterations);
+ encoder.encode(intValues, valuesOffset, blocks4, 8 * blocksOffset2, byteIterations);
assertArrayEquals(msg, blocks3, blocks4);
}
}
Modified: lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java Tue Jan 29 16:44:16 2013
@@ -1,7 +1,6 @@
package org.apache.lucene.facet.taxonomy;
-import org.apache.lucene.util.Constants;
-
+import java.util.Arrays;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -28,10 +27,6 @@ import org.apache.lucene.util.Constants;
*/
public class CategoryPath implements Comparable<CategoryPath> {
- // TODO: revisit when IBM releases Java 7 newer than SR3 (with a fix)
- // to validate, run e.g. TestAssociationExample with -Dtests.iters=1000
- private static final boolean IS_J9_JAVA7 = Constants.JRE_IS_MINIMUM_JAVA7 && Constants.JVM_VENDOR.contains("IBM");
-
/** An empty {@link CategoryPath} */
public static final CategoryPath EMPTY = new CategoryPath();
@@ -48,7 +43,7 @@ public class CategoryPath implements Com
// Used by singleton EMPTY
private CategoryPath() {
- components = new String[0];
+ components = null;
length = 0;
}
@@ -67,16 +62,12 @@ public class CategoryPath implements Com
/** Construct from the given path components. */
public CategoryPath(final String... components) {
assert components.length > 0 : "use CategoryPath.EMPTY to create an empty path";
- if (IS_J9_JAVA7) {
- // On IBM J9 Java 1.7.0, if we do 'this.components = components', then
- // at some point its length becomes 0 ... quite unexpectedly. If JIT is
- // disabled, it doesn't happen. This bypasses the bug by copying the
- // array (note, Arrays.copyOf did not help either!).
- this.components = new String[components.length];
- System.arraycopy(components, 0, this.components, 0, components.length);
- } else {
- this.components = components;
+ for (String comp : components) {
+ if (comp == null || comp.isEmpty()) {
+ throw new IllegalArgumentException("empty or null components not allowed: " + Arrays.toString(components));
+ }
}
+ this.components = components;
length = components.length;
}
@@ -84,9 +75,14 @@ public class CategoryPath implements Com
public CategoryPath(final String pathString, final char delimiter) {
String[] comps = pathString.split(Character.toString(delimiter));
if (comps.length == 1 && comps[0].isEmpty()) {
- components = EMPTY.components;
+ components = null;
length = 0;
} else {
+ for (String comp : comps) {
+ if (comp == null || comp.isEmpty()) {
+ throw new IllegalArgumentException("empty or null components not allowed: " + Arrays.toString(comps));
+ }
+ }
components = comps;
length = components.length;
}
Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestCategoryPath.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestCategoryPath.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestCategoryPath.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestCategoryPath.java Tue Jan 29 16:44:16 2013
@@ -1,5 +1,7 @@
package org.apache.lucene.facet.taxonomy;
+import java.util.Arrays;
+
import org.apache.lucene.facet.FacetTestCase;
import org.junit.Test;
@@ -173,9 +175,46 @@ public class TestCategoryPath extends Fa
pother = new CategoryPath("a/b/c/e", '/');
assertTrue(pother.compareTo(p) > 0);
assertTrue(p.compareTo(pother) < 0);
- pother = new CategoryPath("a/b/c//e", '/');
- assertTrue(pother.compareTo(p) < 0);
- assertTrue(p.compareTo(pother) > 0);
}
+ @Test
+ public void testEmptyNullComponents() throws Exception {
+ // LUCENE-4724: CategoryPath should not allow empty or null components
+ String[][] components_tests = new String[][] {
+ new String[] { "", "test" }, // empty in the beginning
+ new String[] { "test", "" }, // empty in the end
+ new String[] { "test", "", "foo" }, // empty in the middle
+ new String[] { null, "test" }, // null at the beginning
+ new String[] { "test", null }, // null in the end
+ new String[] { "test", null, "foo" }, // null in the middle
+ };
+
+ for (String[] components : components_tests) {
+ try {
+ assertNotNull(new CategoryPath(components));
+ fail("empty or null components should not be allowed: " + Arrays.toString(components));
+ } catch (IllegalArgumentException e) {
+ // ok
+ }
+ }
+
+ String[] path_tests = new String[] {
+ "/test", // empty in the beginning
+ "test//foo", // empty in the middle
+ };
+
+ for (String path : path_tests) {
+ try {
+ assertNotNull(new CategoryPath(path, '/'));
+ fail("empty or null components should not be allowed: " + path);
+ } catch (IllegalArgumentException e) {
+ // ok
+ }
+ }
+
+ // a trailing path separator is produces only one component
+ assertNotNull(new CategoryPath("test/", '/'));
+
+ }
+
}
Modified: lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java (original)
+++ lucene/dev/branches/lucene4547/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java Tue Jan 29 16:44:16 2013
@@ -56,6 +56,12 @@ public class TestCompactLabelToOrdinal e
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
uniqueValues[i] = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
+ // we cannot have empty path components, so eliminate all prefix as well
+ // as middle consecuive delimiter chars.
+ uniqueValues[i] = uniqueValues[i].replaceAll("/+", "/");
+ if (uniqueValues[i].startsWith("/")) {
+ uniqueValues[i] = uniqueValues[i].substring(1);
+ }
if (uniqueValues[i].indexOf(CompactLabelToOrdinal.TERMINATOR_CHAR) == -1) {
i++;
}
Modified: lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/JoinUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/JoinUtil.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/JoinUtil.java (original)
+++ lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/JoinUtil.java Tue Jan 29 16:44:16 2013
@@ -71,7 +71,7 @@ public final class JoinUtil {
case None:
TermsCollector termsCollector = TermsCollector.create(fromField, multipleValuesPerDocument);
fromSearcher.search(fromQuery, termsCollector);
- return new TermsQuery(toField, termsCollector.getCollectorTerms());
+ return new TermsQuery(toField, fromQuery, termsCollector.getCollectorTerms());
case Total:
case Max:
case Avg:
Modified: lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java (original)
+++ lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java Tue Jan 29 16:44:16 2013
@@ -93,6 +93,35 @@ class TermsIncludingScoreQuery extends Q
}
@Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ } if (!super.equals(obj)) {
+ return false;
+ } if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ TermsIncludingScoreQuery other = (TermsIncludingScoreQuery) obj;
+ if (!field.equals(other.field)) {
+ return false;
+ }
+ if (!unwrittenOriginalQuery.equals(other.unwrittenOriginalQuery)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result += prime * field.hashCode();
+ result += prime * unwrittenOriginalQuery.hashCode();
+ return result;
+ }
+
+ @Override
public Weight createWeight(IndexSearcher searcher) throws IOException {
final Weight originalWeight = originalQuery.createWeight(searcher);
return new Weight() {
Modified: lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/TermsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/TermsQuery.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/TermsQuery.java (original)
+++ lucene/dev/branches/lucene4547/lucene/join/src/java/org/apache/lucene/search/join/TermsQuery.java Tue Jan 29 16:44:16 2013
@@ -21,6 +21,7 @@ import org.apache.lucene.index.FilteredT
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.search.MultiTermQuery;
+import org.apache.lucene.search.Query;
import org.apache.lucene.util.AttributeSource;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefHash;
@@ -37,13 +38,15 @@ import java.util.Comparator;
class TermsQuery extends MultiTermQuery {
private final BytesRefHash terms;
+ private final Query fromQuery; // Used for equals() only
/**
* @param field The field that should contain terms that are specified in the previous parameter
* @param terms The terms that matching documents should have. The terms must be sorted by natural order.
*/
- TermsQuery(String field, BytesRefHash terms) {
+ TermsQuery(String field, Query fromQuery, BytesRefHash terms) {
super(field);
+ this.fromQuery = fromQuery;
this.terms = terms;
}
@@ -63,6 +66,31 @@ class TermsQuery extends MultiTermQuery
'}';
}
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ } if (!super.equals(obj)) {
+ return false;
+ } if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ TermsQuery other = (TermsQuery) obj;
+ if (!fromQuery.equals(other.fromQuery)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result += prime * fromQuery.hashCode();
+ return result;
+ }
+
static class SeekingTermSetTermsEnum extends FilteredTermsEnum {
private final BytesRefHash terms;
Modified: lucene/dev/branches/lucene4547/lucene/queries/src/java/org/apache/lucene/queries/CommonTermsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/queries/src/java/org/apache/lucene/queries/CommonTermsQuery.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/queries/src/java/org/apache/lucene/queries/CommonTermsQuery.java (original)
+++ lucene/dev/branches/lucene4547/lucene/queries/src/java/org/apache/lucene/queries/CommonTermsQuery.java Tue Jan 29 16:44:16 2013
@@ -74,7 +74,7 @@ public class CommonTermsQuery extends Qu
protected final Occur highFreqOccur;
protected float lowFreqBoost = 1.0f;
protected float highFreqBoost = 1.0f;
- protected int minNrShouldMatch = 0;
+ protected float minNrShouldMatch = 0;
/**
* Creates a new {@link CommonTermsQuery}
@@ -84,7 +84,7 @@ public class CommonTermsQuery extends Qu
* @param lowFreqOccur
* {@link Occur} used for low frequency terms
* @param maxTermFrequency
- * a value in [0..1] (or absolute number >=1) representing the
+ * a value in [0..1) (or absolute number >=1) representing the
* maximum threshold of a terms document frequency to be considered a
* low frequency term.
* @throws IllegalArgumentException
@@ -104,7 +104,7 @@ public class CommonTermsQuery extends Qu
* @param lowFreqOccur
* {@link Occur} used for low frequency terms
* @param maxTermFrequency
- * a value in [0..1] (or absolute number >=1) representing the
+ * a value in [0..1) (or absolute number >=1) representing the
* maximum threshold of a terms document frequency to be considered a
* low frequency term.
* @param disableCoord
@@ -160,15 +160,19 @@ public class CommonTermsQuery extends Qu
return buildQuery(maxDoc, contextArray, queryTerms);
}
+ protected int calcLowFreqMinimumNumberShouldMatch(int numOptional) {
+ if (minNrShouldMatch >= 1.0f || minNrShouldMatch == 0.0f) {
+ return (int) minNrShouldMatch;
+ }
+ return (int) (Math.round(minNrShouldMatch * numOptional));
+ }
+
protected Query buildQuery(final int maxDoc,
final TermContext[] contextArray, final Term[] queryTerms) {
BooleanQuery lowFreq = new BooleanQuery(disableCoord);
BooleanQuery highFreq = new BooleanQuery(disableCoord);
highFreq.setBoost(highFreqBoost);
lowFreq.setBoost(lowFreqBoost);
- if (lowFreqOccur == Occur.SHOULD) {
- lowFreq.setMinimumNumberShouldMatch(minNrShouldMatch);
- }
BooleanQuery query = new BooleanQuery(true);
for (int i = 0; i < queryTerms.length; i++) {
TermContext termContext = contextArray[i];
@@ -186,6 +190,11 @@ public class CommonTermsQuery extends Qu
}
}
+ final int numLowFreqClauses = lowFreq.clauses().size();
+ if (lowFreqOccur == Occur.SHOULD && numLowFreqClauses > 0) {
+ int minMustMatch = calcLowFreqMinimumNumberShouldMatch(numLowFreqClauses);
+ lowFreq.setMinimumNumberShouldMatch(minMustMatch);
+ }
if (lowFreq.clauses().isEmpty()) {
/*
* if lowFreq is empty we rewrite the high freq terms in a conjunction to
@@ -265,7 +274,9 @@ public class CommonTermsQuery extends Qu
/**
* Specifies a minimum number of the optional BooleanClauses which must be
* satisfied in order to produce a match on the low frequency terms query
- * part.
+ * part. This method accepts a float value in the range [0..1) as a fraction
+ * of the actual query terms in the low frequent clause or a number
+ * <tt>>=1</tt> as an absolut number of clauses that need to match.
*
* <p>
* By default no optional clauses are necessary for a match (unless there are
@@ -276,7 +287,7 @@ public class CommonTermsQuery extends Qu
* @param min
* the number of optional clauses that must match
*/
- public void setMinimumNumberShouldMatch(int min) {
+ public void setMinimumNumberShouldMatch(float min) {
this.minNrShouldMatch = min;
}
@@ -284,7 +295,7 @@ public class CommonTermsQuery extends Qu
* Gets the minimum number of the optional BooleanClauses which must be
* satisfied.
*/
- public int getMinimumNumberShouldMatch() {
+ public float getMinimumNumberShouldMatch() {
return minNrShouldMatch;
}
@@ -332,7 +343,7 @@ public class CommonTermsQuery extends Qu
result = prime * result
+ ((lowFreqOccur == null) ? 0 : lowFreqOccur.hashCode());
result = prime * result + Float.floatToIntBits(maxTermFrequency);
- result = prime * result + minNrShouldMatch;
+ result = prime * result + Float.floatToIntBits(minNrShouldMatch);
result = prime * result + ((terms == null) ? 0 : terms.hashCode());
return result;
}
Modified: lucene/dev/branches/lucene4547/lucene/queries/src/test/org/apache/lucene/queries/CommonTermsQueryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/queries/src/test/org/apache/lucene/queries/CommonTermsQueryTest.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/queries/src/test/org/apache/lucene/queries/CommonTermsQueryTest.java (original)
+++ lucene/dev/branches/lucene4547/lucene/queries/src/test/org/apache/lucene/queries/CommonTermsQueryTest.java Tue Jan 29 16:44:16 2013
@@ -175,6 +175,90 @@ public class CommonTermsQueryTest extend
}
}
+ public void testMinShouldMatch() throws IOException {
+ Directory dir = newDirectory();
+ RandomIndexWriter w = new RandomIndexWriter(random(), dir);
+ String[] docs = new String[] {"this is the end of the world right",
+ "is this it or maybe not",
+ "this is the end of the universe as we know it",
+ "there is the famous restaurant at the end of the universe",};
+ for (int i = 0; i < docs.length; i++) {
+ Document doc = new Document();
+ doc.add(newStringField("id", "" + i, Field.Store.YES));
+ doc.add(newTextField("field", docs[i], Field.Store.NO));
+ w.addDocument(doc);
+ }
+
+ IndexReader r = w.getReader();
+ IndexSearcher s = newSearcher(r);
+ {
+ CommonTermsQuery query = new CommonTermsQuery(Occur.SHOULD, Occur.SHOULD,
+ random().nextBoolean() ? 2.0f : 0.5f);
+ query.add(new Term("field", "is"));
+ query.add(new Term("field", "this"));
+ query.add(new Term("field", "end"));
+ query.add(new Term("field", "world"));
+ query.add(new Term("field", "universe"));
+ query.add(new Term("field", "right"));
+ query.setMinimumNumberShouldMatch(0.5f);
+ TopDocs search = s.search(query, 10);
+ assertEquals(search.totalHits, 1);
+ assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
+ }
+ {
+ CommonTermsQuery query = new CommonTermsQuery(Occur.SHOULD, Occur.SHOULD,
+ random().nextBoolean() ? 2.0f : 0.5f);
+ query.add(new Term("field", "is"));
+ query.add(new Term("field", "this"));
+ query.add(new Term("field", "end"));
+ query.add(new Term("field", "world"));
+ query.add(new Term("field", "universe"));
+ query.add(new Term("field", "right"));
+ query.setMinimumNumberShouldMatch(2.0f);
+ TopDocs search = s.search(query, 10);
+ assertEquals(search.totalHits, 1);
+ assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
+ }
+
+ {
+ CommonTermsQuery query = new CommonTermsQuery(Occur.SHOULD, Occur.SHOULD,
+ random().nextBoolean() ? 2.0f : 0.5f);
+ query.add(new Term("field", "is"));
+ query.add(new Term("field", "this"));
+ query.add(new Term("field", "end"));
+ query.add(new Term("field", "world"));
+ query.add(new Term("field", "universe"));
+ query.add(new Term("field", "right"));
+ query.setMinimumNumberShouldMatch(0.49f);
+ TopDocs search = s.search(query, 10);
+ assertEquals(search.totalHits, 3);
+ assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
+ assertEquals("2", r.document(search.scoreDocs[1].doc).get("id"));
+ assertEquals("3", r.document(search.scoreDocs[2].doc).get("id"));
+ }
+
+ {
+ CommonTermsQuery query = new CommonTermsQuery(Occur.SHOULD, Occur.SHOULD,
+ random().nextBoolean() ? 2.0f : 0.5f);
+ query.add(new Term("field", "is"));
+ query.add(new Term("field", "this"));
+ query.add(new Term("field", "end"));
+ query.add(new Term("field", "world"));
+ query.add(new Term("field", "universe"));
+ query.add(new Term("field", "right"));
+ query.setMinimumNumberShouldMatch(1.0f);
+ TopDocs search = s.search(query, 10);
+ assertEquals(search.totalHits, 3);
+ assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
+ assertEquals("2", r.document(search.scoreDocs[1].doc).get("id"));
+ assertEquals("3", r.document(search.scoreDocs[2].doc).get("id"));
+ }
+
+ r.close();
+ w.close();
+ dir.close();
+ }
+
public void testIllegalOccur() {
Random random = random();
Modified: lucene/dev/branches/lucene4547/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/CHANGES.txt?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene4547/solr/CHANGES.txt Tue Jan 29 16:44:16 2013
@@ -93,6 +93,8 @@ Bug Fixes
* SOLR-3926: Solr should support better way of finding active sorts (Eirik Lygre via
Erick Erickson)
+* SOLR-4342: Fix DataImportHandler stats to be a prper Map (hossman)
+
Optimizations
----------------------
@@ -107,6 +109,12 @@ Optimizations
* SOLR-3915: Color Legend for Cloud UI (steffkes)
+* SOLR-4306: Utilize indexInfo=false when gathering core names in UI
+ (steffkes)
+
+* SOLR-4284: Admin UI - make core list scrollable separate from the rest of
+ the UI (steffkes)
+
Other Changes
----------------------
Modified: lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java (original)
+++ lucene/dev/branches/lucene4547/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java Tue Jan 29 16:44:16 2013
@@ -25,6 +25,7 @@ import org.apache.solr.common.params.Sol
import org.apache.solr.common.params.UpdateParams;
import org.apache.solr.common.util.ContentStreamBase;
import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.ContentStream;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.util.SystemIdResolver;
@@ -247,7 +248,7 @@ public class DataImportHandler extends R
return super.getStatistics();
DocBuilder.Statistics cumulative = importer.cumulativeStatistics;
- NamedList result = new NamedList();
+ SimpleOrderedMap result = new SimpleOrderedMap();
result.add("Status", importer.getStatus().toString());
Modified: lucene/dev/branches/lucene4547/solr/site/html/tutorial.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/site/html/tutorial.html?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/site/html/tutorial.html (original)
+++ lucene/dev/branches/lucene4547/solr/site/html/tutorial.html Tue Jan 29 16:44:16 2013
@@ -310,7 +310,7 @@ make many changes to an index in a batch
There is also an <span class="codefrag">optimize</span> command that does the
same things as <span class="codefrag">commit</span>, but also forces all index
segments to be merged into a single segment -- this can be very resource
-intsenive, but may be worthwhile for improving search speed if your index
+intensive, but may be worthwhile for improving search speed if your index
changes very infrequently.
</p>
<p>
@@ -411,7 +411,7 @@ and is useful when testing or debugging
<h2 class="boxed">Highlighting</h2>
<div class="section">
<p>
- Hit highlighting returns relevent snippets of each returned document, and highlights
+ Hit highlighting returns relevant snippets of each returned document, and highlights
terms from the query within those context snippets.
</p>
<p>
@@ -522,7 +522,7 @@ Try it out at
<p>
The <a href="http://wiki.apache.org/solr/SchemaXml">schema</a> defines
the fields in the index and what type of analysis is applied to them. The current schema your collection is using
- may be viewed directly via the <a href="http://localhost:8983/solr/#/collection1/schema">Schema tab</a> in the Admin UI, or explored dynamicly using the <a href="http://localhost:8983/solr/#/collection1/schema-browser">Schema Browser tab</a>.
+ may be viewed directly via the <a href="http://localhost:8983/solr/#/collection1/schema">Schema tab</a> in the Admin UI, or explored dynamically using the <a href="http://localhost:8983/solr/#/collection1/schema-browser">Schema Browser tab</a>.
</p>
<p>
The best analysis components (tokenization and filtering) for your textual
@@ -616,7 +616,7 @@ Mousing over the section label to the le
<p>
When both <a href="http://localhost:8983/solr/#/collection1/analysis?analysis.fieldvalue=Canon+Power-Shot+SD500&analysis.query=power+shot+sd-500&analysis.fieldtype=text_en_splitting&verbose_output=0">Index and Query</a>
values are provided, two tables will be displayed side by side showing the
-results of each chain. Terms in the Index chain results that are equivilent
+results of each chain. Terms in the Index chain results that are equivalent
to the final terms produced by the Query chain will be highlighted.
</p>
<p>
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/admin.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/admin.html?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/admin.html (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/admin.html Tue Jan 29 16:44:16 2013
@@ -111,8 +111,12 @@ limitations under the License.
</ul>
- <ul id="menu-selector">
- </ul>
+ <div id="core-selector">
+ <select data-placeholder="Core Selector"></select>
+ </div>
+ <div id="core-menu">
+ <ul></ul>
+ </div>
</div>
</div>
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/common.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/common.css?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/common.css (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/common.css Tue Jan 29 16:44:16 2013
@@ -172,7 +172,7 @@ ul
#header
{
padding-bottom: 10px;
- position: absolute;
+ position: fixed;
z-index: 42;
}
@@ -340,12 +340,6 @@ ul
width: 100%;
}
-#content > pre
-{
- max-height: 600px;
- overflow: auto;
-}
-
#content .block
{
margin-bottom: 10px;
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/menu.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/menu.css?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/menu.css (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/menu.css Tue Jan 29 16:44:16 2013
@@ -1,13 +1,13 @@
#menu-wrapper
{
- position: absolute;
- top: 90px;
+ position: fixed;
+ top: 120px;
width: 150px;
}
.has-environment #menu-wrapper
{
- top: 130px;
+ top: 160px;
}
#menu-wrapper a
@@ -18,6 +18,23 @@
text-overflow: ellipsis;
}
+#core-selector
+{
+ margin-top: 20px;
+ padding-right: 10px;
+}
+
+#core-selector a
+{
+ padding: 0;
+ padding-left: 8px;
+}
+
+#core-selector select
+{
+ width: 100%;
+}
+
#menu-wrapper .active p
{
background-color: #fafafa;
@@ -121,32 +138,27 @@
display: none;
}
-#menu-selector
-{
- margin-top: 20px;
-}
-
-#menu-selector p
+#core-menu p
{
border-top: 1px solid #f0f0f0;
}
-#menu-selector li:first-child p
+#core-menu li:first-child p
{
border-top: 0;
}
-#menu-selector p a
+#core-menu p a
{
background-image: url( ../../img/ico/status-offline.png );
}
-#menu-selector .active p a
+#core-menu .active p a
{
background-image: url( ../../img/ico/box.png );
}
-#menu-selector ul,
+#core-menu ul,
#menu ul
{
display: none;
@@ -154,7 +166,7 @@
padding-bottom: 10px;
}
-#menu-selector .active ul,
+#core-menu .active ul,
#menu .active ul
{
display: block;
@@ -165,7 +177,7 @@
border-bottom: 0;
}
-#menu-selector ul li a,
+#core-menu ul li a,
#menu ul li a
{
background-position: 7px 50%;
@@ -175,20 +187,20 @@
padding-left: 26px;
}
-#menu-selector ul li:last-child a,
+#core-menu ul li:last-child a,
#menu ul li:last-child a
{
border-bottom: 0;
}
-#menu-selector ul li a:hover,
+#core-menu ul li a:hover,
#menu ul li a:hover
{
background-color: #f0f0f0;
color: #333;
}
-#menu-selector ul li.active a,
+#core-menu ul li.active a,
#menu ul li.active a
{
background-color: #d0d0d0;
@@ -213,7 +225,7 @@
#menu #cloud.global .rgraph a { background-image: url( ../../img/ico/asterisk.png ); }
#menu #cloud.global .dump a { background-image: url( ../../img/ico/download-cloud.png ); }
-#menu-selector .ping.error a
+#core-menu .ping.error a
{
background-color: #ffcccc;
@@ -222,17 +234,18 @@
cursor: help;
}
-#menu-selector .query a { background-image: url( ../../img/ico/magnifier.png ); }
-#menu-selector .schema a { background-image: url( ../../img/ico/table.png ); }
-#menu-selector .config a { background-image: url( ../../img/ico/gear.png ); }
-#menu-selector .analysis a { background-image: url( ../../img/ico/funnel.png ); }
-#menu-selector .schema-browser a { background-image: url( ../../img/ico/book-open-text.png ); }
-#menu-selector .replication a { background-image: url( ../../img/ico/node.png ); }
-#menu-selector .distribution a { background-image: url( ../../img/ico/node-select.png ); }
-#menu-selector .ping a { background-image: url( ../../img/ico/system-monitor.png ); }
-#menu-selector .logging a { background-image: url( ../../img/ico/inbox-document-text.png ); }
-#menu-selector .plugins a { background-image: url( ../../img/ico/block.png ); }
-#menu-selector .dataimport a { background-image: url( ../../img/ico/document-import.png ); }
+#core-menu .overview a { background-image: url( ../../img/ico/home.png ); }
+#core-menu .query a { background-image: url( ../../img/ico/magnifier.png ); }
+#core-menu .schema a { background-image: url( ../../img/ico/table.png ); }
+#core-menu .config a { background-image: url( ../../img/ico/gear.png ); }
+#core-menu .analysis a { background-image: url( ../../img/ico/funnel.png ); }
+#core-menu .schema-browser a { background-image: url( ../../img/ico/book-open-text.png ); }
+#core-menu .replication a { background-image: url( ../../img/ico/node.png ); }
+#core-menu .distribution a { background-image: url( ../../img/ico/node-select.png ); }
+#core-menu .ping a { background-image: url( ../../img/ico/system-monitor.png ); }
+#core-menu .logging a { background-image: url( ../../img/ico/inbox-document-text.png ); }
+#core-menu .plugins a { background-image: url( ../../img/ico/block.png ); }
+#core-menu .dataimport a { background-image: url( ../../img/ico/document-import.png ); }
#content #navigation
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/schema-browser.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/schema-browser.css?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/schema-browser.css (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/css/styles/schema-browser.css Tue Jan 29 16:44:16 2013
@@ -545,6 +545,7 @@
clear: left;
float: left;
margin-left: 2px;
+ white-space: nowrap;
}
#content #schema-browser #data #field .histogram-holder li:hover dl
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/app.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/app.js?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/app.js (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/app.js Tue Jan 29 16:44:16 2013
@@ -92,20 +92,26 @@ var sammy = $.sammy
$( 'li.active', menu_wrapper )
.removeClass( 'active' );
- if( this.params.splat )
+ // global dashboard doesn't have params.splat
+ if( !this.params.splat )
{
- var selector = '~' === this.params.splat[0][0]
- ? '#' + this.params.splat[0].replace( /^~/, '' ) + '.global'
- : '#menu-selector #' + this.params.splat[0].replace( /\./g, '__' );
-
- var active_element = $( selector, menu_wrapper );
-
- if( 0 === active_element.size() )
- {
- this.app.error( 'There exists no core with name "' + this.params.splat[0] + '"' );
- return false;
- }
+ this.params.splat = [ '~index' ];
+ }
+ var selector = '~' === this.params.splat[0][0]
+ ? '#' + this.params.splat[0].replace( /^~/, '' ) + '.global'
+ : '#core-selector #' + this.params.splat[0].replace( /\./g, '__' );
+
+ var active_element = $( selector, menu_wrapper );
+
+ if( 0 === active_element.size() )
+ {
+ this.app.error( 'There exists no core with name "' + this.params.splat[0] + '"' );
+ return false;
+ }
+
+ if( active_element.hasClass( 'global' ) )
+ {
active_element
.addClass( 'active' );
@@ -115,10 +121,28 @@ var sammy = $.sammy
.addClass( 'active' );
}
- if( !active_element.hasClass( 'global' ) )
+ $( '#core-selector option[selected]' )
+ .removeAttr( 'selected' )
+ .trigger( 'liszt:updated' );
+
+ $( '#core-selector .chzn-container > a' )
+ .addClass( 'chzn-default' );
+ }
+ else
+ {
+ active_element
+ .attr( 'selected', 'selected' )
+ .trigger( 'liszt:updated' );
+
+ if( !this.params.splat[1] )
{
- this.active_core = active_element;
+ this.params.splat[1] = 'overview';
}
+
+ $( '#core-menu .' + this.params.splat[1] )
+ .addClass( 'active' );
+
+ this.active_core = active_element;
}
}
);
@@ -143,9 +167,10 @@ var solr_admin = function( app_config )
plugin_data = null,
- this.menu_element = $( '#menu-selector' );
- this.config = config;
+ this.menu_element = $( '#core-selector select' );
+ this.core_menu = $( '#core-menu ul' );
+ this.config = config;
this.timeout = null;
this.core_regex_base = '^#\\/([\\w\\d-\\.]+)';
@@ -197,6 +222,9 @@ var solr_admin = function( app_config )
that.menu_element
.empty();
+ var core_list = [];
+ core_list.push( '<option></option>' );
+
var core_count = 0;
for( var core_name in that.cores_data )
{
@@ -214,32 +242,24 @@ var solr_admin = function( app_config )
classes.push( 'default' );
}
- var core_tpl = '<li id="' + core_name.replace( /\./g, '__' ) + '" '
+ var core_tpl = '<option '
+ + ' id="' + core_name.replace( /\./g, '__' ) + '" '
+ ' class="' + classes.join( ' ' ) + '"'
+ ' data-basepath="' + core_path + '"'
+ ' schema="' + cores.status[core_name]['schema'] + '"'
+ ' config="' + cores.status[core_name]['config'] + '"'
- + '>' + "\n"
- + ' <p><a href="#/' + core_name + '" title="' + core_name + '">' + core_name + '</a></p>' + "\n"
- + ' <ul>' + "\n"
-
- + ' <li class="ping"><a rel="' + core_path + '/admin/ping"><span>Ping</span></a></li>' + "\n"
- + ' <li class="query"><a href="#/' + core_name + '/query"><span>Query</span></a></li>' + "\n"
- + ' <li class="schema"><a href="#/' + core_name + '/schema"><span>Schema</span></a></li>' + "\n"
- + ' <li class="config"><a href="#/' + core_name + '/config"><span>Config</span></a></li>' + "\n"
- + ' <li class="replication"><a href="#/' + core_name + '/replication"><span>Replication</span></a></li>' + "\n"
- + ' <li class="analysis"><a href="#/' + core_name + '/analysis"><span>Analysis</span></a></li>' + "\n"
- + ' <li class="schema-browser"><a href="#/' + core_name + '/schema-browser"><span>Schema Browser</span></a></li>' + "\n"
- + ' <li class="plugins"><a href="#/' + core_name + '/plugins"><span>Plugins / Stats</span></a></li>' + "\n"
- + ' <li class="dataimport"><a href="#/' + core_name + '/dataimport"><span>Dataimport</span></a></li>' + "\n"
-
- + ' </ul>' + "\n"
- + '</li>';
+ + ' value="#/' + core_name + '"'
+ + ' title="' + core_name + '"'
+ + '>'
+ + core_name
+ + '</option>';
- that.menu_element
- .append( core_tpl );
+ core_list.push( core_tpl );
}
+ that.menu_element
+ .append( core_list.join( "\n" ) );
+
if( cores.initFailures )
{
var failures = [];
@@ -277,7 +297,7 @@ var solr_admin = function( app_config )
$.ajax
(
{
- url : config.solr_path + config.core_admin_path + '?wt=json',
+ url : config.solr_path + config.core_admin_path + '?wt=json&indexInfo=false',
dataType : 'json',
beforeSend : function( arr, form, options )
{
@@ -288,6 +308,52 @@ var solr_admin = function( app_config )
{
that.set_cores_data( response );
+ that.menu_element
+ .chosen()
+ .off( 'change' )
+ .on
+ (
+ 'change',
+ function( event )
+ {
+ location.href = $( 'option:selected', this ).val();
+ return false;
+ }
+ )
+ .on
+ (
+ 'liszt:updated',
+ function( event )
+ {
+ var core_name = $( 'option:selected', this ).text();
+
+ if( core_name )
+ {
+ that.core_menu
+ .html
+ (
+ '<li class="overview"><a href="#/' + core_name + '"><span>Overview</span></a></li>' + "\n" +
+ '<li class="ping"><a rel="' + that.config.solr_path + '/' + core_name + '/admin/ping"><span>Ping</span></a></li>' + "\n" +
+ '<li class="query"><a href="#/' + core_name + '/query"><span>Query</span></a></li>' + "\n" +
+ '<li class="schema"><a href="#/' + core_name + '/schema"><span>Schema</span></a></li>' + "\n" +
+ '<li class="config"><a href="#/' + core_name + '/config"><span>Config</span></a></li>' + "\n" +
+ '<li class="replication"><a href="#/' + core_name + '/replication"><span>Replication</span></a></li>' + "\n" +
+ '<li class="analysis"><a href="#/' + core_name + '/analysis"><span>Analysis</span></a></li>' + "\n" +
+ '<li class="schema-browser"><a href="#/' + core_name + '/schema-browser"><span>Schema Browser</span></a></li>' + "\n" +
+ '<li class="plugins"><a href="#/' + core_name + '/plugins"><span>Plugins / Stats</span></a></li>' + "\n" +
+ '<li class="dataimport"><a href="#/' + core_name + '/dataimport"><span>Dataimport</span></a></li>' + "\n"
+ )
+ .show();
+ }
+ else
+ {
+ that.core_menu
+ .hide()
+ .empty();
+ }
+ }
+ );
+
for( var core_name in response.status )
{
var core_path = config.solr_path + '/' + core_name;
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/cores.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/cores.js?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/cores.js (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/cores.js Tue Jan 29 16:44:16 2013
@@ -20,12 +20,6 @@ sammy.bind
'cores_load_data',
function( event, params )
{
- if( app.cores_data )
- {
- params.callback( app.cores_data );
- return true;
- }
-
$.ajax
(
{
@@ -335,7 +329,7 @@ sammy.get
.ajaxForm
(
{
- url : app.config.solr_path + app.config.core_admin_path + '?wt=json',
+ url : app.config.solr_path + app.config.core_admin_path + '?wt=json&indexInfo=false',
dataType : 'json',
beforeSubmit : function( array, form, options )
{
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/index.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/index.js?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/index.js (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/index.js Tue Jan 29 16:44:16 2013
@@ -208,9 +208,6 @@ sammy.get
{
var content_element = $( '#content' );
- $( '#menu-wrapper #index' )
- .addClass( 'active' );
-
content_element
.html( '<div id="index"></div>' );
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/java-properties.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/java-properties.js?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/java-properties.js (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/java-properties.js Tue Jan 29 16:44:16 2013
@@ -21,7 +21,7 @@ sammy.get
/^#\/(~java-properties)$/,
function( context )
{
- var core_basepath = $( 'li[data-basepath]', app.menu_element ).attr( 'data-basepath' );
+ var core_basepath = $( '[data-basepath]', app.menu_element ).attr( 'data-basepath' );
var content_element = $( '#content' );
content_element
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/logging.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/logging.js?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/logging.js (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/logging.js Tue Jan 29 16:44:16 2013
@@ -406,7 +406,7 @@ sammy.get
/^#\/(~logging)$/,
function( context )
{
- var core_basepath = $( 'li[data-basepath]', app.menu_element ).attr( 'data-basepath' );
+ var core_basepath = $( '[data-basepath]', app.menu_element ).attr( 'data-basepath' );
loglevel_path = core_basepath + '/admin/logging';
var content_element = $( '#content' );
@@ -492,7 +492,7 @@ sammy.get
/^#\/(~logging)\/level$/,
function( context )
{
- var core_basepath = $( 'li[data-basepath]', app.menu_element ).attr( 'data-basepath' );
+ var core_basepath = $( '[data-basepath]', app.menu_element ).attr( 'data-basepath' );
loglevel_path = core_basepath + '/admin/logging';
var content_element = $( '#content' );
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/ping.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/ping.js?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/ping.js (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/ping.js Tue Jan 29 16:44:16 2013
@@ -15,7 +15,7 @@
limitations under the License.
*/
-$( '.ping a', app.menu_element )
+$( '.ping a', app.core_menu )
.live
(
'click',
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/schema-browser.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/schema-browser.js?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/schema-browser.js (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/schema-browser.js Tue Jan 29 16:44:16 2013
@@ -228,7 +228,7 @@ sammy.bind
var related_select_element = $( '#related select', params.schema_browser_element )
var type = 'index';
- var sammy_basepath = '#/' + $( 'p a', params.active_core ).html() + '/schema-browser';
+ var sammy_basepath = app.core_menu.find( '.active a' ).attr( 'href' );
if( !related_navigation_meta.hasClass( 'done' ) )
{
@@ -640,7 +640,7 @@ sammy.bind
}
related_select_element
- .attr( 'rel', '#/' + $( 'p a', params.active_core ).html() + '/schema-browser' )
+ .attr( 'rel', app.core_menu.find( '.active a' ).attr( 'href' ) )
.append( related_options )
.chosen();
Modified: lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/threads.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/threads.js?rev=1439991&r1=1439990&r2=1439991&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/threads.js (original)
+++ lucene/dev/branches/lucene4547/solr/webapp/web/js/scripts/threads.js Tue Jan 29 16:44:16 2013
@@ -21,7 +21,7 @@ sammy.get
/^#\/(~threads)$/,
function( context )
{
- var core_basepath = $( 'li[data-basepath]', app.menu_element ).attr( 'data-basepath' );
+ var core_basepath = $( '[data-basepath]', app.menu_element ).attr( 'data-basepath' );
var content_element = $( '#content' );
$.get