mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Revert "REPO-1154: Using spaces for term-based queries - nodes"
This reverts commit edc89bb65e
.
This commit is contained in:
@@ -188,12 +188,7 @@ public class QueriesImpl implements Queries, InitializingBean
|
||||
NodeRef nodeRef = nodes.validateOrLookupNode(rootNodeId, null);
|
||||
query.append("PATH:\"").append(getQNamePath(nodeRef.getId())).append("//*\" AND (");
|
||||
}
|
||||
if (term != null)
|
||||
{
|
||||
query.append("\"");
|
||||
query.append(term);
|
||||
query.append("\"");
|
||||
}
|
||||
query.append(term);
|
||||
if (rootNodeId != null)
|
||||
{
|
||||
query.append(")");
|
||||
|
@@ -132,55 +132,6 @@ public class QueriesNodesApiTest extends AbstractSingleNetworkSiteTest
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test basic api for nodes using parameter term with white-spaces.(REPO-1154)
|
||||
*
|
||||
* <p>
|
||||
* GET:
|
||||
* </p>
|
||||
* {@literal <host>:<port>/alfresco/api/<networkId>/public/alfresco/versions/1/queries/nodes}
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testSearchTermWhiteSpace() throws Exception
|
||||
{
|
||||
setRequestContext(user1);
|
||||
|
||||
String myFolderNodeId = getMyNodeId();
|
||||
|
||||
String parentFolder = createFolder(myFolderNodeId, "folder term1").getId();
|
||||
//I use "find123" and "find123 find", the search using second term must return less result
|
||||
//The space must not break the query
|
||||
String childTerm = "find" + Math.random();
|
||||
String childTermWS = childTerm + " " + "find";
|
||||
|
||||
Map<String, String> docProps = new HashMap<>(2);
|
||||
docProps.put("cm:title", childTerm);
|
||||
docProps.put("cm:description", childTerm);
|
||||
createTextFile(parentFolder, childTerm, childTerm, "UTF-8", docProps);
|
||||
|
||||
docProps.put("cm:title", childTermWS);
|
||||
docProps.put("cm:description", childTermWS);
|
||||
createTextFile(parentFolder, childTermWS, childTermWS, "UTF-8", docProps);
|
||||
|
||||
Paging paging = getPaging(0, 100);
|
||||
HashMap<String, String> params = new HashMap<>(1);
|
||||
params.put(Queries.PARAM_TERM, childTerm);
|
||||
HttpResponse response = getAll(URL_QUERIES_LSN, paging, params, 200);
|
||||
List<Node> nodesChildTerm = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Node.class);
|
||||
//check if the search returns all nodes which contain that query term
|
||||
assertEquals(2, nodesChildTerm.size());
|
||||
|
||||
params.put(Queries.PARAM_TERM, childTermWS);
|
||||
response = getAll(URL_QUERIES_LSN, paging, params, 200);
|
||||
List<Node> nodesChildTermWS = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Node.class);
|
||||
//check if search works for words with space and the space don't break the query
|
||||
assertEquals(1, nodesChildTermWS.size());
|
||||
assertTrue(nodesChildTerm.size() >= nodesChildTermWS.size());
|
||||
|
||||
}
|
||||
|
||||
private List<Node> checkApiCall(String pathRegex, String queryForm, String term, String nodeType, String rootNodeId,
|
||||
String include, String orderBy, Paging paging, int expectedStatus,
|
||||
|
Reference in New Issue
Block a user