On Mon, May 10, 2010 at 03:23:50PM +0100, Enrico Zini wrote:

> I am preparing a new version of libept after quite aggressively
> simplifying its code.

I've done quite a serious chopping of the textsearch part.

I'm attaching the updated patch, which doesn't change much since the
Xapian index was not used.


Ciao,

Enrico

-- 
GPG key: 4096R/E7AD5568 2009-05-08 Enrico Zini <[email protected]>
diff --git a/debian/control b/debian/control
index 227536c..13a71f1 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: packagesearch
 Section: admin
 Priority: optional
 Maintainer: Benjamin Mesing <[email protected]>
-Build-Depends: debhelper (>= 7.0.0), libept-dev (>= 0.5.26), libept-dev (<< 0.6), libqt4-dev, qt4-dev-tools, docbook-to-man, pkg-config, libwibble-dev (>= 0.1), libwibble-dev (<< 0.2), libtagcoll2-dev (>= 2.0), libtagcoll2-dev (<< 2.1)
+Build-Depends: debhelper (>= 7.0.0), libept-dev (>= 1.0), libept-dev (<< 2), libqt4-dev, qt4-dev-tools, docbook-to-man, pkg-config, libwibble-dev (>= 0.1), libwibble-dev (<< 0.2), libtagcoll2-dev (>= 2.0), libtagcoll2-dev (<< 2.1)
 Standards-Version: 3.8.3.0
 Vcs-Svn: https://packagesearch.svn.sourceforge.net/svnroot/packagesearch
 
diff --git a/src/iprovider.h b/src/iprovider.h
index b155f1d..a291c8f 100644
--- a/src/iprovider.h
+++ b/src/iprovider.h
@@ -12,6 +12,10 @@ class QPushButton;
 class QStatusBar;
 class QWidget;
 
+namespace Xapian {
+	class Database;
+}
+
 namespace ept 
 {
 	namespace apt {
@@ -21,9 +25,6 @@ namespace ept
 		class Debtags;
 		class Vocabulary;
 	}
-	namespace textsearch {
-		class TextSearch;
-	}
 }
 
 using namespace std;
@@ -113,8 +114,10 @@ public:
 	virtual const ept::apt::Apt& apt() const = 0;
 	/** Returns a reference to the debtags object. */
 	virtual const ept::debtags::Debtags& debtags() const = 0;
+	/** Returns a reference to the debtags vocabulary object. */
+	virtual const ept::debtags::Vocabulary& vocabulary() const = 0;
 	/** Returns a reference to the debtags object. */
-	virtual const ept::textsearch::TextSearch& textsearch() const = 0;
+	virtual const Xapian::Database& textsearch() const = 0;
 
 	/** @brief Reloads the package database. */
 	virtual void reloadAptFrontCache() = 0;
diff --git a/src/packagesearchimpl.cpp b/src/packagesearchimpl.cpp
index 9730f13..76f8b51 100644
--- a/src/packagesearchimpl.cpp
+++ b/src/packagesearchimpl.cpp
@@ -41,7 +41,8 @@
 
 #include <ept/apt/apt.h>
 #include <ept/debtags/debtags.h>
-#include <ept/textsearch/textsearch.h>
+#include <ept/debtags/vocabulary.h>
+#include <ept/axi/axi.h>
 
 
 // NApplication
@@ -102,7 +103,11 @@ PackageSearchImpl::PackageSearchImpl( QWidget* parent, const char* name, Qt::WFl
 
 	_pApt = new ept::apt::Apt;
 	_pDebtags = new ept::debtags::Debtags;
-	_pTextsearch = new ept::textsearch::TextSearch;
+	_pVocabulary = new ept::debtags::Vocabulary;
+	if (ept::axi::timestamp() > 0)
+		_pTextsearch = new Xapian::Database(ept::axi::path_db());
+	else
+		_pTextsearch = new Xapian::Database;
 
 	// set up what's this actions
 	_pWhatsThisAction = QWhatsThis::createAction(this);
@@ -172,6 +177,7 @@ PackageSearchImpl::~PackageSearchImpl()
 	delete _pScoreDisplayPlugin;
 	delete _pApt;
 	delete _pDebtags;
+	delete _pVocabulary;
 	delete _pTextsearch;
 }
 
@@ -464,7 +470,10 @@ void PackageSearchImpl::reloadAptFrontCache()
 	delete _pTextsearch;
 // 	_pDebtags = new ept::debtags::Debtags;
 	_pApt = new ept::apt::Apt;
-	_pTextsearch = new ept::textsearch::TextSearch;
+	if (ept::axi::timestamp() > 0)
+		_pTextsearch = new Xapian::Database(ept::axi::path_db());
+	else
+		_pTextsearch = new Xapian::Database;
 }
 
 /////////////////////////////////////////////////////
diff --git a/src/packagesearchimpl.h b/src/packagesearchimpl.h
index 6bc5d3d..f63f8df 100644
--- a/src/packagesearchimpl.h
+++ b/src/packagesearchimpl.h
@@ -50,6 +50,10 @@ namespace NPackageSearch
 	class PackageDisplayWidget;
 }
 
+namespace Xapian {
+	class Database;
+}
+
 namespace ept 
 {
 	namespace apt {
@@ -59,9 +63,6 @@ namespace ept
 		class Debtags;
 		class Vocabulary;
 	}
-	namespace textsearch {
-		class TextSearch;
-	}
 }
 
 
@@ -117,7 +118,8 @@ public:
 	virtual void reloadAptFrontCache();
 	const ept::apt::Apt& apt() const { return *_pApt; }
 	const ept::debtags::Debtags& debtags() const { return *_pDebtags; }
-	const ept::textsearch::TextSearch& textsearch() const { return *_pTextsearch; }
+	const ept::debtags::Vocabulary& vocabulary() const { return *_pVocabulary; }
+	const Xapian::Database& textsearch() const { return *_pTextsearch; }
 	//@}
 	/** @name IPluginUser interface
 	  *
@@ -288,7 +290,8 @@ private:
 	
 	ept::apt::Apt* _pApt;
 	ept::debtags::Debtags* _pDebtags;
-	ept::textsearch::TextSearch* _pTextsearch;
+	ept::debtags::Vocabulary* _pVocabulary;
+	Xapian::Database* _pTextsearch;
 	QString _iconDir;
 	QString _docDir;
 	/** Holds the name of the package currently shown in the information container. */
diff --git a/src/plugins/aptplugin/aptfrontpackagedb.cpp b/src/plugins/aptplugin/aptfrontpackagedb.cpp
index d277f3b..b47ee36 100644
--- a/src/plugins/aptplugin/aptfrontpackagedb.cpp
+++ b/src/plugins/aptplugin/aptfrontpackagedb.cpp
@@ -13,7 +13,7 @@
 
 #include <ept/apt/apt.h>
 #include <ept/apt/packagerecord.h>
-#include <ept/textsearch/textsearch.h>
+#include <ept/axi/axi.h>
 #include <xapian.h>
 
 #include <QStringList>
@@ -92,14 +92,13 @@ bool AptFrontPackageDB::search(std::set<string>& result, const QStringList& incl
 	const QStringList& excludePatterns, bool searchDescr, bool caseSensitive, bool wholeWords) const
 {
 	typedef ept::apt::Apt Apt;
-	typedef ept::textsearch::TextSearch TextSearch;
 	const Apt& packages = _pProvider->apt();
 	if (searchDescr)
 	{
 		ept::apt::PackageRecord rec;
 // don't compile xapian search
 #if 0
-		const TextSearch& textsearch = _pProvider->textsearch();
+		const Xapian::Database& textsearch = _pProvider->textsearch();
 		bool useXapian = false;
 		// currently do not use Xapian
 		if (false) 
diff --git a/src/plugins/debtagsplugin/debtagshelper.cpp b/src/plugins/debtagsplugin/debtagshelper.cpp
index e070092..453198b 100644
--- a/src/plugins/debtagsplugin/debtagshelper.cpp
+++ b/src/plugins/debtagsplugin/debtagshelper.cpp
@@ -19,12 +19,7 @@ namespace NUtil
 
 std::set<Tag> stringsToTags(const set<string>& tags, const Vocabulary& vocabulary)
 {
-	std::set<Tag> result;
-	for (set<string>::const_iterator it = tags.begin(); it != tags.end(); ++it)
-	{
-		result.insert(vocabulary.tagByName(*it));
-	}
-	return result;
+	return tags;
 }
 
 }	// namespace NUtil
diff --git a/src/plugins/debtagsplugin/debtagshelper.h b/src/plugins/debtagsplugin/debtagshelper.h
index bcb6a30..00eb6e1 100644
--- a/src/plugins/debtagsplugin/debtagshelper.h
+++ b/src/plugins/debtagsplugin/debtagshelper.h
@@ -15,7 +15,6 @@
 
 #include <string>
 
-#include <ept/debtags/tag.h>
 #include <ept/apt/apt.h>
 
 using namespace std;
@@ -34,7 +33,7 @@ namespace NUtil
 {
 
 typedef std::string Package;
-typedef ept::debtags::Tag Tag;
+typedef std::string Tag;
 typedef ept::debtags::Debtags Debtags;
 typedef ept::debtags::Vocabulary Vocabulary;
 
@@ -60,12 +59,7 @@ inline std::set<string> packagesToStrings(const set<Package>& packages)
   */
 inline std::set<string> tagsToStrings(const set<Tag>& tags)
 {
-	std::set<string> result;
-	for (set<Tag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
-	{
-		result.insert(it->fullname());
-	}
-	return result;
+	return tags;
 }
 
 /** Collects the tags from the given vocabulary 
diff --git a/src/plugins/debtagsplugin/debtagsplugin.cpp b/src/plugins/debtagsplugin/debtagsplugin.cpp
index 3ff26fb..b16b0a8 100644
--- a/src/plugins/debtagsplugin/debtagsplugin.cpp
+++ b/src/plugins/debtagsplugin/debtagsplugin.cpp
@@ -37,7 +37,7 @@
 #include "vocabularymodel.h"
 
 typedef std::string Package;
-typedef ept::debtags::Tag Tag;
+typedef std::string Tag;
 
 using namespace std;
 
@@ -186,7 +186,7 @@ std::string DebtagsPlugin::createSearchExpression()
 		else 
 			first = false;
 
-		oexpr << it->fullname();
+		oexpr << *it;
 	}
 	// the list view that displays the selected tags
 // 	set<Tag> excludeTags = fill in here;
diff --git a/src/plugins/debtagsplugin/debtagsplugincontainer.cpp b/src/plugins/debtagsplugin/debtagsplugincontainer.cpp
index 6815c2f..e248969 100644
--- a/src/plugins/debtagsplugin/debtagsplugincontainer.cpp
+++ b/src/plugins/debtagsplugin/debtagsplugincontainer.cpp
@@ -10,7 +10,6 @@
 
 #include <wibble/operators.h>
 #include <ept/debtags/debtags.h>
-#include <ept/debtags/tag.h>
 
 #include "debtagsplugincontainer.h"
 
@@ -165,14 +164,14 @@ QDomElement DebtagsPluginContainer::loadContainerSettings(const QDomElement sour
 void DebtagsPluginContainer::saveContainerSettings(NXml::XmlData& outData, QDomElement parent) const
 {
 	qDebug("saveContainerSettings called");
-	typedef ept::debtags::Facet Facet;
+	typedef std::string Facet;
 	QDomElement containerElement = outData.addElement(parent, "ContainerSettings");
 	outData.addAttribute(containerElement, 0.1f, "settingsVersion");
 	set<Facet> hiddenFacets = _pVocabularyModel->hiddenFacets();
 	for (set<Facet>::const_iterator it = hiddenFacets.begin(); it != hiddenFacets.end(); ++it)
 	{
 		QDomElement hiddenFacetElement = outData.addElement(containerElement, "HiddenFacet");
-		outData.addText(hiddenFacetElement, it->name());
+		outData.addText(hiddenFacetElement, *it);
 	}
 }
 
@@ -273,9 +272,14 @@ const ept::debtags::Debtags* DebtagsPluginContainer::collection() const
 	return &(provider()->debtags());
 }
 
+const ept::debtags::Vocabulary* DebtagsPluginContainer::vocabulary() const	
+{
+	return &(provider()->vocabulary());
+}
+
 const std::set<DebtagsPluginContainer::Facet> DebtagsPluginContainer::facets() const
 {
-	const Vocabulary& tags = provider()->debtags().vocabulary();
+	const Vocabulary& tags = provider()->vocabulary();
 	return tags.facets(); 
 }
 
diff --git a/src/plugins/debtagsplugin/debtagsplugincontainer.h b/src/plugins/debtagsplugin/debtagsplugincontainer.h
index bc77798..59ee138 100644
--- a/src/plugins/debtagsplugin/debtagsplugincontainer.h
+++ b/src/plugins/debtagsplugin/debtagsplugincontainer.h
@@ -14,7 +14,6 @@ using namespace std;
 
 namespace ept {
 namespace debtags {
-class Facet;
 class Debtags;
 class Vocabulary;
 }
@@ -48,7 +47,7 @@ class DebtagsPluginContainer : public QObject, public BasePluginContainer
 {
 	Q_OBJECT
 	
-	typedef ept::debtags::Facet Facet;
+	typedef std::string Facet;
 	typedef ept::debtags::Debtags Debtags;
 	typedef ept::debtags::Vocabulary Vocabulary;
 
@@ -122,6 +121,7 @@ public:
 	  * Every item (package) appears only ones in the collection. 
 	  */
 	const Debtags* collection() const;
+	const Vocabulary* vocabulary() const;
 	/** @brief Returns a pointer to the model used to store the information about the vocabulary
 	  *
 	  * This information includes selected tags, hidden facets and possibly more.
diff --git a/src/plugins/debtagsplugin/debtagssettingswidget.cpp b/src/plugins/debtagsplugin/debtagssettingswidget.cpp
index b8eb7c0..094ae6d 100644
--- a/src/plugins/debtagsplugin/debtagssettingswidget.cpp
+++ b/src/plugins/debtagsplugin/debtagssettingswidget.cpp
@@ -34,7 +34,7 @@ DebtagsSettingsWidget::DebtagsSettingsWidget(NTagModel::VocabularyModel* pModel,
 	using namespace wibble::operators;
 	typedef NTagModel::FilterHiddenProxyModel FilterHiddenProxyModel;
 	typedef ept::debtags::Vocabulary Vocabulary;
-	typedef ept::debtags::Facet Facet;
+	typedef std::string Facet;
 
 	if (name)
 		setObjectName(name);
diff --git a/src/plugins/debtagsplugin/emptytagfilter.h b/src/plugins/debtagsplugin/emptytagfilter.h
index aeb16ac..4ad181f 100644
--- a/src/plugins/debtagsplugin/emptytagfilter.h
+++ b/src/plugins/debtagsplugin/emptytagfilter.h
@@ -18,7 +18,6 @@
 
 namespace ept {
 namespace debtags {
-class Tag;
 class Debtags;
 }
 }
@@ -46,7 +45,7 @@ class EmptyTagFilter : public QSortFilterProxyModel
 {
 	Q_OBJECT
 	
-	typedef ept::debtags::Tag Tag;
+	typedef std::string Tag;
 	typedef ept::debtags::Debtags Debtags;
 
 	/** The model holding the information about the selected tags.
diff --git a/src/plugins/debtagsplugin/relatedplugin.h b/src/plugins/debtagsplugin/relatedplugin.h
index c3a1a79..8a1eec4 100644
--- a/src/plugins/debtagsplugin/relatedplugin.h
+++ b/src/plugins/debtagsplugin/relatedplugin.h
@@ -13,12 +13,6 @@
 #include <scoreplugin.h>
 #include <debtagsplugincontainer.h>
 
-namespace ept {
-namespace debtags {
-class Tag;
-}
-}
-
 class QMainWindow;
 
 class RelatedInput;
@@ -43,7 +37,7 @@ class RelatedPlugin : public SearchPlugin, public ScorePlugin
 	Q_OBJECT
 
 	typedef std::string Package;
-	typedef ept::debtags::Tag Tag;
+	typedef std::string Tag;
 public:
 	static const QString PLUGIN_NAME;
 	RelatedPlugin(const DebtagsPluginContainer& container);
diff --git a/src/plugins/debtagsplugin/selectioninputanddisplay.cpp b/src/plugins/debtagsplugin/selectioninputanddisplay.cpp
index 131d1e1..5d3f454 100644
--- a/src/plugins/debtagsplugin/selectioninputanddisplay.cpp
+++ b/src/plugins/debtagsplugin/selectioninputanddisplay.cpp
@@ -35,8 +35,8 @@ using namespace wibble::operators;
 namespace NWidgets 
 {
 
-typedef ept::debtags::Facet Facet;
-typedef ept::debtags::Tag Tag;
+typedef std::string Facet;
+typedef std::string Tag;
 
 
 SelectionInputAndDisplay::SelectionInputAndDisplay(const NPlugin::DebtagsPluginContainer* pContainer, NTagModel::VocabularyModel* pModel, QObject* pParent)
diff --git a/src/plugins/debtagsplugin/selectioninputanddisplay.h b/src/plugins/debtagsplugin/selectioninputanddisplay.h
index d0f0e98..6192038 100644
--- a/src/plugins/debtagsplugin/selectioninputanddisplay.h
+++ b/src/plugins/debtagsplugin/selectioninputanddisplay.h
@@ -13,8 +13,7 @@
 #define __SELECTIONINPUTANDDISPLAY_H_2004_06_28
 
 #include <QObject>
-
-#include <ept/debtags/tag.h>
+#include <set>
 
 class QAbstractItemView;
 class QLabel;
@@ -67,8 +66,8 @@ Q_OBJECT
 	NTagModel::VocabularyModel* _pModel;
 
 
-	typedef ept::debtags::Facet Facet;
-	typedef ept::debtags::Tag Tag;
+	typedef std::string Facet;
+	typedef std::string Tag;
 
 	/** @brief The label shown above #_pTagView. */
 	QLabel* _pViewLabel;
diff --git a/src/plugins/debtagsplugin/taglistproxymodel.h b/src/plugins/debtagsplugin/taglistproxymodel.h
index 9d891d0..6cb57fe 100644
--- a/src/plugins/debtagsplugin/taglistproxymodel.h
+++ b/src/plugins/debtagsplugin/taglistproxymodel.h
@@ -35,8 +35,8 @@ namespace NTagModel
 class TagListProxyModel  : public QAbstractProxyModel
 {
 Q_OBJECT
-	typedef ept::debtags::Tag Tag;
-	typedef ept::debtags::Facet Facet;
+	typedef std::string Tag;
+	typedef std::string Facet;
 	/** Maps the row to the tag with the given name. */
 	map<int, Tag> _rowToTag;
 	/** Maps the tag name to the row for the tag. */
@@ -72,7 +72,7 @@ public:
 		else
 		{
 			TagData* pTagData = pData->toTagData();
-			int row = _tagToRow.find(pTagData->tag)->second;
+			int row = _tagToRow.find(pTagData->tag->name)->second;
 			return index(row, sourceIndex.column());
 		}
 	}
@@ -144,8 +144,8 @@ public:
 				QModelIndex index = pModel->index(j, 0, facetIndex);
 				ItemData* pData = (ItemData*) index.internalPointer();
 				TagData* pTagData = pData->toTagData();
-				_tagToRow[pTagData->tag] = row;
-				_rowToTag[row] = pTagData->tag;
+				_tagToRow[pTagData->tag->name] = row;
+				_rowToTag[row] = pTagData->tag->name;
 				++row;
 			}
 		}
diff --git a/src/plugins/debtagsplugin/vocabularymodel.cpp b/src/plugins/debtagsplugin/vocabularymodel.cpp
index 65e56be..e3c38eb 100644
--- a/src/plugins/debtagsplugin/vocabularymodel.cpp
+++ b/src/plugins/debtagsplugin/vocabularymodel.cpp
@@ -24,8 +24,8 @@ using namespace wibble::operators;
 
 #include <helpers.h>
 
-typedef ept::debtags::Tag Tag;
-typedef ept::debtags::Facet Facet;
+typedef std::string Tag;
+typedef std::string Facet;
 
 
 TagWrapper::TagWrapper() {}
@@ -39,17 +39,22 @@ VocabularyModel::VocabularyModel(const NPlugin::DebtagsPluginContainer* pContain
 	_pContainer = pContainer;
 	const set<Facet> facets = _pContainer->facets(); 
 	int i = 0;
+	const ept::debtags::Vocabulary* dtvoc = _pContainer->vocabulary();
 	for (set<Facet>::const_iterator it = facets.begin(); it != facets.end(); ++it, ++i)
 	{
-		_facets.push_back(FacetData(*it, i));
-		_facetToFacetData[it->name()] = i;
-		set<Tag> tags = it->tags();
+		const ept::debtags::voc::FacetData* fd = dtvoc->facetData(*it);
+		if (!fd) continue;
+		_facets.push_back(FacetData(fd, i));
+		_facetToFacetData[fd->name] = i;
+		set<Tag> tags = fd->tags();
 		vector<TagData> tagData;
 		int j = 0;
 		for (set<Tag>::const_iterator jt = tags.begin(); jt != tags.end(); ++jt, ++j)
 		{
-			tagData.push_back( TagData(*jt, i) );	
-			_tagToTagData[*jt] = make_pair(i, j);
+			const ept::debtags::voc::TagData* td = dtvoc->tagData(*jt);
+			if (!td) continue;
+			tagData.push_back( TagData(td, i) );	
+			_tagToTagData[td->name] = make_pair(i, j);
 		}
 		_tags.push_back(tagData);
 	}
@@ -92,8 +97,7 @@ int VocabularyModel::rowCount(const QModelIndex & parent) const
 		if (pData->isFacet())
 		{
 			const FacetData* pParentData = (FacetData*) pData;
-			const Facet facet = pParentData->facet;
-			return facet.tags().size();
+			return pParentData->facet->tags().size();
 		}
 		else	// parent is a tag - tags do not have children (since tag grouping is not supported) supported)
 			return 0;
@@ -167,7 +171,7 @@ QVariant VocabularyModel::data(const QModelIndex& index, int role) const
 		{
 			const ItemData* pData = (ItemData*) index.internalPointer();
 			assert(pData->toTagData());
-			Tag tag = pData->toTagData()->tag;
+			Tag tag = pData->toTagData()->tag->name;
 			// dummy to pull in default constructor symbol
 // 			TagWrapper tw();
  			return QVariant::fromValue(TagWrapper(tag));
@@ -234,8 +238,8 @@ QModelIndex VocabularyModel::index (int row, int column, const QModelIndex & par
 		return QModelIndex();
 	assert(dynamic_cast<const FacetData*>(pData) != 0);
 	FacetData* pFacetData = (FacetData*) parent.internalPointer();
-	Facet facet = pFacetData->facet;
-	if (row >= (int) facet.tags().size() || column >= 2)
+	const ept::debtags::voc::FacetData* facet = pFacetData->facet;
+	if (row >= (int) facet->tags().size() || column >= 2)
 	{
 		qDebug("[VocabularyModel::index()] Warning: row or column to large, row: %d, column, %d", row, column);
 		qStrDebug("[VocabularyModel::index()] Facet: " + pFacetData->fullname());
@@ -261,9 +265,9 @@ bool VocabularyModel::setData(const QModelIndex& index, const QVariant& value, i
 			qDebug("[VocabularyModel::setData()] size before insert/remove: %lu", _selectedTags.size());
 			// if the tag is selected
 			if (value.toBool())
-				_selectedTags.insert(pTagData->tag);
+				_selectedTags.insert(pTagData->tag->name);
 			else	// the tag is unselected
-				_selectedTags.erase(pTagData->tag);
+				_selectedTags.erase(pTagData->tag->name);
 			qDebug("[VocabularyModel::setData()] size after insert/remove: %lu", _selectedTags.size());
 			_companionTagsValid = false;
 // 			reset();
@@ -316,7 +320,7 @@ void VocabularyModel::setAllUnselected(QModelIndex index)
 	if (pTagData)
 	{
 		pTagData->selected = false;
-		_selectedTags.erase(pTagData->tag);
+		_selectedTags.erase(pTagData->tag->name);
 	}
 	_companionTagsValid = false;
 }
@@ -374,7 +378,7 @@ set<Facet> VocabularyModel::hiddenFacets() const
 		QModelIndex index = this->index(i, 0, parent);
 		NTagModel::FacetData* pFacet = (NTagModel::FacetData*) index.internalPointer();
 		if (pFacet->hidden)
-			result.insert(pFacet->facet);
+			result.insert(pFacet->facet->name);
 	}
 	return result;
 }
@@ -389,7 +393,7 @@ set<Facet> VocabularyModel::shownFacets() const
 		QModelIndex index = this->index(i, 0, parent);
 		NTagModel::FacetData* pFacet = (NTagModel::FacetData*) index.internalPointer();
 		if (!pFacet->hidden)
-			result.insert(pFacet->facet);
+			result.insert(pFacet->facet->name);
 	}
 	return result;
 }
@@ -404,7 +408,7 @@ std::set<Tag> VocabularyModel::collectSelectedChildItems(const QModelIndex& pare
 		if (data(index, NTagModel::SelectedRole).toBool())
 		{
 			NTagModel::TagData* pTagData = (NTagModel::TagData*) index.internalPointer();
-			result.insert(pTagData->tag);
+			result.insert(pTagData->tag->name);
 		}
 		result |= collectSelectedChildItems(index);
 	}
diff --git a/src/plugins/debtagsplugin/vocabularymodel.h b/src/plugins/debtagsplugin/vocabularymodel.h
index f9ee672..35661ea 100644
--- a/src/plugins/debtagsplugin/vocabularymodel.h
+++ b/src/plugins/debtagsplugin/vocabularymodel.h
@@ -16,9 +16,8 @@
 
 #include <QAbstractListModel>
 
-#include <ept/debtags/tag.h>
-
 #include <debtagsplugincontainer.h>
+#include <ept/debtags/vocabulary.h>
 
 
 #include <helpers.h>
@@ -62,7 +61,7 @@ struct ItemData
 
 struct FacetData : public ItemData
 {
-	typedef ept::debtags::Facet Facet;
+	typedef const ept::debtags::voc::FacetData* Facet;
 	
 	Facet facet;
 	bool hidden;
@@ -75,10 +74,10 @@ struct FacetData : public ItemData
 
 	}
 	virtual bool isFacet() const { return true; }
-	virtual QString name() const { return toQString(facet.shortDescription()); }
-	virtual QString fullname() const { return toQString(facet.name()); }
+	virtual QString name() const { return toQString(facet->shortDescription()); }
+	virtual QString fullname() const { return toQString(facet->name); }
 	virtual QString fullDisplayText() const { return name(); };
-	virtual QString description() const { return toQString(facet.shortDescription()); }
+	virtual QString description() const { return toQString(facet->shortDescription()); }
 	virtual const FacetData* toFacetData() const { return this; };
 	virtual const TagData* toTagData() const { return 0; };
 	virtual FacetData* toFacetData() { return this; };
@@ -87,7 +86,7 @@ struct FacetData : public ItemData
 
 struct TagData : public ItemData
 {
-	typedef ept::debtags::Tag Tag;
+	typedef const ept::debtags::voc::TagData* Tag;
 	
 	int facetIndex;
 	/** @brief Stores if the tag was selected to be searched for.
@@ -104,14 +103,14 @@ struct TagData : public ItemData
 	{
 	}
 	virtual bool isFacet() const { return false; }
-	virtual QString name() const { return toQString(tag.shortDescription()); }
-	virtual QString fullname() const { return toQString(tag.fullname()); }
+	virtual QString name() const { return toQString(tag->shortDescription()); }
+	virtual QString fullname() const { return toQString(tag->name); }
 	virtual QString fullDisplayText() const 
-	{ QString tmp = toQString(tag.facet().shortDescription());
+	{ QString tmp = toQString(ept::debtags::voc::getfacet(tag->name)); // FIXME: needs to access vocabulary for this: toQString(tag.facet().shortDescription());
 		tmp += QString(": ");
 		tmp += name();
 		return tmp; };
-	virtual QString description() const { return toQString(tag.longDescription()); }
+	virtual QString description() const { return toQString(tag->longDescription()); }
 	virtual const FacetData* toFacetData() const { return 0; };
 	virtual const TagData* toTagData() const { return this; };
 	virtual FacetData* toFacetData() { return 0; };
@@ -125,8 +124,8 @@ struct TagData : public ItemData
 class VocabularyModel : public QAbstractItemModel
 {
 // Q_OBJECT
-	typedef ept::debtags::Tag Tag;
-	typedef ept::debtags::Facet Facet;
+	typedef std::string Tag;
+	typedef std::string Facet;
 	typedef ept::debtags::Debtags Debtags;
 
 	/** @brief The object used to access the tag collection.
@@ -250,7 +249,7 @@ private:
 
 struct TagWrapper
 {
-	typedef ept::debtags::Tag Tag;
+	typedef std::string Tag;
 public:
 	Tag tag;
 	TagWrapper();

Attachment: signature.asc
Description: Digital signature

Reply via email to