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

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

Introduction

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

Prototype

String CLASS_PK

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

Click Source Link

Usage

From source file:com.liferay.portlet.journal.util.JournalArticleIndexer.java

License:Open Source License

@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, SearchContext searchContext) throws Exception {

    addSearchTerm(searchQuery, searchContext, Field.CLASS_PK, false);
    addSearchLocalizedTerm(searchQuery, searchContext, Field.CONTENT, false);
    addSearchLocalizedTerm(searchQuery, searchContext, Field.DESCRIPTION, false);
    addSearchTerm(searchQuery, searchContext, Field.ENTRY_CLASS_PK, false);
    addSearchLocalizedTerm(searchQuery, searchContext, Field.TITLE, false);
    addSearchTerm(searchQuery, searchContext, Field.TYPE, false);
    //        addSearchTerm(searchQuery, searchContext, Field.USER_NAME, false);

    addSearchTerm(searchQuery, searchContext, "articleId", false);

    LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

    if (params != null) {
        String expandoAttributes = (String) params.get("expandoAttributes");

        if (Validator.isNotNull(expandoAttributes)) {
            addSearchExpando(searchQuery, searchContext, expandoAttributes);
        }/*from w ww.ja  v a  2 s  .  c o m*/
    }
}

From source file:com.liferay.portlet.journal.util.JournalIndexer.java

License:Open Source License

@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, SearchContext searchContext) throws Exception {

    addSearchTerm(searchQuery, searchContext, Field.CLASS_PK, false);
    addLocalizedSearchTerm(searchQuery, searchContext, Field.CONTENT, false);
    addLocalizedSearchTerm(searchQuery, searchContext, Field.DESCRIPTION, false);
    addSearchTerm(searchQuery, searchContext, Field.ENTRY_CLASS_PK, false);
    addLocalizedSearchTerm(searchQuery, searchContext, Field.TITLE, false);
    addSearchTerm(searchQuery, searchContext, Field.TYPE, false);
    addSearchTerm(searchQuery, searchContext, Field.USER_NAME, false);

    LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

    if (params != null) {
        String expandoAttributes = (String) params.get("expandoAttributes");

        if (Validator.isNotNull(expandoAttributes)) {
            addSearchExpando(searchQuery, searchContext, expandoAttributes);
        }// www. j a  va2  s. c om
    }
}

From source file:org.fit.portlet.service.service.impl.InserFitxaPersonalLocalServiceImpl.java

License:Open Source License

public List<InserFitxaPersonal> search(long companyId, long groupId, long[] organizationIds, String searchText,
        long tecnicReferent, long codiProjecte, long serveiSocial, int start, int end, String orderByCol,
        String orderByType) {//from www  .j av  a 2  s . c o m

    List<InserFitxaPersonal> llista = new ArrayList<InserFitxaPersonal>();

    Hits search = searchFitxaPersonalHits(companyId, groupId, organizationIds, searchText, tecnicReferent,
            codiProjecte, serveiSocial, start, end, orderByCol, orderByType);

    for (Document doc : search.getDocs()) {

        try {

            long id = Long.parseLong(doc.get(Field.CLASS_PK));

            InserFitxaPersonal fitxaPersonal = InserFitxaPersonalLocalServiceUtil.getInserFitxaPersonal(id);

            llista.add(fitxaPersonal);

        } catch (NumberFormatException e) {
            log.error(e);
        } catch (PortalException e) {
            log.error(e);
        } catch (SystemException e) {
            log.error(e);
        }

    }

    return llista;

}

From source file:org.fit.portlet.service.service.impl.InserFitxaPersonalLocalServiceImpl.java

License:Open Source License

private int getType(String orderByColumn) {

    if (orderByColumn.equalsIgnoreCase(Field.CLASS_PK)) {

        return Sort.LONG_TYPE;

    }//from  w ww  .  j  av  a  2s  . co m

    return Sort.STRING_TYPE;
}

From source file:org.liferay.jukebox.util.AlbumIndexer.java

License:Open Source License

@Override
public void addRelatedEntryFields(Document document, Object obj) throws Exception {

    if (obj instanceof DLFileEntry) {
        DLFileEntry dlFileEntry = (DLFileEntry) obj;

        Album album = AlbumLocalServiceUtil.getAlbum(GetterUtil.getLong(dlFileEntry.getTitle()));

        document.addKeyword(Field.CLASS_NAME_ID, PortalUtil.getClassNameId(Album.class.getName()));
        document.addKeyword(Field.CLASS_PK, album.getAlbumId());
        document.addKeyword(Field.RELATED_ENTRY, true);
    }/*w w w  .  j  ava  2  s .  c o  m*/
}

From source file:org.liferay.jukebox.util.ArtistIndexer.java

License:Open Source License

@Override
public void addRelatedEntryFields(Document document, Object obj) throws Exception {

    if (obj instanceof DLFileEntry) {
        DLFileEntry dlFileEntry = (DLFileEntry) obj;

        Artist artist = ArtistLocalServiceUtil.getArtist(GetterUtil.getLong(dlFileEntry.getTitle()));

        document.addKeyword(Field.CLASS_NAME_ID, PortalUtil.getClassNameId(Artist.class.getName()));
        document.addKeyword(Field.CLASS_PK, artist.getArtistId());
        document.addKeyword(Field.RELATED_ENTRY, true);
    }//from   w  w  w. j  ava 2s  .  c  o  m
}

From source file:org.liferay.jukebox.util.ArtistIndexer.java

License:Open Source License

@Override
protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletURL portletURL) {

    Summary summary = createSummary(document);

    summary.setMaxContentLength(200);/*w ww  . ja v a 2s . com*/

    String title = document.get(Field.TITLE);

    String content = snippet;

    if (Validator.isNull(snippet)) {
        content = StringUtil.shorten(document.get("bio"), 200);
    }

    portletURL.setParameter("jspPage", "/html/artists/view_artist.jsp");
    portletURL.setParameter("artistId", document.get(Field.CLASS_PK));

    return new Summary(title, content, portletURL);
}

From source file:org.liferay.jukebox.util.SongIndexer.java

License:Open Source License

@Override
public void addRelatedEntryFields(Document document, Object obj) throws Exception {

    if (obj instanceof DLFileEntry) {
        DLFileEntry dlFileEntry = (DLFileEntry) obj;

        Song song = SongLocalServiceUtil.getSong(GetterUtil.getLong(dlFileEntry.getTitle()));

        document.addKeyword(Field.CLASS_NAME_ID, PortalUtil.getClassNameId(Song.class.getName()));
        document.addKeyword(Field.CLASS_PK, song.getSongId());
        document.addKeyword(Field.RELATED_ENTRY, true);
    }//from   w w  w  .  j a  v  a 2  s .c o m
}