|
a/src/query/docseqdb.cpp |
|
b/src/query/docseqdb.cpp |
|
... |
|
... |
51 |
return m_fsdata->getDescription();
|
51 |
return m_fsdata->getDescription();
|
52 |
}
|
52 |
}
|
53 |
|
53 |
|
54 |
bool DocSequenceDb::getDoc(int num, Rcl::Doc &doc, string *sh)
|
54 |
bool DocSequenceDb::getDoc(int num, Rcl::Doc &doc, string *sh)
|
55 |
{
|
55 |
{
|
56 |
PTMutexLocker locker(o_dblock);
|
56 |
std::unique_lock<std::mutex> locker(o_dblock);
|
57 |
if (!setQuery())
|
57 |
if (!setQuery())
|
58 |
return false;
|
58 |
return false;
|
59 |
if (sh) sh->erase();
|
59 |
if (sh) sh->erase();
|
60 |
return m_q->getDoc(num, doc);
|
60 |
return m_q->getDoc(num, doc);
|
61 |
}
|
61 |
}
|
62 |
|
62 |
|
63 |
int DocSequenceDb::getResCnt()
|
63 |
int DocSequenceDb::getResCnt()
|
64 |
{
|
64 |
{
|
65 |
PTMutexLocker locker(o_dblock);
|
65 |
std::unique_lock<std::mutex> locker(o_dblock);
|
66 |
if (!setQuery())
|
66 |
if (!setQuery())
|
67 |
return false;
|
67 |
return false;
|
68 |
if (m_rescnt < 0) {
|
68 |
if (m_rescnt < 0) {
|
69 |
m_rescnt= m_q->getResCnt();
|
69 |
m_rescnt= m_q->getResCnt();
|
70 |
}
|
70 |
}
|
|
... |
|
... |
76 |
// This one only gets called to fill-up the snippets window
|
76 |
// This one only gets called to fill-up the snippets window
|
77 |
// We ignore most abstract/snippets preferences.
|
77 |
// We ignore most abstract/snippets preferences.
|
78 |
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<Rcl::Snippet>& vpabs)
|
78 |
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<Rcl::Snippet>& vpabs)
|
79 |
{
|
79 |
{
|
80 |
LOGDEB("DocSequenceDb::getAbstract/pair\n" );
|
80 |
LOGDEB("DocSequenceDb::getAbstract/pair\n" );
|
81 |
PTMutexLocker locker(o_dblock);
|
81 |
std::unique_lock<std::mutex> locker(o_dblock);
|
82 |
if (!setQuery())
|
82 |
if (!setQuery())
|
83 |
return false;
|
83 |
return false;
|
84 |
|
84 |
|
85 |
// Have to put the limit somewhere.
|
85 |
// Have to put the limit somewhere.
|
86 |
int maxoccs = 1000;
|
86 |
int maxoccs = 1000;
|
|
... |
|
... |
106 |
return true;
|
106 |
return true;
|
107 |
}
|
107 |
}
|
108 |
|
108 |
|
109 |
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<string>& vabs)
|
109 |
bool DocSequenceDb::getAbstract(Rcl::Doc &doc, vector<string>& vabs)
|
110 |
{
|
110 |
{
|
111 |
PTMutexLocker locker(o_dblock);
|
111 |
std::unique_lock<std::mutex> locker(o_dblock);
|
112 |
if (!setQuery())
|
112 |
if (!setQuery())
|
113 |
return false;
|
113 |
return false;
|
114 |
if (m_q->whatDb() &&
|
114 |
if (m_q->whatDb() &&
|
115 |
m_queryBuildAbstract && (doc.syntabs || m_queryReplaceAbstract)) {
|
115 |
m_queryBuildAbstract && (doc.syntabs || m_queryReplaceAbstract)) {
|
116 |
m_q->makeDocAbstract(doc, vabs);
|
116 |
m_q->makeDocAbstract(doc, vabs);
|
|
... |
|
... |
120 |
return true;
|
120 |
return true;
|
121 |
}
|
121 |
}
|
122 |
|
122 |
|
123 |
int DocSequenceDb::getFirstMatchPage(Rcl::Doc &doc, string& term)
|
123 |
int DocSequenceDb::getFirstMatchPage(Rcl::Doc &doc, string& term)
|
124 |
{
|
124 |
{
|
125 |
PTMutexLocker locker(o_dblock);
|
125 |
std::unique_lock<std::mutex> locker(o_dblock);
|
126 |
if (!setQuery())
|
126 |
if (!setQuery())
|
127 |
return false;
|
127 |
return false;
|
128 |
if (m_q->whatDb()) {
|
128 |
if (m_q->whatDb()) {
|
129 |
return m_q->getFirstMatchPage(doc, term);
|
129 |
return m_q->getFirstMatchPage(doc, term);
|
130 |
}
|
130 |
}
|
|
... |
|
... |
136 |
return m_q ? m_q->whatDb() : 0;
|
136 |
return m_q ? m_q->whatDb() : 0;
|
137 |
}
|
137 |
}
|
138 |
|
138 |
|
139 |
list<string> DocSequenceDb::expand(Rcl::Doc &doc)
|
139 |
list<string> DocSequenceDb::expand(Rcl::Doc &doc)
|
140 |
{
|
140 |
{
|
141 |
PTMutexLocker locker(o_dblock);
|
141 |
std::unique_lock<std::mutex> locker(o_dblock);
|
142 |
if (!setQuery())
|
142 |
if (!setQuery())
|
143 |
return list<string>();
|
143 |
return list<string>();
|
144 |
vector<string> v = m_q->expand(doc);
|
144 |
vector<string> v = m_q->expand(doc);
|
145 |
return list<string>(v.begin(), v.end());
|
145 |
return list<string>(v.begin(), v.end());
|
146 |
}
|
146 |
}
|
|
... |
|
... |
159 |
}
|
159 |
}
|
160 |
|
160 |
|
161 |
bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
|
161 |
bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
|
162 |
{
|
162 |
{
|
163 |
LOGDEB("DocSequenceDb::setFiltSpec\n" );
|
163 |
LOGDEB("DocSequenceDb::setFiltSpec\n" );
|
164 |
PTMutexLocker locker(o_dblock);
|
164 |
std::unique_lock<std::mutex> locker(o_dblock);
|
165 |
if (fs.isNotNull()) {
|
165 |
if (fs.isNotNull()) {
|
166 |
// We build a search spec by adding a filtering layer to the base one.
|
166 |
// We build a search spec by adding a filtering layer to the base one.
|
167 |
m_fsdata = STD_SHARED_PTR<Rcl::SearchData>(
|
167 |
m_fsdata = STD_SHARED_PTR<Rcl::SearchData>(
|
168 |
new Rcl::SearchData(Rcl::SCLT_AND, m_sdata->getStemLang()));
|
168 |
new Rcl::SearchData(Rcl::SCLT_AND, m_sdata->getStemLang()));
|
169 |
Rcl::SearchDataClauseSub *cl =
|
169 |
Rcl::SearchDataClauseSub *cl =
|
|
... |
|
... |
207 |
}
|
207 |
}
|
208 |
|
208 |
|
209 |
bool DocSequenceDb::setSortSpec(const DocSeqSortSpec &spec)
|
209 |
bool DocSequenceDb::setSortSpec(const DocSeqSortSpec &spec)
|
210 |
{
|
210 |
{
|
211 |
LOGDEB("DocSequenceDb::setSortSpec: fld [" << (spec.field) << "] " << (spec.desc ? "desc" : "asc") << "\n" );
|
211 |
LOGDEB("DocSequenceDb::setSortSpec: fld [" << (spec.field) << "] " << (spec.desc ? "desc" : "asc") << "\n" );
|
212 |
PTMutexLocker locker(o_dblock);
|
212 |
std::unique_lock<std::mutex> locker(o_dblock);
|
213 |
if (spec.isNotNull()) {
|
213 |
if (spec.isNotNull()) {
|
214 |
m_q->setSortBy(spec.field, !spec.desc);
|
214 |
m_q->setSortBy(spec.field, !spec.desc);
|
215 |
m_isSorted = true;
|
215 |
m_isSorted = true;
|
216 |
} else {
|
216 |
} else {
|
217 |
m_q->setSortBy(string(), true);
|
217 |
m_q->setSortBy(string(), true);
|
|
... |
|
... |
237 |
}
|
237 |
}
|
238 |
|
238 |
|
239 |
bool DocSequenceDb::docDups(const Rcl::Doc& doc, std::vector<Rcl::Doc>& dups)
|
239 |
bool DocSequenceDb::docDups(const Rcl::Doc& doc, std::vector<Rcl::Doc>& dups)
|
240 |
{
|
240 |
{
|
241 |
if (m_q->whatDb()) {
|
241 |
if (m_q->whatDb()) {
|
242 |
PTMutexLocker locker(o_dblock);
|
242 |
std::unique_lock<std::mutex> locker(o_dblock);
|
243 |
return m_q->whatDb()->docDups(doc, dups);
|
243 |
return m_q->whatDb()->docDups(doc, dups);
|
244 |
} else {
|
244 |
} else {
|
245 |
return false;
|
245 |
return false;
|
246 |
}
|
246 |
}
|
247 |
}
|
247 |
}
|