Skip to content
Snippets Groups Projects
Commit 98cb6157 authored by felmer's avatar felmer
Browse files

SSDM-2600: improving LuceneQueryBuilder, adding a second project sample to the test database

SVN: 35008
parent f0a422e1
No related branches found
No related tags found
No related merge requests found
......@@ -200,7 +200,8 @@ public class LuceneQueryBuilder
{
BooleanQuery resultQuery = new BooleanQuery();
boolean mustNotOcuured = false;
boolean mustNotOccured = false;
boolean shouldOccured = false;
for (int i = 0; i < fieldNames.size(); i++)
{
String fieldName = fieldNames.get(i);
......@@ -211,11 +212,14 @@ public class LuceneQueryBuilder
Occur occur = occurs.get(i);
if (Occur.MUST_NOT.equals(occur))
{
mustNotOcuured = true;
mustNotOccured = true;
} else if (Occur.SHOULD.equals(occur))
{
shouldOccured = true;
}
resultQuery.add(query, occur);
}
if (mustNotOcuured)
if (mustNotOccured && shouldOccured == false)
{
resultQuery.add(new BooleanClause(new MatchAllDocsQuery(), Occur.SHOULD));
}
......
......@@ -327,7 +327,7 @@ public class ProjectSampleTest extends AbstractTest
}
@Test
public void testSearchForSamplesWithProject()
public void testSearchForSamplesWithProject() throws InterruptedException
{
SampleSearchCriteria searchCriteria = new SampleSearchCriteria();
searchCriteria.withProject();
......@@ -338,7 +338,9 @@ public class ProjectSampleTest extends AbstractTest
assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/CISD/3VCP5");
assertEquals(result.getObjects().get(0).getProject().getIdentifier().getIdentifier(), "/CISD/NEMO");
assertEquals(result.getTotalCount(), 1);
assertEquals(result.getObjects().get(1).getIdentifier().getIdentifier(), "/TEST-SPACE/FV-TEST");
assertEquals(result.getObjects().get(1).getProject().getIdentifier().getIdentifier(), "/TEST-SPACE/TEST-PROJECT");
assertEquals(result.getTotalCount(), 2);
}
@Test
......@@ -376,7 +378,7 @@ public class ProjectSampleTest extends AbstractTest
public void testSearchForSamplesWithProjectWithPermId()
{
SampleSearchCriteria searchCriteria = new SampleSearchCriteria();
searchCriteria.withProject().withPermId().thatContains("1738");
searchCriteria.withProject().withPermId().thatContains("1738-103");
SampleFetchOptions fetchOptions = new SampleFetchOptions();
fetchOptions.withProject();
......
......@@ -968,7 +968,7 @@
976 A02 6 2008-11-05 09:21:44.03+01 2 \N 1 974 2009-03-18 10:50:19.475958+01 \N 200811050944030-975 \N A02,974,1 \N 0 \N \N
980 3V-126 2 2008-11-05 09:21:45.092+01 2 \N 1 \N 2009-03-18 10:50:19.475958+01 \N 200811050945092-977 \N 3V-126,-1,1 \N 0 \N \N
981 DP 2 2008-11-05 09:21:45.092+01 2 \N \N \N 2009-03-18 10:50:19.475958+01 \N 200811050945092-978 \N DP,-1,-1 \N 0 \N \N
986 3VCP5 3 2008-11-05 09:21:46.559+01 2 \N 1 \N 2009-03-18 10:50:19.475958+01 3 200811050946559-979 \N 3VCP5,-1,1 \N 0 \N \N
986 3VCP5 3 2008-11-05 09:21:46.559+01 2 \N 1 \N 2009-03-18 10:50:19.475958+01 3 200811050946559-979 \N 3VCP5,-1,1 \N 0 \N 3
987 3VCP6 3 2008-11-05 09:21:46.559+01 2 \N 1 \N 2009-03-18 10:50:19.475958+01 4 200811050946559-980 \N 3VCP6,-1,1 \N 0 \N \N
989 3VCP8 3 2008-11-05 09:21:46.559+01 2 \N 1 \N 2009-03-18 10:50:19.475958+01 \N 200811050946559-982 \N 3VCP8,-1,1 \N 0 \N \N
982 3VCP1 3 2008-11-05 09:21:46.559+01 2 1 1 \N 2009-03-18 10:50:19.475958+01 2 200811050946559-983 \N 3VCP1,-1,1 \N 0 \N \N
......@@ -1022,7 +1022,7 @@
1051 WELL-A01 6 2009-02-09 12:09:50.077973+01 2 \N 1 1050 2009-08-18 17:54:36.929+02 21 200902091250077-1051 \N WELL-A01,1050,1 \N 0 \N \N
1052 WELL-A02 6 2009-02-09 12:09:50.077973+01 2 \N 1 1050 2009-08-18 17:54:36.929+02 21 200902091250077-1052 \N WELL-A02,1050,1 \N 0 \N \N
1053 DYNA-TEST-1 7 2009-02-09 12:09:19.327518+01 2 \N 1 \N 2009-08-18 17:54:11.56+02 18 200902091219327-1053 \N DYNA-TEST-1,-1,1 \N 0 \N \N
1054 FV-TEST 3 2009-02-09 12:09:19.327518+01 2 \N 3 \N 2009-08-18 17:54:11.56+02 23 201206191219327-1054 6 FV-TEST,-1,3 \N 0 \N \N
1054 FV-TEST 3 2009-02-09 12:09:19.327518+01 2 \N 3 \N 2009-08-18 17:54:11.56+02 23 201206191219327-1054 6 FV-TEST,-1,3 \N 0 \N 5
1055 EV-TEST 10 2009-02-09 12:09:19.327518+01 2 \N 3 \N 2009-08-18 17:54:11.56+02 23 201206191219327-1055 \N EV-TEST,-1,3 \N 0 \N \N
1056 EV-INVALID 9 2009-02-09 12:09:19.327518+01 2 \N 3 \N 2009-08-18 17:54:11.56+02 23 201206191219327-1056 \N EV-INVALID,-1,3 \N 0 \N \N
1057 EV-NOT_INVALID 6 2009-02-09 12:09:19.327518+01 2 \N 3 \N 2009-08-18 17:54:11.56+02 23 201206191219327-1057 \N EV-NOT_INVALID,-1,3 \N 0 \N \N
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment