xapian-core  1.4.21
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  tab_entry
 Common string to integer map entry for option decoding. More...
 

Macros

#define PROG_NAME   "quest"
 
#define PROG_DESC   "Xapian command line search tool"
 
#define INDENT   " "
 The number of spaces to indent by in print_table. More...
 

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

template<typename T , std::size_t N>
static int decode (const T(&table)[N], const char *s)
 Decode a string to an integer. More...
 
template<typename T >
static char print_table (const T &table)
 Print string from a string to integer mapping table. More...
 
static void show_usage ()
 
int main (int argc, char **argv)
 

Variables

static const char *const sw []
 
static const tab_entry flag_tab []
 
static const tab_entry default_op_tab []
 
static const tab_entry wt_tab []
 

Detailed Description

Command line search tool using Xapian::QueryParser.

Definition in file quest.cc.

Macro Definition Documentation

◆ INDENT

#define INDENT   " "

The number of spaces to indent by in print_table.

This needs to match the indent in the help message in show_usage() below.

Definition at line 146 of file quest.cc.

Referenced by print_table().

◆ 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 106 of file quest.cc.

Function Documentation

◆ decode()

template<typename T , std::size_t N>
static int decode ( const T(&)  table[N],
const char *  s 
)
static

Decode a string to an integer.

Parameters
tableArray of tab_entry in ascending string order.
sThe string to decode.

Definition at line 70 of file quest.cc.

Referenced by Xapian::BitReader::decode_interpolative_next(), Xapian::BitReader::init(), and main().

◆ main()

int main ( int  argc,
char **  argv 
)

◆ print_table()

template<typename T >
static char print_table ( const T &  table)
static

Print string from a string to integer mapping table.

Parameters
tableArray of tab_entry in ascending string order.

Definition at line 155 of file quest.cc.

References INDENT.

Referenced by show_usage().

◆ show_usage()

static void show_usage ( )
static

Definition at line 173 of file quest.cc.

References print_table(), and PROG_NAME.

Referenced by main().

Variable Documentation

◆ default_op_tab

const tab_entry default_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 96 of file quest.cc.

◆ flag_tab

const tab_entry 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 78 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 tab_entry 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 124 of file quest.cc.