Search in sources :

Example 51 with SearchParameters

use of org.alfresco.service.cmr.search.SearchParameters in project alfresco-repository by Alfresco.

the class VirtualQueryImpl method createSearchParameters.

private SearchParameters createSearchParameters(boolean files, boolean folders, PagingRequest pagingRequest) throws VirtualizationException {
    SearchParameters searchParameters = new SearchParameters();
    if (store != null) {
        searchParameters.addStore(new StoreRef(store));
    } else {
        searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
    }
    searchParameters.setLanguage(language);
    searchParameters.setQuery(filter(language, query, files, folders));
    searchParameters.setQueryConsistency(QueryConsistency.TRANSACTIONAL_IF_POSSIBLE);
    if (pagingRequest != null) {
        searchParameters.setSkipCount(pagingRequest.getSkipCount());
        searchParameters.setMaxItems(pagingRequest.getMaxItems());
    }
    return searchParameters;
}
Also used : SearchParameters(org.alfresco.service.cmr.search.SearchParameters) StoreRef(org.alfresco.service.cmr.repository.StoreRef)

Example 52 with SearchParameters

use of org.alfresco.service.cmr.search.SearchParameters in project alfresco-repository by Alfresco.

the class FilesFoldersConstraint method applyDecorations.

@Override
protected SearchParameters applyDecorations(ActualEnvironment environment, SearchParameters searchParameters, VirtualQuery query) {
    String queryString = searchParameters.getQuery();
    String language = searchParameters.getLanguage();
    String filteredQuery = filter(language, queryString, files, folders);
    SearchParameters searchParametersCopy = searchParameters.copy();
    searchParametersCopy.setQuery(filteredQuery);
    return searchParametersCopy;
}
Also used : SearchParameters(org.alfresco.service.cmr.search.SearchParameters)

Example 53 with SearchParameters

use of org.alfresco.service.cmr.search.SearchParameters in project alfresco-repository by Alfresco.

the class PagingRequestConstraint method applyDecorations.

@Override
protected SearchParameters applyDecorations(ActualEnvironment environment, SearchParameters searchParameters, VirtualQuery query) {
    SearchParameters searchParametersCopy = searchParameters.copy();
    if (pagingRequest != null) {
        searchParametersCopy.setSkipCount(pagingRequest.getSkipCount());
        searchParametersCopy.setMaxItems(pagingRequest.getMaxItems());
    }
    return searchParametersCopy;
}
Also used : SearchParameters(org.alfresco.service.cmr.search.SearchParameters)

Example 54 with SearchParameters

use of org.alfresco.service.cmr.search.SearchParameters in project alfresco-repository by Alfresco.

the class SortConstraint method applyDecorations.

@Override
protected SearchParameters applyDecorations(ActualEnvironment environment, SearchParameters searchParameters, VirtualQuery query) {
    SearchParameters searchParametersCopy = searchParameters.copy();
    for (Pair<QName, Boolean> sort : sortProps) {
        if (!IGNORED_SORT_PROPERTIES.contains(sort.getFirst())) {
            SortDefinition sortDefinition = new SortDefinition(SortType.FIELD, sort.getFirst().getPrefixString(), sort.getSecond());
            searchParametersCopy.addSort(sortDefinition);
        }
    }
    return searchParametersCopy;
}
Also used : SearchParameters(org.alfresco.service.cmr.search.SearchParameters) QName(org.alfresco.service.namespace.QName) SortDefinition(org.alfresco.service.cmr.search.SearchParameters.SortDefinition)

Example 55 with SearchParameters

use of org.alfresco.service.cmr.search.SearchParameters in project alfresco-repository by Alfresco.

the class PropertyValueConstraint method applyFTS.

protected SearchParameters applyFTS(SearchParameters searchParameters) {
    SearchParameters constrainedParameters = searchParameters.copy();
    String theQuery = constrainedParameters.getQuery();
    // TODO: introduce and use operator
    theQuery = "(" + theQuery + ")" + " and " + "( " + "=" + property.toPrefixString(this.nspResolver) + ":" + "\"" + value.toString() + "\" )";
    constrainedParameters.setQuery(theQuery);
    return constrainedParameters;
}
Also used : SearchParameters(org.alfresco.service.cmr.search.SearchParameters)

Aggregations

SearchParameters (org.alfresco.service.cmr.search.SearchParameters)120 ResultSet (org.alfresco.service.cmr.search.ResultSet)51 Test (org.junit.Test)41 NodeRef (org.alfresco.service.cmr.repository.NodeRef)33 ArrayList (java.util.ArrayList)25 StoreRef (org.alfresco.service.cmr.repository.StoreRef)16 IOException (java.io.IOException)15 HashMap (java.util.HashMap)14 QName (org.alfresco.service.namespace.QName)13 List (java.util.List)12 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)12 JSONObject (org.json.JSONObject)12 SearchRequestContext (org.alfresco.rest.api.search.context.SearchRequestContext)11 FieldHighlightParameters (org.alfresco.service.cmr.search.FieldHighlightParameters)11 Set (java.util.Set)10 InvalidArgumentException (org.alfresco.rest.framework.core.exceptions.InvalidArgumentException)10 RangeParameters (org.alfresco.service.cmr.search.RangeParameters)10 JSONArray (org.json.JSONArray)10 JSONTokener (org.json.JSONTokener)10 Locale (java.util.Locale)9