mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
REPO-1154: added trem as text in lucene search
This commit is contained in:
@@ -189,7 +189,12 @@ public class QueriesImpl implements Queries, InitializingBean
|
|||||||
NodeRef nodeRef = nodes.validateOrLookupNode(rootNodeId, null);
|
NodeRef nodeRef = nodes.validateOrLookupNode(rootNodeId, null);
|
||||||
query.append("PATH:\"").append(getQNamePath(nodeRef.getId())).append("//*\" AND (");
|
query.append("PATH:\"").append(getQNamePath(nodeRef.getId())).append("//*\" AND (");
|
||||||
}
|
}
|
||||||
query.append(term);
|
if (term != null)
|
||||||
|
{
|
||||||
|
query.append("\"");
|
||||||
|
query.append(term);
|
||||||
|
query.append("\"");
|
||||||
|
}
|
||||||
if (rootNodeId != null)
|
if (rootNodeId != null)
|
||||||
{
|
{
|
||||||
query.append(")");
|
query.append(")");
|
||||||
|
@@ -86,6 +86,40 @@ public class QueriesNodesApiTest extends AbstractSingleNetworkSiteTest
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchTermWhiteSpace() throws Exception{
|
||||||
|
setRequestContext(user1);
|
||||||
|
|
||||||
|
String myFolderNodeId = getMyNodeId();
|
||||||
|
|
||||||
|
String parentTerm = createFolder(myFolderNodeId, "folder term1").getId();
|
||||||
|
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(parentTerm, childTerm, childTerm, "UTF-8", docProps);
|
||||||
|
|
||||||
|
docProps.put("cm:title", childTermWS);
|
||||||
|
docProps.put("cm:description", childTermWS);
|
||||||
|
createTextFile(parentTerm, 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> nodes = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Node.class);
|
||||||
|
assertEquals(2, nodes.size());
|
||||||
|
|
||||||
|
params.put(Queries.PARAM_TERM, childTermWS);
|
||||||
|
response = getAll(URL_QUERIES_LSN, paging, params, 200);
|
||||||
|
nodes = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Node.class);
|
||||||
|
assertEquals(1, nodes.size());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests basic api for nodes live search - metadata (name, title, description) &/or full text search of file/content
|
* Tests basic api for nodes live search - metadata (name, title, description) &/or full text search of file/content
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user