OpenCMS - Search field of custom bean
Posted
by Luigi 1982
on Stack Overflow
See other posts from Stack Overflow
or by Luigi 1982
Published on 2010-05-10T10:31:34Z
Indexed on
2010/05/10
10:34 UTC
Read the original article
Hit count: 416
opencms
Hi at all...
I make some beans with information from VFS of OpenCMS. I want to make searchable the data of my beans. I follow this step but without success:
1) Extends my bean class with CmsSearch and ovverride init method. After I make some stuff for the constructor of my bean:
/* Some stuff for CMSSearch */
/** Constant for the fields we will search */ static final String[] DOC_QRY_FIELDS = new String[] {"oggettoDocumento","dataPubblicazione", "societa"};
/** The names of our search index files */ static final String OFFLINE_INDEX = "all_bacheca"; static final String ONLINE_INDEX = "all_bacheca";
public DocumentBean(){ super(); m_parameters.setSort(CmsSearchParameters.SORT_DEFAULT); m_parameters.setFields(Arrays.asList(DocumentBean.DOC_QRY_FIELDS)); m_parameters.setIndex(ONLINE_INDEX); m_parameters.setMatchesPerPage(20); }
public void init(CmsObject cms) { super.init(cms); // set search index to offline or online based on current //user project if (cms.getRequestContext().currentProject().isOnlineProject()) { m_parameters.setIndex(ONLINE_INDEX); } else { m_parameters.setIndex(OFFLINE_INDEX); } } // getters and setters..
2) Configure a new DocumentField with the new field 3) Adding code to my jsp:
<input type="hidden" name="field" value="oggettoDocumento"/>
But nothing... How can I perform the custom bean search? I can't find any document.. If anyone know some info, basic.. is good for me..
Thanks!
© Stack Overflow or respective owner