xapian-core  1.4.20
Classes | Macros | Enumerations | Functions | Variables
quest.cc File Reference

Command line search tool using Xapian::QueryParser. More...

#include <config.h>
#include <xapian.h>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include "gnu_getopt.h"
+ Include dependency graph for quest.cc:

Go to the source code of this file.

Classes

struct  qp_flag
 
struct  qp_op
 
struct  wt
 

Macros

#define PROG_NAME   "quest"
 
#define PROG_DESC   "Xapian command line search tool"
 
#define INDENT   " "
 

Enumerations

enum  {
  WEIGHT_BB2, WEIGHT_BM25, WEIGHT_BM25PLUS, WEIGHT_BOOL,
  WEIGHT_COORD, WEIGHT_DLH, WEIGHT_DPH, WEIGHT_IFB2,
  WEIGHT_INEB2, WEIGHT_INL2, WEIGHT_LM, WEIGHT_PL2,
  WEIGHT_PL2PLUS, WEIGHT_TFIDF, WEIGHT_TRAD
}
 

Functions

static bool operator< (const qp_flag &f1, const qp_flag &f2)
 
static bool operator< (const qp_op &f1, const qp_op &f2)
 
static bool operator< (const wt &f1, const wt &f2)
 
static void show_usage ()
 
static unsigned decode_qp_flag (const char *s)
 
static int decode_qp_op (const char *s)
 
static int decode_wt (const char *s)
 
int main (int argc, char **argv)
 

Variables

static const char *const sw []
 
static const qp_flag flag_tab []
 
const int n_flag_tab = sizeof(flag_tab) / sizeof(flag_tab[0])
 
static const qp_op op_tab []
 
const int n_op_tab = sizeof(op_tab) / sizeof(op_tab[0])
 
static const wt wt_tab []
 
const int n_wt_tab = sizeof(wt_tab) / sizeof(wt_tab[0])
 

Detailed Description

Command line search tool using Xapian::QueryParser.

Definition in file quest.cc.

Macro Definition Documentation

◆ INDENT

#define INDENT   " "

Referenced by show_usage().

◆ PROG_DESC

#define PROG_DESC   "Xapian command line search tool"

Definition at line 37 of file quest.cc.

Referenced by main().

◆ PROG_NAME

#define PROG_NAME   "quest"

Definition at line 36 of file quest.cc.

Referenced by main(), and show_usage().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
WEIGHT_BB2 
WEIGHT_BM25 
WEIGHT_BM25PLUS 
WEIGHT_BOOL 
WEIGHT_COORD 
WEIGHT_DLH 
WEIGHT_DPH 
WEIGHT_IFB2 
WEIGHT_INEB2 
WEIGHT_INL2 
WEIGHT_LM 
WEIGHT_PL2 
WEIGHT_PL2PLUS 
WEIGHT_TFIDF 
WEIGHT_TRAD 

Definition at line 92 of file quest.cc.

Function Documentation

◆ decode_qp_flag()

static unsigned decode_qp_flag ( const char *  s)
static

Definition at line 202 of file quest.cc.

References qp_flag::f, n_flag_tab, and qp_flag::s.

Referenced by main().

◆ decode_qp_op()

static int decode_qp_op ( const char *  s)
static

Definition at line 213 of file quest.cc.

References qp_op::f, and qp_op::s.

Referenced by main().

◆ decode_wt()

static int decode_wt ( const char *  s)
static

Definition at line 224 of file quest.cc.

References wt::f, and wt::s.

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

◆ operator<() [1/3]

static bool operator< ( const qp_flag f1,
const qp_flag f2 
)
inlinestatic

Definition at line 72 of file quest.cc.

References qp_flag::s.

◆ operator<() [2/3]

static bool operator< ( const qp_op f1,
const qp_op f2 
)
inlinestatic

Definition at line 88 of file quest.cc.

References qp_op::s.

◆ operator<() [3/3]

static bool operator< ( const wt f1,
const wt f2 
)
inlinestatic

Definition at line 130 of file quest.cc.

References wt::s.

◆ show_usage()

static void show_usage ( )
static

Definition at line 134 of file quest.cc.

References INDENT, n_flag_tab, n_op_tab, n_wt_tab, and PROG_NAME.

Referenced by main().

Variable Documentation

◆ flag_tab

const qp_flag flag_tab[]
static
Initial value:
= {
{ "auto_multiword_synonyms", Xapian::QueryParser::FLAG_AUTO_MULTIWORD_SYNONYMS },
}
Support AND, OR, etc even if they aren&#39;t in ALLCAPS.
Definition: queryparser.h:794
Produce a query which doesn&#39;t use positional information.
Definition: queryparser.h:912
Enable automatic use of synonyms for single terms and groups of terms.
Definition: queryparser.h:871
Enable partial matching.
Definition: queryparser.h:837
Support quoted phrases.
Definition: queryparser.h:790
Enable automatic use of synonyms for single terms.
Definition: queryparser.h:864
Accumulate unstem and stoplist results.
Definition: queryparser.h:901
Support AND, OR, etc and bracketed subexpressions.
Definition: queryparser.h:788
Allow queries such as &#39;NOT apples&#39;.
Definition: queryparser.h:816
Enable generation of n-grams from CJK text.
Definition: queryparser.h:886
Enable synonym operator &#39;~&#39;.
Definition: queryparser.h:858

Definition at line 53 of file quest.cc.

◆ n_flag_tab

const int n_flag_tab = sizeof(flag_tab) / sizeof(flag_tab[0])

Definition at line 70 of file quest.cc.

Referenced by decode_qp_flag(), and show_usage().

◆ n_op_tab

const int n_op_tab = sizeof(op_tab) / sizeof(op_tab[0])

Definition at line 86 of file quest.cc.

Referenced by show_usage().

◆ n_wt_tab

const int n_wt_tab = sizeof(wt_tab) / sizeof(wt_tab[0])

Definition at line 128 of file quest.cc.

Referenced by show_usage().

◆ op_tab

const qp_op op_tab[]
static
Initial value:
= {
{ "elite_set", Xapian::Query::OP_ELITE_SET },
{ "phrase", Xapian::Query::OP_PHRASE },
}
Pick the maximum weight of any subquery.
Definition: query.h:249
Pick the best N subqueries and combine with OP_OR.
Definition: query.h:215
Match only documents where all subqueries match near and in order.
Definition: query.h:152
Match like OP_OR but weighting as if a single term.
Definition: query.h:239
Match only documents which all subqueries match.
Definition: query.h:84
Match only documents where all subqueries match near each other.
Definition: query.h:140
Match documents which at least one subquery matches.
Definition: query.h:92

Definition at line 77 of file quest.cc.

◆ sw

const char* const sw[]
static
Initial value:
= {
"a", "about", "an", "and", "are", "as", "at",
"be", "by",
"en",
"for", "from",
"how",
"i", "in", "is", "it",
"of", "on", "or",
"that", "the", "this", "to",
"was", "what", "when", "where", "which", "who", "why", "will", "with"
}

Definition at line 40 of file quest.cc.

Referenced by main().

◆ wt_tab

const wt wt_tab[]
static
Initial value:
= {
{ "bb2", WEIGHT_BB2 },
{ "bm25", WEIGHT_BM25 },
{ "bm25+", WEIGHT_BM25PLUS },
{ "bool", WEIGHT_BOOL },
{ "coord", WEIGHT_COORD },
{ "dlh", WEIGHT_DLH },
{ "dph", WEIGHT_DPH },
{ "ifb2", WEIGHT_IFB2 },
{ "ineb2", WEIGHT_INEB2 },
{ "inl2", WEIGHT_INL2 },
{ "lm", WEIGHT_LM },
{ "pl2", WEIGHT_PL2 },
{ "pl2+", WEIGHT_PL2PLUS },
{ "tfidf", WEIGHT_TFIDF },
{ "trad", WEIGHT_TRAD }
}

Definition at line 111 of file quest.cc.