/** * @see org.apache.lucene.search.HitCollector#collect(int, float) */ @Override public void collect(int id, float score) { String category = null; try { Document doc = m_searcher.doc(id); category = doc.get(CmsSearchField.FIELD_CATEGORY); } catch (IOException e) { // category will be null if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_READ_CATEGORY_FAILED_1, new Integer(id)), e); } } if (category == null) { category = UNKNOWN_CATEGORY; } CmsCategroyCount count = m_categories.get(category); if (count != null) { count.inc(); } else { count = new CmsCategroyCount(); m_categories.put(category, count); } }
/** * @see org.apache.lucene.search.SimpleCollector#collect(int) */ @Override public void collect(int id) { String category = null; int rebasedId = m_docBase + id; try { Document doc = m_searcher.doc(rebasedId); category = doc.get(CmsSearchField.FIELD_CATEGORY); } catch (IOException e) { // category will be null if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_READ_CATEGORY_FAILED_1, new Integer(rebasedId)), e); } } if (category == null) { category = UNKNOWN_CATEGORY; } CmsCategroyCount count = m_categories.get(category); if (count != null) { count.inc(); } else { count = new CmsCategroyCount(); m_categories.put(category, count); } }