How to use the @alfresco/js-api.SearchApi function in @alfresco/js-api

To help you get started, we’ve selected a few @alfresco/js-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Alfresco / alfresco-content-app / e2e / utilities / repo-client / apis / search / search-api.ts View on Github external
*
 * The Alfresco Example Content Application is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Alfresco. If not, see .
 */

import { RepoApi } from '../repo-api';
import { Utils } from '../../../../utilities/utils';
import { SearchApi as AdfSearchApi } from '@alfresco/js-api';

export class SearchApi extends RepoApi {
    searchApi = new AdfSearchApi(this.alfrescoJsApi);

    constructor(username?, password?) {
        super(username, password);
    }

    async queryRecentFiles(username: string) {
        const data = {
            query: {
                query: '*',
                language: 'afts'
            },
            filterQueries: [
                { query: `cm:modified:[NOW/DAY-30DAYS TO NOW/DAY+1DAY]` },
                { query: `cm:modifier:${username} OR cm:creator:${username}` },
                { query: `TYPE:"content" AND -TYPE:"app:filelink" AND -TYPE:"fm:post"` }
            ]