int intersection = 10000;
int del = 5;
int[] ansList1 = new int[qryList.length];
int[] ansList2 = new int[qryList.length];
java.util.Random rand = new java.util.Random(System.currentTimeMillis());
DocIDMapperImpl mapper = null;
for(int k = 0; k < 10; k++)
{
java.util.HashSet<Long> uidset = new java.util.HashSet<Long>();
java.util.HashSet<Long> qryset = new java.util.HashSet<Long>();
long id;
for(int i = 0; i < intersection; i++)
{
do { id = (long)rand.nextInt() + (long)(Integer.MAX_VALUE)*2L; } while(id == ZoieIndexReader.DELETED_UID || uidset.contains(id));
uidset.add(id);
uidList[i] = (i % del) > 0 ? id : ZoieIndexReader.DELETED_UID;
qryList[i] = id;
ansList1[i] = (i % del) > 0 ? i : -1;
}
for(int i = intersection; i < uidList.length; i++)
{
do { id = (long)rand.nextInt() + (long)(Integer.MAX_VALUE)*2L; } while(id == ZoieIndexReader.DELETED_UID || uidset.contains(id));
uidset.add(id);
uidList[i] = (i % del) > 0 ? id : ZoieIndexReader.DELETED_UID;
}
for(int i = intersection; i < qryList.length; i++)
{
do { id = (long)rand.nextInt() + (long)(Integer.MAX_VALUE)*2L; } while(id == ZoieIndexReader.DELETED_UID || uidset.contains(id) || qryset.contains(id));
qryset.add(id);
qryList[i] = id;
ansList1[i] = -1;
}
mapper = new DocIDMapperImpl(uidList);
for(int i = 0; i < qryList.length; i++)
{
ansList2[i] = mapper.getDocID(qryList[i]);
}
assertTrue("wrong result", Arrays.equals(ansList1, ansList2));
DocIDArray result = mapper.getDocIDArray(qryList);
int[] resarr = result.docids;
for(int i = 0; i < qryList.length; i++)
{
assertEquals("wrong result", ansList2[i], resarr[i]);
}