Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use rerank query in conjunction with LSH URP #4

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
fix sparse indexes
  • Loading branch information
moshebla committed Sep 25, 2018
commit 42f0132015cdbdc31cd2a4848a6d1872ce4caec1
2 changes: 1 addition & 1 deletion src/java/com/github/saaay71/solr/VectorPayloadEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public BytesRef encode(char[] buffer, int offset, int length) {
final boolean isSparse = i < offset + length;
final float vectorElem;
if(isSparse) {
final int sparseIndex = Integer.parseInt(CharBuffer.wrap(buffer, offset, i - offset).toString()) - 1;
final int sparseIndex = Integer.parseInt(CharBuffer.wrap(buffer, offset, i - offset).toString());
PayloadHelper.encodeInt(sparseIndex, bytes, 0);
vectorElem = Float.parseFloat(CharBuffer.wrap(buffer, offset + i, offset + length - (i + 1)).toString());
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/test/com/github/saaay71/solr/VectorQueryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public class VectorQueryTest extends SolrTestCaseJ4 {

private static AtomicInteger idCounter = new AtomicInteger();
private static String[] vectors = {
"|1,1.55 |2,3.53 |3,2.3 |4,0.7 |5,3.44 |6,2.33",
"|1,3.54 |2,0.4 |3,4.16 |4,4.88 |5,4.28 |6,4.25"
"|0,1.55 |1,3.53 |2,2.3 |3,0.7 |4,3.44 |5,2.33",
"|0,3.54 |1,0.4 |2,4.16 |3,4.88 |4,4.28 |5,4.25"
};
private static String[] denseVectors = {
"|1.55 |3.53 |2.3 |0.7 |3.44 |2.33",
Expand Down