Example usage for com.liferay.portal.kernel.search Field UID

List of usage examples for com.liferay.portal.kernel.search Field UID

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.search Field UID.

Prototype

String UID

To view the source code for com.liferay.portal.kernel.search Field UID.

Click Source Link

Usage

From source file:com.liferay.journal.web.internal.search.JournalSearcher.java

License:Open Source License

public JournalSearcher() {
    setDefaultSelectedFieldNames(Field.ARTICLE_ID, Field.COMPANY_ID, Field.DEFAULT_LANGUAGE_ID,
            Field.ENTRY_CLASS_NAME, Field.ENTRY_CLASS_PK, Field.GROUP_ID, Field.VERSION, Field.UID);
    setDefaultSelectedLocalizedFieldNames(Field.CONTENT, Field.DESCRIPTION, Field.TITLE);
    setFilterSearch(true);//from  w w  w.j a va 2  s. c  o m
    setPermissionAware(true);
    setSelectAllLocales(true);
}

From source file:com.liferay.knowledgebase.admin.util.AdminIndexer.java

License:Open Source License

public AdminIndexer() {
    setDefaultSelectedFieldNames(Field.COMPANY_ID, Field.CONTENT, Field.CREATE_DATE, Field.DESCRIPTION,
            Field.ENTRY_CLASS_NAME, Field.ENTRY_CLASS_PK, Field.MODIFIED_DATE, Field.TITLE, Field.UID,
            Field.USER_NAME);//from  w  w  w  .jav a  2s .c  o m
    setFilterSearch(true);
    setPermissionAware(true);
}

From source file:com.liferay.knowledgebase.admin.util.KBArticleIndexer.java

License:Open Source License

public KBArticleIndexer() {
    setDefaultSelectedFieldNames(Field.COMPANY_ID, Field.CONTENT, Field.CREATE_DATE, Field.DESCRIPTION,
            Field.ENTRY_CLASS_NAME, Field.ENTRY_CLASS_PK, Field.MODIFIED_DATE, Field.TITLE, Field.UID,
            Field.USER_NAME);//from w  w  w .j a v  a 2s  .com
    setFilterSearch(true);
    setPermissionAware(true);
}

From source file:com.liferay.mail.util.AccountIndexer.java

License:Open Source License

@Override
protected void doDelete(Account account) throws Exception {
    SearchContext searchContext = new SearchContext();

    searchContext.setCompanyId(account.getCompanyId());
    searchContext.setEnd(QueryUtil.ALL_POS);
    searchContext.setSearchEngineId(getSearchEngineId());
    searchContext.setSorts(SortFactoryUtil.getDefaultSorts());
    searchContext.setStart(QueryUtil.ALL_POS);

    BooleanQuery booleanQuery = new BooleanQueryImpl();

    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, CLASS_NAME);

    booleanQuery.addRequiredTerm("accountId", account.getAccountId());

    Hits hits = IndexSearcherHelperUtil.search(searchContext, booleanQuery);

    List<String> uids = new ArrayList<>(hits.getLength());

    for (int i = 0; i < hits.getLength(); i++) {
        Document document = hits.doc(i);

        uids.add(document.get(Field.UID));
    }// w  w w .j a  v a  2 s.c  o  m

    IndexWriterHelperUtil.deleteDocuments(getSearchEngineId(), account.getCompanyId(), uids,
            isCommitImmediately());
}

From source file:com.liferay.mail.util.FolderIndexer.java

License:Open Source License

@Override
protected void doDelete(Folder folder) throws Exception {
    SearchContext searchContext = new SearchContext();

    searchContext.setCompanyId(folder.getCompanyId());
    searchContext.setEnd(QueryUtil.ALL_POS);
    searchContext.setSearchEngineId(getSearchEngineId());
    searchContext.setSorts(SortFactoryUtil.getDefaultSorts());
    searchContext.setStart(QueryUtil.ALL_POS);

    BooleanQuery booleanQuery = new BooleanQueryImpl();

    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, CLASS_NAME);

    booleanQuery.addRequiredTerm("folderId", folder.getFolderId());

    Hits hits = IndexSearcherHelperUtil.search(searchContext, booleanQuery);

    List<String> uids = new ArrayList<>(hits.getLength());

    for (int i = 0; i < hits.getLength(); i++) {
        Document document = hits.doc(i);

        uids.add(document.get(Field.UID));
    }//from   ww  w .j a va2s. c  om

    IndexWriterHelperUtil.deleteDocuments(getSearchEngineId(), folder.getCompanyId(), uids,
            isCommitImmediately());
}

From source file:com.liferay.mail.util.MessageIndexer.java

License:Open Source License

@Override
protected void doDelete(Object obj) throws Exception {
    SearchContext searchContext = new SearchContext();

    searchContext.setSearchEngineId(getSearchEngineId());

    if (obj instanceof Account) {
        Account account = (Account) obj;

        searchContext.setCompanyId(account.getCompanyId());
        searchContext.setEnd(QueryUtil.ALL_POS);
        searchContext.setSorts(SortFactoryUtil.getDefaultSorts());
        searchContext.setStart(QueryUtil.ALL_POS);

        BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);

        booleanQuery.addRequiredTerm(Field.PORTLET_ID, PORTLET_ID);

        booleanQuery.addRequiredTerm("accountId", account.getAccountId());

        Hits hits = SearchEngineUtil.search(searchContext, booleanQuery);

        List<String> uids = new ArrayList<String>(hits.getLength());

        for (int i = 0; i < hits.getLength(); i++) {
            Document document = hits.doc(i);

            uids.add(document.get(Field.UID));
        }/*www.  j ava 2s  . c o m*/

        SearchEngineUtil.deleteDocuments(getSearchEngineId(), account.getCompanyId(), uids,
                isCommitImmediately());
    } else if (obj instanceof Folder) {
        Folder folder = (Folder) obj;

        searchContext.setCompanyId(folder.getCompanyId());
        searchContext.setEnd(QueryUtil.ALL_POS);
        searchContext.setSorts(SortFactoryUtil.getDefaultSorts());
        searchContext.setStart(QueryUtil.ALL_POS);

        BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);

        booleanQuery.addRequiredTerm(Field.PORTLET_ID, PORTLET_ID);

        booleanQuery.addRequiredTerm("folderId", folder.getFolderId());

        Hits hits = SearchEngineUtil.search(searchContext, booleanQuery);

        List<String> uids = new ArrayList<String>(hits.getLength());

        for (int i = 0; i < hits.getLength(); i++) {
            Document document = hits.doc(i);

            uids.add(document.get(Field.UID));
        }

        SearchEngineUtil.deleteDocuments(getSearchEngineId(), folder.getCompanyId(), uids,
                isCommitImmediately());
    } else if (obj instanceof Message) {
        Message message = (Message) obj;

        Document document = new DocumentImpl();

        document.addUID(PORTLET_ID, message.getMessageId());

        SearchEngineUtil.deleteDocument(getSearchEngineId(), message.getCompanyId(), document.get(Field.UID),
                isCommitImmediately());
    }
}

From source file:com.liferay.message.boards.internal.search.MBMessageIndexer.java

License:Open Source License

public MBMessageIndexer() {
    setDefaultSelectedFieldNames(Field.ASSET_TAG_NAMES, Field.CLASS_NAME_ID, Field.CLASS_PK, Field.COMPANY_ID,
            Field.CONTENT, Field.ENTRY_CLASS_NAME, Field.ENTRY_CLASS_PK, Field.GROUP_ID, Field.MODIFIED_DATE,
            Field.SCOPE_GROUP_ID, Field.TITLE, Field.UID);
    setFilterSearch(true);/*ww  w. ja v a  2  s.c  o  m*/
    setPermissionAware(true);
}

From source file:com.liferay.message.boards.internal.search.MBThreadIndexer.java

License:Open Source License

public MBThreadIndexer() {
    setDefaultSelectedFieldNames(Field.CLASS_NAME_ID, Field.CLASS_PK, Field.COMPANY_ID, Field.ENTRY_CLASS_NAME,
            Field.ENTRY_CLASS_PK, Field.UID);
    setFilterSearch(true);// www  .  j a v a  2s  . c  om
    setPermissionAware(true);
}

From source file:com.liferay.polls.internal.search.PollsQuestionIndexer.java

License:Open Source License

public PollsQuestionIndexer() {
    setDefaultSelectedFieldNames(Field.ASSET_TAG_NAMES, Field.CREATE_DATE, Field.COMPANY_ID, Field.DESCRIPTION,
            Field.ENTRY_CLASS_NAME, Field.ENTRY_CLASS_PK, Field.GROUP_ID, Field.SCOPE_GROUP_ID, Field.TITLE,
            Field.UID);
    setFilterSearch(true);/*  w  ww.  j a v a  2s .c  o m*/
}

From source file:com.liferay.portlet.documentlibrary.util.DLFileEntryIndexer.java

License:Open Source License

@Override
protected void doDelete(Object obj) throws Exception {
    DLFileEntry dlFileEntry = (DLFileEntry) obj;

    Document document = new DocumentImpl();

    document.addUID(PORTLET_ID, dlFileEntry.getFileEntryId());

    SearchEngineUtil.deleteDocument(getSearchEngineId(), dlFileEntry.getCompanyId(), document.get(Field.UID));
}