|
a/src/rcldb/searchdata.h |
|
b/src/rcldb/searchdata.h |
|
... |
|
... |
71 |
|
71 |
|
72 |
*/
|
72 |
*/
|
73 |
class SearchData {
|
73 |
class SearchData {
|
74 |
public:
|
74 |
public:
|
75 |
SearchData(SClType tp)
|
75 |
SearchData(SClType tp)
|
76 |
: m_tp(tp), m_topdirexcl(false), m_haveDates(false),
|
76 |
: m_tp(tp), m_topdirexcl(false), m_topdirweight(1.0),
|
77 |
m_haveWildCards(false)
|
77 |
m_haveDates(false), m_haveWildCards(false)
|
78 |
{
|
78 |
{
|
79 |
if (m_tp != SCLT_OR && m_tp != SCLT_AND)
|
79 |
if (m_tp != SCLT_OR && m_tp != SCLT_AND)
|
80 |
m_tp = SCLT_OR;
|
80 |
m_tp = SCLT_OR;
|
81 |
}
|
81 |
}
|
82 |
~SearchData() {erase();}
|
82 |
~SearchData() {erase();}
|
|
... |
|
... |
102 |
before toNativeQuery().
|
102 |
before toNativeQuery().
|
103 |
*/
|
103 |
*/
|
104 |
bool maybeAddAutoPhrase();
|
104 |
bool maybeAddAutoPhrase();
|
105 |
|
105 |
|
106 |
/** Set/get top subdirectory for filtering results */
|
106 |
/** Set/get top subdirectory for filtering results */
|
107 |
void setTopdir(const string& t, bool excl = false)
|
107 |
void setTopdir(const string& t, bool excl = false, float w = 1.0)
|
108 |
{
|
108 |
{
|
109 |
m_topdir = t;
|
109 |
m_topdir = t;
|
110 |
m_topdirexcl = excl;
|
110 |
m_topdirexcl = excl;
|
|
|
111 |
m_topdirweight = w;
|
111 |
}
|
112 |
}
|
112 |
|
113 |
|
113 |
/** Set date span for filtering results */
|
114 |
/** Set date span for filtering results */
|
114 |
void setDateSpan(DateInterval *dip) {m_dates = *dip; m_haveDates = true;}
|
115 |
void setDateSpan(DateInterval *dip) {m_dates = *dip; m_haveDates = true;}
|
115 |
|
116 |
|
|
... |
|
... |
145 |
vector<SearchDataClause*> m_query;
|
146 |
vector<SearchDataClause*> m_query;
|
146 |
vector<string> m_filetypes; // Restrict to filetypes if set.
|
147 |
vector<string> m_filetypes; // Restrict to filetypes if set.
|
147 |
vector<string> m_nfiletypes; // Unwanted file types
|
148 |
vector<string> m_nfiletypes; // Unwanted file types
|
148 |
string m_topdir; // Restrict to subtree.
|
149 |
string m_topdir; // Restrict to subtree.
|
149 |
bool m_topdirexcl; // Invert meaning
|
150 |
bool m_topdirexcl; // Invert meaning
|
|
|
151 |
float m_topdirweight; // affect weight instead of filter
|
150 |
bool m_haveDates;
|
152 |
bool m_haveDates;
|
151 |
DateInterval m_dates; // Restrict to date interval
|
153 |
DateInterval m_dates; // Restrict to date interval
|
152 |
// Printable expanded version of the complete query, retrieved/set
|
154 |
// Printable expanded version of the complete query, retrieved/set
|
153 |
// from rcldb after the Xapian::setQuery() call
|
155 |
// from rcldb after the Xapian::setQuery() call
|
154 |
string m_description;
|
156 |
string m_description;
|
|
... |
|
... |
165 |
public:
|
167 |
public:
|
166 |
enum Modifier {SDCM_NONE=0, SDCM_NOSTEMMING=1};
|
168 |
enum Modifier {SDCM_NONE=0, SDCM_NOSTEMMING=1};
|
167 |
|
169 |
|
168 |
SearchDataClause(SClType tp)
|
170 |
SearchDataClause(SClType tp)
|
169 |
: m_tp(tp), m_parentSearch(0), m_haveWildCards(0),
|
171 |
: m_tp(tp), m_parentSearch(0), m_haveWildCards(0),
|
170 |
m_modifiers(SDCM_NONE)
|
172 |
m_modifiers(SDCM_NONE), m_weight(1.0)
|
171 |
{}
|
173 |
{}
|
172 |
virtual ~SearchDataClause() {}
|
174 |
virtual ~SearchDataClause() {}
|
173 |
virtual bool toNativeQuery(Rcl::Db &db, void *, const string&) = 0;
|
175 |
virtual bool toNativeQuery(Rcl::Db &db, void *, const string&) = 0;
|
174 |
bool isFileName() const {return m_tp == SCLT_FILENAME ? true: false;}
|
176 |
bool isFileName() const {return m_tp == SCLT_FILENAME ? true: false;}
|
175 |
virtual string getReason() const {return m_reason;}
|
177 |
virtual string getReason() const {return m_reason;}
|
|
... |
|
... |
178 |
virtual void getUTerms(vector<string>&) const = 0;
|
180 |
virtual void getUTerms(vector<string>&) const = 0;
|
179 |
|
181 |
|
180 |
SClType getTp() {return m_tp;}
|
182 |
SClType getTp() {return m_tp;}
|
181 |
void setParent(SearchData *p) {m_parentSearch = p;}
|
183 |
void setParent(SearchData *p) {m_parentSearch = p;}
|
182 |
virtual void setModifiers(Modifier mod) {m_modifiers = mod;}
|
184 |
virtual void setModifiers(Modifier mod) {m_modifiers = mod;}
|
183 |
|
185 |
virtual void setWeight(float w) {m_weight = w;}
|
184 |
friend class SearchData;
|
186 |
friend class SearchData;
|
185 |
|
187 |
|
186 |
protected:
|
188 |
protected:
|
187 |
string m_reason;
|
189 |
string m_reason;
|
188 |
SClType m_tp;
|
190 |
SClType m_tp;
|
189 |
SearchData *m_parentSearch;
|
191 |
SearchData *m_parentSearch;
|
190 |
bool m_haveWildCards;
|
192 |
bool m_haveWildCards;
|
191 |
Modifier m_modifiers;
|
193 |
Modifier m_modifiers;
|
|
|
194 |
float m_weight;
|
192 |
private:
|
195 |
private:
|
193 |
SearchDataClause(const SearchDataClause&) {}
|
196 |
SearchDataClause(const SearchDataClause&) {}
|
194 |
SearchDataClause& operator=(const SearchDataClause&) {
|
197 |
SearchDataClause& operator=(const SearchDataClause&) {
|
195 |
return *this;
|
198 |
return *this;
|
196 |
}
|
199 |
}
|