r4876 - in software/ui: . src
Enrico Zini
enrico at alioth.debian.org
Sun Dec 9 12:13:21 UTC 2007
Author: enrico
Date: 2007-12-09 12:13:21 +0000 (Sun, 09 Dec 2007)
New Revision: 4876
Modified:
software/ui/
software/ui/src/Engine.cpp
Log:
Get all the results out of Xapian
Property changes on: software/ui
___________________________________________________________________
Name: bzr:revision-info
- timestamp: 2007-12-09 11:53:26.052999973 +0000
committer: enrico at enricozini.org
properties:
branch-nick: goplay
+ timestamp: 2007-12-09 12:11:10.914999962 +0000
committer: enrico at enricozini.org
properties:
branch-nick: goplay
Name: bzr:revision-id:v3-single-software/ui
- 108 enrico at enricozini.org-20071208200723-y4vsdj5bsmuf0uqa
109 enrico at enricozini.org-20071209105906-z4sjyyyni51a3cnj
110 enrico at enricozini.org-20071209110551-33y5jxsqejx92fq3
111 enrico at enricozini.org-20071209112332-1rf57dt9r853hdxn
112 enrico at enricozini.org-20071209113708-u77ke5c0ubb5gecl
113 enrico at enricozini.org-20071209113759-tc79y911o01c01rb
114 enrico at enricozini.org-20071209115326-qm81khq7dslw4o63
+ 108 enrico at enricozini.org-20071208200723-y4vsdj5bsmuf0uqa
109 enrico at enricozini.org-20071209105906-z4sjyyyni51a3cnj
110 enrico at enricozini.org-20071209110551-33y5jxsqejx92fq3
111 enrico at enricozini.org-20071209112332-1rf57dt9r853hdxn
112 enrico at enricozini.org-20071209113708-u77ke5c0ubb5gecl
113 enrico at enricozini.org-20071209113759-tc79y911o01c01rb
114 enrico at enricozini.org-20071209115326-qm81khq7dslw4o63
115 enrico at enricozini.org-20071209121110-51l0kx2mq9hi3984
Modified: software/ui/src/Engine.cpp
===================================================================
--- software/ui/src/Engine.cpp 2007-12-09 12:13:20 UTC (rev 4875)
+++ software/ui/src/Engine.cpp 2007-12-09 12:13:21 UTC (rev 4876)
@@ -133,16 +133,22 @@
Xapian::Enquire enquire(m_textsearch.db());
enquire.set_query(makeQuery());
- // Get the 1000 top matche (increase if some are still left out)s
- Xapian::MSet matches = enquire.get_mset(0, 1000, 0, 0, &md);
- for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
+ // Get all the results out of Xapian
+ bool done = false;
+ for (size_t pos = 0; !done; pos += 50)
{
- // Get all the game and interface tags in the result set
- set<Tag> tags = m_debtags.getTagsOfItem(i.get_document().get_data());
- for (set<Tag>::const_iterator j = tags.begin();
- j != tags.end(); ++j)
- if (j->facet().name() == "game")
- m_types.insert(*j);
+ Xapian::MSet matches = enquire.get_mset(pos, 50, 0, 0, &md);
+ if (matches.size() < 50)
+ done = true;
+ for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
+ {
+ // Get all the game and interface tags in the result set
+ set<Tag> tags = m_debtags.getTagsOfItem(i.get_document().get_data());
+ for (set<Tag>::const_iterator j = tags.begin();
+ j != tags.end(); ++j)
+ if (j->facet().name() == "game")
+ m_types.insert(*j);
+ }
}
m_filter_type = tmp;
} else {
@@ -158,16 +164,22 @@
Xapian::Enquire enquire(m_textsearch.db());
enquire.set_query(makeQuery());
- // Get the 1000 top matche (increase if some are still left out)s
- Xapian::MSet matches = enquire.get_mset(0, 1000, 0, 0, &md);
- for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
+ // Get all the results out of Xapian
+ bool done = false;
+ for (size_t pos = 0; !done; pos += 50)
{
- // Get all the game and interface tags in the result set
- set<Tag> tags = m_debtags.getTagsOfItem(i.get_document().get_data());
- for (set<Tag>::const_iterator j = tags.begin();
- j != tags.end(); ++j)
- if (j->facet().name() == "interface")
- m_interfaces.insert(*j);
+ Xapian::MSet matches = enquire.get_mset(pos, 50, 0, 0, &md);
+ if (matches.size() < 50)
+ done = true;
+ for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
+ {
+ // Get all the game and interface tags in the result set
+ set<Tag> tags = m_debtags.getTagsOfItem(i.get_document().get_data());
+ for (set<Tag>::const_iterator j = tags.begin();
+ j != tags.end(); ++j)
+ if (j->facet().name() == "interface")
+ m_interfaces.insert(*j);
+ }
}
m_filter_iface = tmp;
} else {
@@ -180,39 +192,45 @@
//cerr << " filter query: " << enquire.get_query().get_description() << endl;
- // Get the 1000 top matches (increase if some are still left out)
- Xapian::MSet matches = enquire.get_mset(0, 1000, 0, 0, &md);
- for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
+ // Get all the results out of Xapian
+ bool done = false;
+ for (size_t pos = 0; !done; pos += 50)
{
- // Stop producing if the quality goes below a cutoff point
- // FIXME: hardcoded value, but I can't see a reason to make it
- // configurable yet
- // FIXME: can be done adaptive, and can be done using set_cutoff in the
- // enquire
- //if (i.get_percent() < 40)
- //break;
+ Xapian::MSet matches = enquire.get_mset(pos, 50, 0, 0, &md);
+ if (matches.size() < 50)
+ done = true;
+ for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
+ {
+ // Stop producing if the quality goes below a cutoff point
+ // FIXME: hardcoded value, but I can't see a reason to make it
+ // configurable yet
+ // FIXME: can be done adaptive, and can be done using set_cutoff in the
+ // enquire
+ //if (i.get_percent() < 40)
+ //break;
- Result res;
- res.name = i.get_document().get_data();
- res.popcon = m_popcon[res.name];
- res.relevance = i.get_percent();
+ Result res;
+ res.name = i.get_document().get_data();
+ res.popcon = m_popcon[res.name];
+ res.relevance = i.get_percent();
- if (res.popcon > m_res_max)
- m_res_max = res.popcon;
+ if (res.popcon > m_res_max)
+ m_res_max = res.popcon;
- m_results.push_back(res);
+ m_results.push_back(res);
- // Get all the game and interface tags in the result set
- // only for type or filter when they are not set
- if (!m_filter_type.valid() || !m_filter_iface.valid())
- {
- set<Tag> tags = m_debtags.getTagsOfItem(res.name);
- for (set<Tag>::const_iterator j = tags.begin();
- j != tags.end(); ++j)
- if (!m_filter_type.valid() && j->facet().name() == "game")
- m_types.insert(*j);
- else if (!m_filter_iface.valid() && j->facet().name() == "interface")
- m_interfaces.insert(*j);
+ // Get all the game and interface tags in the result set
+ // only for type or filter when they are not set
+ if (!m_filter_type.valid() || !m_filter_iface.valid())
+ {
+ set<Tag> tags = m_debtags.getTagsOfItem(res.name);
+ for (set<Tag>::const_iterator j = tags.begin();
+ j != tags.end(); ++j)
+ if (!m_filter_type.valid() && j->facet().name() == "game")
+ m_types.insert(*j);
+ else if (!m_filter_iface.valid() && j->facet().name() == "interface")
+ m_interfaces.insert(*j);
+ }
}
}
// Always keep the currently selected items in the lists
More information about the Pkg-games-commits
mailing list