/** * Initializes the user object to work with depending on the dialog state and request parameters.<p> * */ protected void initUserObject() { if (m_fieldconfiguration == null) { try { m_fieldconfiguration = m_searchManager.getFieldConfiguration(getParamFieldconfiguration()); if (m_fieldconfiguration == null) { m_fieldconfiguration = new CmsLuceneFieldConfiguration(); } } catch (Exception e) { m_fieldconfiguration = new CmsLuceneFieldConfiguration(); } } }
/** * Returns the field names used for the excerpt generation.<p> * * @return the field names used for the excerpt generation */ public Set<String> getExcerptFields() { return new HashSet<String>(getExcerptFieldNames()); }
/** * Returns a list of the concrete Lucene search fields.<p> * * @return a list of lucene search fields */ public List<CmsLuceneField> getLuceneFields() { List<CmsLuceneField> result = new ArrayList<CmsLuceneField>(); for (CmsSearchField field : getFields()) { if (field instanceof CmsLuceneField) { result.add((CmsLuceneField)field); } } return result; }
CmsLuceneFieldConfiguration result = new CmsLuceneFieldConfiguration(); result.setName(STR_STANDARD); result.setDescription(STR_STANDARD_DESCRIPTION); null); field.addMapping(new CmsSearchFieldMapping(CmsSearchFieldMappingType.CONTENT, null, true)); result.addField(field); field.addMapping( new CmsSearchFieldMapping(CmsSearchFieldMappingType.PROPERTY, CmsPropertyDefinition.PROPERTY_TITLE, true)); result.addField(field); field.addMapping( new CmsSearchFieldMapping(CmsSearchFieldMappingType.PROPERTY, CmsPropertyDefinition.PROPERTY_TITLE, true)); result.addField(field); CmsPropertyDefinition.PROPERTY_KEYWORDS, true)); result.addField(field); CmsPropertyDefinition.PROPERTY_DESCRIPTION, true)); result.addField(field); CmsPropertyDefinition.PROPERTY_DESCRIPTION, true)); result.addField(field);
Set<String> returnFields = ((CmsLuceneFieldConfiguration)m_fieldConfiguration).getReturnFields(); Set<String> excerptFields = ((CmsLuceneFieldConfiguration)m_fieldConfiguration).getExcerptFields();
/** * Returns the field names used for a regular result.<p> * * @return the field names used for a regular result */ public Set<String> getReturnFields() { if (m_fieldAdded) { for (CmsSearchField field : getLuceneFields()) { if (field.isStored() && !LAZY_FIELDS.contains(field.getName())) { m_returnFields.add(field.getName()); } } } m_fieldAdded = false; return m_returnFields; } }
setAnalyzer(fc.getAnalyzer(baseAnalyzer));
/** * Returns an analyzer that wraps the given base analyzer with the analyzers of this individual field configuration.<p> * * @param analyzer the base analyzer to wrap * * @return an analyzer that wraps the given base analyzer with the analyzers of this individual field configuration */ public Analyzer getAnalyzer(Analyzer analyzer) { // parent folder and last modified lookup fields must use whitespace analyzer WhitespaceAnalyzer ws = new WhitespaceAnalyzer(); Map<String, Analyzer> analyzers = new HashMap<String, Analyzer>(); // first make map the default hard coded fields analyzers.put(CmsSearchField.FIELD_PARENT_FOLDERS, ws); analyzers.put(CmsSearchField.FIELD_CATEGORY, ws); analyzers.put(CmsSearchField.FIELD_DATE_LASTMODIFIED_LOOKUP, ws); analyzers.put(CmsSearchField.FIELD_DATE_CREATED_LOOKUP, ws); for (CmsLuceneField field : getLuceneFields()) { Analyzer fieldAnalyzer = field.getAnalyzer(); if (fieldAnalyzer != null) { // this field has an individual analyzer configured analyzers.put(field.getName(), fieldAnalyzer); } } // return the individual field configured analyzer return new PerFieldAnalyzerWrapper(analyzer, analyzers); }
m_fieldconfiguration = m_searchManager.getFieldConfiguration(getParamFieldconfiguration()); if (m_fieldconfiguration == null) { m_fieldconfiguration = new CmsLuceneFieldConfiguration(); m_fieldconfiguration = new CmsLuceneFieldConfiguration();
Iterator<String> excerptFieldNames = conf.getExcerptFieldNames().iterator(); StringBuffer excerptBuffer = new StringBuffer(); while (excerptFieldNames.hasNext()) {
/** * Returns a list of all field names (Strings) that are used in generating the search excerpt.<p> * * @return a list of all field names (Strings) that are used in generating the search excerpt */ public List<String> getExcerptFieldNames() { if (m_excerptFieldNames == null) { // lazy initialize the field names m_excerptFieldNames = new ArrayList<String>(); Iterator<CmsSearchField> i = getFields().iterator(); while (i.hasNext()) { CmsLuceneField field = (CmsLuceneField)i.next(); if (field.isInExcerptAndStored()) { m_excerptFieldNames.add(field.getName()); } } } // create a copy of the list to prevent changes in other classes return new ArrayList<String>(m_excerptFieldNames); }
m_fieldconfiguration = m_searchManager.getFieldConfiguration(getParamFieldconfiguration()); if (m_fieldconfiguration == null) { m_fieldconfiguration = new CmsLuceneFieldConfiguration(); m_fieldconfiguration = new CmsLuceneFieldConfiguration();