|
a/src/rcldb/searchdata.cpp |
|
b/src/rcldb/searchdata.cpp |
|
... |
|
... |
1022 |
*qp = Xapian::Query(Xapian::Query::OP_SCALE_WEIGHT, *qp, m_weight);
|
1022 |
*qp = Xapian::Query(Xapian::Query::OP_SCALE_WEIGHT, *qp, m_weight);
|
1023 |
}
|
1023 |
}
|
1024 |
return true;
|
1024 |
return true;
|
1025 |
}
|
1025 |
}
|
1026 |
|
1026 |
|
1027 |
// Translate a FILENAME search clause. This mostly (or always) comes
|
1027 |
// Translate a FILENAME search clause. This always comes
|
1028 |
// from a "filename" search from the gui or recollq. A query language
|
1028 |
// from a "filename" search from the gui or recollq. A query language
|
1029 |
// "filename:"-prefixed field will not go through here, but through
|
1029 |
// "filename:"-prefixed field will not go through here, but through
|
1030 |
// the generic field-processing code.
|
1030 |
// the generic field-processing code.
|
1031 |
//
|
1031 |
//
|
1032 |
// In the case of multiple space-separated fragments, we generate an
|
1032 |
// We do not split the entry any more (used to do some crazy thing
|
1033 |
// AND of OR queries. Each OR query comes from the expansion of a
|
1033 |
// about expanding multiple fragments in the past. We just take the
|
1034 |
// fragment. We used to generate a single OR with all expanded terms,
|
1034 |
// value blanks and all and expand this against the indexed unsplit
|
1035 |
// which did not make much sense.
|
1035 |
// file names
|
1036 |
bool SearchDataClauseFilename::toNativeQuery(Rcl::Db &db, void *p,
|
1036 |
bool SearchDataClauseFilename::toNativeQuery(Rcl::Db &db, void *p,
|
1037 |
const string&)
|
1037 |
const string&)
|
1038 |
{
|
1038 |
{
|
1039 |
Xapian::Query *qp = (Xapian::Query *)p;
|
1039 |
Xapian::Query *qp = (Xapian::Query *)p;
|
1040 |
*qp = Xapian::Query();
|
1040 |
*qp = Xapian::Query();
|
1041 |
|
1041 |
|
1042 |
vector<string> patterns;
|
|
|
1043 |
TextSplit::stringToStrings(m_text, patterns);
|
|
|
1044 |
vector<string> names;
|
1042 |
vector<string> names;
|
1045 |
for (vector<string>::iterator it = patterns.begin();
|
|
|
1046 |
it != patterns.end(); it++) {
|
|
|
1047 |
vector<string> more;
|
|
|
1048 |
db.filenameWildExp(*it, more);
|
1043 |
db.filenameWildExp(m_text, names);
|
1049 |
Xapian::Query tq = Xapian::Query(Xapian::Query::OP_OR, more.begin(),
|
1044 |
*qp = Xapian::Query(Xapian::Query::OP_OR, names.begin(), names.end());
|
1050 |
more.end());
|
1045 |
|
1051 |
*qp = qp->empty() ? tq : Xapian::Query(Xapian::Query::OP_AND, *qp, tq);
|
|
|
1052 |
}
|
|
|
1053 |
if (m_weight != 1.0) {
|
1046 |
if (m_weight != 1.0) {
|
1054 |
*qp = Xapian::Query(Xapian::Query::OP_SCALE_WEIGHT, *qp, m_weight);
|
1047 |
*qp = Xapian::Query(Xapian::Query::OP_SCALE_WEIGHT, *qp, m_weight);
|
1055 |
}
|
1048 |
}
|
1056 |
return true;
|
1049 |
return true;
|
1057 |
}
|
1050 |
}
|