r8432 - software/gofind
Miriam Ruiz
miriam at alioth.debian.org
Tue Nov 18 02:17:48 UTC 2008
Author: miriam
Date: 2008-11-18 02:17:48 +0000 (Tue, 18 Nov 2008)
New Revision: 8432
Added:
software/gofind/field.cpp
software/gofind/field.h
Modified:
software/gofind/Makefile
software/gofind/gofind.cpp
software/gofind/gui_cli.cpp
Log:
Added initial support for search fields
Modified: software/gofind/Makefile
===================================================================
--- software/gofind/Makefile 2008-11-18 01:27:14 UTC (rev 8431)
+++ software/gofind/Makefile 2008-11-18 02:17:48 UTC (rev 8432)
@@ -22,7 +22,10 @@
LDFLAGS=
LIBS= -lept -lept-core -lapt-pkg -lxapian -ldl `pkg-config libtagcoll2 boolstuff-0.1 --libs`
-OBJS= Engine.o Environment.o filter.o gofind.o taghandler.o cfgmanager.o boolparser.o utf8.o dll.o guiplugin.o
+OBJS= Engine.o Environment.o filter.o field.o gofind.o \
+ taghandler.o cfgmanager.o boolparser.o \
+ utf8.o dll.o guiplugin.o
+
PLUGINS=gui_cli.so
all: gofind $(PLUGINS)
Added: software/gofind/field.cpp
===================================================================
--- software/gofind/field.cpp (rev 0)
+++ software/gofind/field.cpp 2008-11-18 02:17:48 UTC (rev 8432)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2008 Miriam Ruiz <little_miry at yahoo.es>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "common.h"
+#include "field.h"
+
+SearchField::SearchField()
+{
+ globalFilter = Xapian::Query();
+ mainFacet = "";
+ secondaryFacet = "";
+}
+
+SearchField::~SearchField()
+{
+}
+
+void SearchField::SetTemplate(std::string &id)
+{
+ if (id == "learn")
+ {
+ mainFacet = "field";
+ secondaryFacet = "interface";
+ globalFilter = Xapian::Query(Xapian::Query::OP_AND,
+ Xapian::Query(Xapian::Query::OP_OR,
+ Xapian::Query("XTrole::documentation"),
+ Xapian::Query("XTrole::program")),
+ Xapian::Query("XTuse::learning"));
+ } else if (id == "admin") {
+ mainFacet = "admin";
+ secondaryFacet = "interface";
+ globalFilter = Xapian::Query(Xapian::Query::OP_OR,
+ Xapian::Query("XTrole::documentation"),
+ Xapian::Query("XTrole::program"));
+ } else if (id == "net") {
+ mainFacet = "network";
+ secondaryFacet = "interface";
+ globalFilter = Xapian::Query(Xapian::Query::OP_OR,
+ Xapian::Query("XTrole::documentation"),
+ Xapian::Query("XTrole::program"));
+ } else if (id == "office") {
+ mainFacet = "office";
+ secondaryFacet = "interface";
+ globalFilter = Xapian::Query(Xapian::Query::OP_OR,
+ Xapian::Query("XTrole::documentation"),
+ Xapian::Query("XTrole::program"));
+ } else if (id == "safe") {
+ mainFacet = "security";
+ secondaryFacet = "interface";
+ globalFilter = Xapian::Query(Xapian::Query::OP_OR,
+ Xapian::Query("XTrole::documentation"),
+ Xapian::Query("XTrole::program"));
+ } else if (id == "web") {
+ mainFacet = "web";
+ secondaryFacet = "interface";
+ globalFilter = Xapian::Query(Xapian::Query::OP_OR,
+ Xapian::Query("XTrole::documentation"),
+ Xapian::Query("XTrole::program"));
+ } else {
+ mainFacet = "game";
+ secondaryFacet = "interface";
+ globalFilter = Xapian::Query("XTrole::program");
+ }
+}
Added: software/gofind/field.h
===================================================================
--- software/gofind/field.h (rev 0)
+++ software/gofind/field.h 2008-11-18 02:17:48 UTC (rev 8432)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2008 Miriam Ruiz <little_miry at yahoo.es>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _GOFIND_FIELD_H
+#define _GOFIND_FIELD_H
+
+#include <xapian.h>
+#include <string>
+
+class SearchField
+{
+public:
+ SearchField();
+ ~SearchField();
+
+ void SetTemplate(std::string &id);
+
+ std::string &GetMainFacet();
+ std::string &GetSecondaryFacet();
+ Xapian::Query &GetFilter();
+
+protected:
+ std::string mainFacet;
+ std::string secondaryFacet;
+ Xapian::Query globalFilter;
+};
+
+#endif // _GOFIND_FIELD_H
Modified: software/gofind/gofind.cpp
===================================================================
--- software/gofind/gofind.cpp 2008-11-18 01:27:14 UTC (rev 8431)
+++ software/gofind/gofind.cpp 2008-11-18 02:17:48 UTC (rev 8432)
@@ -443,9 +443,8 @@
printResults(engine);
*/
- gui->Comment(_("System running"));
gui->Go(engine);
- gui->Comment(_("Stopping system"));
+
delete gui;
return 0;
} catch (wibble::exception::BadOption& e) {
Modified: software/gofind/gui_cli.cpp
===================================================================
--- software/gofind/gui_cli.cpp 2008-11-18 01:27:14 UTC (rev 8431)
+++ software/gofind/gui_cli.cpp 2008-11-18 02:17:48 UTC (rev 8432)
@@ -82,7 +82,7 @@
vsprintf(str + strlen(str), szFormat, arglist);
va_end(arglist);
- std::cout << "##" << str << std::endl;
+ std::cout << "# " << str << std::endl;
}
bool GUIPlugInCLI::Go(Engine &engine)
@@ -91,6 +91,8 @@
bool run = true;
+ out << "# System running" << std::endl;
+
struct slre_pattern pattern[5];
const char *pattern_text[5];
const char pattern_type[] = { 'h', 'l', 'g', 's', '\0' };
@@ -257,7 +259,7 @@
}
}
break;
- case 'p':
+ case 's':
{
}
break;
@@ -265,6 +267,8 @@
break;
}
}
+
+ out << "# Stopping system" << std::endl;
return true;
}
More information about the Pkg-games-commits
mailing list