stem expansion was never done for adv search
This commit is contained in:
parent
d110cdfae1
commit
43c3ea1104
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.35 2005-11-06 15:07:09 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.36 2005-11-14 09:56:49 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -737,12 +737,13 @@ class wsQData : public TextSplitCB {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
//
|
||||||
// Turn string into possibly complex xapian query. There is little
|
// Turn string into list of xapian queries. There is little
|
||||||
// interpretation done on the string (no +term -term or filename:term
|
// interpretation done on the string (no +term -term or filename:term
|
||||||
// stuff). We just separate words and phrases, and interpret
|
// stuff). We just separate words and phrases, and interpret
|
||||||
// capitalized terms as wanting no stem expansion
|
// capitalized terms as wanting no stem expansion. Elements of the
|
||||||
//
|
// list corresponding to a stem-expanded part are an OR query of the
|
||||||
|
// expanded elements
|
||||||
static void stringToXapianQueries(const string &iq,
|
static void stringToXapianQueries(const string &iq,
|
||||||
const string& stemlang,
|
const string& stemlang,
|
||||||
Native *ndb,
|
Native *ndb,
|
||||||
@ -797,7 +798,7 @@ static void stringToXapianQueries(const string &iq,
|
|||||||
exp.push_back(term1);
|
exp.push_back(term1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push either term or stem-expanded set
|
// Push either term or OR of stem-expanded set
|
||||||
pqueries.push_back(Xapian::Query(Xapian::Query::OP_OR,
|
pqueries.push_back(Xapian::Query(Xapian::Query::OP_OR,
|
||||||
exp.begin(), exp.end()));
|
exp.begin(), exp.end()));
|
||||||
}
|
}
|
||||||
@ -838,7 +839,8 @@ bool Rcl::Db::setQuery(const std::string &iqstring, QueryOpts opts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare query out of "advanced search" data
|
// Prepare query out of "advanced search" data
|
||||||
bool Rcl::Db::setQuery(AdvSearchData &sdata, const string& stemlang)
|
bool Rcl::Db::setQuery(AdvSearchData &sdata, QueryOpts opts,
|
||||||
|
const string& stemlang)
|
||||||
{
|
{
|
||||||
LOGDEB(("Rcl::Db::setQuery: adv:\n"));
|
LOGDEB(("Rcl::Db::setQuery: adv:\n"));
|
||||||
LOGDEB((" allwords: %s\n", sdata.allwords.c_str()));
|
LOGDEB((" allwords: %s\n", sdata.allwords.c_str()));
|
||||||
@ -863,7 +865,7 @@ bool Rcl::Db::setQuery(AdvSearchData &sdata, const string& stemlang)
|
|||||||
Xapian::Query xq;
|
Xapian::Query xq;
|
||||||
|
|
||||||
if (!sdata.allwords.empty()) {
|
if (!sdata.allwords.empty()) {
|
||||||
stringToXapianQueries(sdata.allwords, stemlang, ndb, pqueries);
|
stringToXapianQueries(sdata.allwords, stemlang, ndb, pqueries, opts);
|
||||||
if (!pqueries.empty()) {
|
if (!pqueries.empty()) {
|
||||||
xq = Xapian::Query(Xapian::Query::OP_AND, pqueries.begin(),
|
xq = Xapian::Query(Xapian::Query::OP_AND, pqueries.begin(),
|
||||||
pqueries.end());
|
pqueries.end());
|
||||||
@ -872,7 +874,7 @@ bool Rcl::Db::setQuery(AdvSearchData &sdata, const string& stemlang)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!sdata.orwords.empty()) {
|
if (!sdata.orwords.empty()) {
|
||||||
stringToXapianQueries(sdata.orwords, stemlang, ndb, pqueries);
|
stringToXapianQueries(sdata.orwords, stemlang, ndb, pqueries, opts);
|
||||||
if (!pqueries.empty()) {
|
if (!pqueries.empty()) {
|
||||||
Xapian::Query nq;
|
Xapian::Query nq;
|
||||||
nq = Xapian::Query(Xapian::Query::OP_OR, pqueries.begin(),
|
nq = Xapian::Query(Xapian::Query::OP_OR, pqueries.begin(),
|
||||||
@ -883,6 +885,7 @@ bool Rcl::Db::setQuery(AdvSearchData &sdata, const string& stemlang)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We do no stem expansion on 'No' words. Should we ?
|
||||||
if (!sdata.nowords.empty()) {
|
if (!sdata.nowords.empty()) {
|
||||||
stringToXapianQueries(sdata.nowords, stemlang, ndb, pqueries);
|
stringToXapianQueries(sdata.nowords, stemlang, ndb, pqueries);
|
||||||
if (!pqueries.empty()) {
|
if (!pqueries.empty()) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#ifndef _DB_H_INCLUDED_
|
#ifndef _DB_H_INCLUDED_
|
||||||
#define _DB_H_INCLUDED_
|
#define _DB_H_INCLUDED_
|
||||||
/* @(#$Id: rcldb.h,v 1.16 2005-11-05 14:40:50 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: rcldb.h,v 1.17 2005-11-14 09:56:49 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
@ -112,7 +112,8 @@ class Db {
|
|||||||
enum QueryOpts {QO_NONE=0, QO_STEM = 1};
|
enum QueryOpts {QO_NONE=0, QO_STEM = 1};
|
||||||
bool setQuery(const string &q, QueryOpts opts = QO_NONE,
|
bool setQuery(const string &q, QueryOpts opts = QO_NONE,
|
||||||
const string& stemlang = "english");
|
const string& stemlang = "english");
|
||||||
bool setQuery(AdvSearchData &q, const string& stemlang = "english");
|
bool setQuery(AdvSearchData &q, QueryOpts opts = QO_NONE,
|
||||||
|
const string& stemlang = "english");
|
||||||
bool getQueryTerms(list<string>& terms);
|
bool getQueryTerms(list<string>& terms);
|
||||||
|
|
||||||
// Get document at rank i. This is probably vastly inferior to the type
|
// Get document at rank i. This is probably vastly inferior to the type
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user