OpenCMS - Search field of custom bean
- by Luigi 1982
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!