From 4fffe1d26f2b9f74193bdc5749b98e78d58b5d72 Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Thu, 9 May 2013 19:05:21 -0700 Subject: [PATCH] CSPACE-6000: Allow adding one or more asterisks as wildcard characters anywhere in the middle of a partial term matching search expression. --- .../xmlreplay/authority/authority.xml | 159 ++++++++++++++---- .../xmlreplay/authority/locationitem.xml | 7 +- .../xmlreplay/authority/personitem.xml | 9 +- .../authority/res/locationItems.res.xml | 4 +- ...s.xml => locationItemsWithShortID.res.xml} | 2 +- .../authority/res/personItems.res.xml | 4 +- .../test-data/xmlreplay/xml-replay-master.xml | 1 + .../client/java/RepositoryJavaClientImpl.java | 51 +++++- 8 files changed, 188 insertions(+), 49 deletions(-) rename services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/{locationItemsContainingWord1.res.xml => locationItemsWithShortID.res.xml} (72%) diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/authority.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/authority.xml index 63dbbb1ac..eef0603a6 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/authority.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/authority.xml @@ -12,7 +12,7 @@ Create three new vocabularies: two in the Person Authority, and one in the Storage Location Authority. - --> + --> 201 POST @@ -23,13 +23,16 @@ jlmbsoq tqbfjotld + mepqcgjt + fqgtmjb + brvffaqj jlmb tqbf fjotl - ${word1}auth1 - ${word1}auth2 + jlmbsoqauth1 + jlmbsoqauth2 @@ -65,7 +68,8 @@ ${createPersonAuthority1.word2} ${createPersonAuthority1.word1} ${createPersonAuthority1.word1}item1 - + A bio note for this Person. + 201 @@ -90,8 +94,8 @@ - - + + 201 POST /cspace-services/locationauthorities/${createLocationAuthority.CSID}/items @@ -101,29 +105,73 @@ ${createPersonAuthority1.word1}item1 - + 200 GET - /cspace-services/locationauthorities/${createLocationAuthority.CSID}/items/${createLocationItem.CSID} + /cspace-services/locationauthorities/${createLocationAuthority.CSID}/items/${createLocationItem1.CSID} + + + 201 + POST + /cspace-services/locationauthorities/${createLocationAuthority.CSID}/items + authority/locationitem.xml + + ${createPersonAuthority1.word3} ${createPersonAuthority1.word4} ${createPersonAuthority1.word5} + ${createPersonAuthority1.word3}item2 + + + + 200 + GET + /cspace-services/locationauthorities/${createLocationAuthority.CSID}/items/${createLocationItem2.CSID} - + 200 GET /cspace-services/personauthorities/_ALL_/items?pgSz=3&pgNum=0 authority/res/personItems.res.xml + + 3 + + + + + 200 + GET + /cspace-services/personauthorities/${createPersonAuthority1.CSID}/items?pgSz=2&pgNum=0 + + + authority/res/personItems.res.xml + + 2 + + + + + 200 + GET + /cspace-services/personauthorities/${createPersonAuthority1.CSID}/items?pgSz=1&pgNum=0 + + + authority/res/personItems.res.xml + + 1 + + + @@ -179,14 +227,14 @@ authority/res/personItemsContainingWord2.res.xml - - + + 200 GET - /cspace-services/personauthorities/_ALL_/items?as=persons_common%3AdisplayName%20ILIKE%20%27%25${createPersonAuthority1.word1}%25%27 + /cspace-services/personauthorities/_ALL_/items?as=persons_common%3ApersonTermGroupList%2F*%2FtermDisplayName%20ILIKE%20%27%25${createPersonAuthority1.word1}%25%27 authority/res/personItemsContainingWord1.res.xml @@ -196,68 +244,109 @@ 200 GET - /cspace-services/personauthorities/_ALL_/items?as=persons_common%3AdisplayName%20ILIKE%20%27%25${createPersonAuthority1.word2}%25%27 + /cspace-services/personauthorities/_ALL_/items?as=persons_common%3ApersonTermGroupList%2F*%2FtermDisplayName%20ILIKE%20%27%25${createPersonAuthority1.word2}%25%27 authority/res/personItemsContainingWord2.res.xml - - + + + + 200 GET - /cspace-services/personauthorities/_ALL_/items?as=persons_common%3AforeName%20ILIKE%20%27%25${createPersonAuthority1.word2}%25%27 + /cspace-services/locationauthorities/_ALL_/items?pgSz=2&pgNum=0 - authority/res/personItemsContainingWord2.res.xml + authority/res/locationItems.res.xml + + 2 + - - - - + 200 GET - /cspace-services/locationauthorities/_ALL_/items?pgSz=1&pgNum=0 + /cspace-services/locationauthorities/${createLocationAuthority.CSID}/items?pgSz=2&pgNum=0 authority/res/locationItems.res.xml + + 2 + + + + + 200 GET - /cspace-services/locationauthorities/_ALL_/items?kw=${createPersonAuthority1.word1} + /cspace-services/locationauthorities/${createLocationAuthority.CSID}/items?kw=${createPersonAuthority1.word1} - authority/res/locationItemsContainingWord1.res.xml + authority/res/locationItemsWithShortID.res.xml + + ${createLocationItem1.itemShortIdentifier} + + + + + 200 GET - /cspace-services/locationauthorities/_ALL_/items?pt=${createPersonAuthority1.word1PartialTermStem} + /cspace-services/locationauthorities/${createLocationAuthority.CSID}/items?pt=${createPersonAuthority1.word1PartialTermStem} + + + authority/res/locationItemsWithShortID.res.xml + + ${createLocationItem1.itemShortIdentifier} + + + + + + 200 + GET + /cspace-services/locationauthorities/_ALL_/items?pt=${createPersonAuthority1.word3}*${createPersonAuthority1.word5} - authority/res/locationItemsContainingWord1.res.xml + authority/res/locationItemsWithShortID.res.xml + + ${createLocationItem2.itemShortIdentifier} + - + + + + 200 GET - /cspace-services/locationauthorities/_ALL_/items?as=locations_common%3AdisplayName%20ILIKE%20%27%25${createPersonAuthority1.word1}%25%27 + /cspace-services/locationauthorities/${createLocationAuthority.CSID}/items?as=locations_common%3AlocTermGroupList%2F*%2FtermDisplayName%20ILIKE%20%27%25${createPersonAuthority1.word1}%25%27 - authority/res/locationItemsContainingWord1.res.xml + authority/res/locationItemsWithShortID.res.xml + + ${createLocationItem1.itemShortIdentifier} + - - + + 200 GET - /cspace-services/locationauthorities/_ALL_/items?as=locations_common%3AaccessNote%20ILIKE%20%27%25${createPersonAuthority1.word1}%25%27 + /cspace-services/locationauthorities/${createLocationAuthority.CSID}/items?as=locations_common%3AaccessNote%20ILIKE%20%27%25${createPersonAuthority1.word1}%25%27 - authority/res/locationItemsContainingWord1.res.xml + authority/res/locationItemsWithShortID.res.xml + + ${createLocationItem1.itemShortIdentifier} + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/locationitem.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/locationitem.xml index 56e370a69..cc88aa9f8 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/locationitem.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/locationitem.xml @@ -1,8 +1,11 @@ - ${itemDisplayName} - false + + + ${itemDisplayName} + + ${itemShortIdentifier} This is a test Location Authority item, whose access note contains: ${itemDisplayName} diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/personitem.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/personitem.xml index 87f820af0..8204bb32f 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/personitem.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/personitem.xml @@ -1,10 +1,13 @@ - ${itemDisplayName} - false + + + ${itemDisplayName} + + ${itemShortIdentifier} - A bio note for this Person. + ${itemBioNote} ${itemDisplayName} diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationItems.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationItems.res.xml index 245990926..15cd5c253 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationItems.res.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationItems.res.xml @@ -1,7 +1,7 @@ 0 - 1 - 1 + ${numItems} + ${numItems} diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationItemsContainingWord1.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationItemsWithShortID.res.xml similarity index 72% rename from services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationItemsContainingWord1.res.xml rename to services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationItemsWithShortID.res.xml index f297cecef..ddeb00653 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationItemsContainingWord1.res.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/locationItemsWithShortID.res.xml @@ -2,7 +2,7 @@ 1 - ${createPersonAuthority1.word1}item1 + ${itemShortIdentifier} diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personItems.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personItems.res.xml index 61a80fda2..15cd5c253 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personItems.res.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personItems.res.xml @@ -1,7 +1,7 @@ 0 - 3 - 3 + ${numItems} + ${numItems} diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml index a12b24afb..fa1ee99d0 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml @@ -35,6 +35,7 @@ + diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java index 7298eff3c..9c88719e5 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java @@ -111,6 +111,8 @@ public class RepositoryJavaClientImpl implements RepositoryClient queryParams = ctx.getQueryParams(); + // Value for replaceable parameter 1 in the query String partialTerm = queryParams.getFirst(IQueryManager.SEARCH_TYPE_PARTIALTERM); // If the value of the partial term query parameter is blank ('pt='), // return all records, subject to restriction by any limit clause @@ -1030,8 +1033,18 @@ public class RepositoryJavaClientImpl implements RepositoryClient