xapian-core  2.0.0
Classes | Macros | Functions | Variables
xapian-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 "stringutils.h"
+ Include dependency graph for xapian-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   "xapian-quest"
 
#define PROG_DESC   "Xapian command line search tool"
 
#define INDENT   " "
 The number of spaces to indent by in print_table. More...
 

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 strings from a string to integer mapping table. More...
 
static char print_stemmers ()
 Print available stemmers, line wrapped. More...
 
template<typename T >
static void list_table (const T &table)
 List strings from a string to integer mapping table, one per line. 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 stem_strategy_tab []
 

Detailed Description

Command line search tool using Xapian::QueryParser.

Definition in file xapian-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 125 of file xapian-quest.cc.

◆ PROG_DESC

#define PROG_DESC   "Xapian command line search tool"

Definition at line 37 of file xapian-quest.cc.

◆ PROG_NAME

#define PROG_NAME   "xapian-quest"

Definition at line 36 of file xapian-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 xapian-quest.cc.

References p.

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

◆ list_table()

template<typename T >
static void list_table ( const T &  table)
static

List strings from a string to integer mapping table, one per line.

Parameters
tableArray of tab_entry in ascending string order.

Definition at line 183 of file xapian-quest.cc.

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

◆ print_stemmers()

static char print_stemmers ( )
static

Print available stemmers, line wrapped.

Definition at line 154 of file xapian-quest.cc.

References Xapian::Stem::get_available_languages(), INDENT, p, and pos.

Referenced by show_usage().

◆ print_table()

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

Print strings from a string to integer mapping table.

Parameters
tableArray of tab_entry in ascending string order.

Definition at line 134 of file xapian-quest.cc.

References INDENT, and pos.

Referenced by show_usage().

◆ show_usage()

static void show_usage ( )
static

Definition at line 190 of file xapian-quest.cc.

References default_op_tab, flag_tab, print_stemmers(), print_table(), PROG_NAME, and stem_strategy_tab.

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 },
}
@ OP_MAX
Pick the maximum weight of any subquery.
Definition: query.h:249
@ OP_NEAR
Match only documents where all subqueries match near each other.
Definition: query.h:140
@ OP_ELITE_SET
Pick the best N subqueries and combine with OP_OR.
Definition: query.h:215
@ OP_AND
Match only documents which all subqueries match.
Definition: query.h:84
@ OP_OR
Match documents which at least one subquery matches.
Definition: query.h:92
@ OP_PHRASE
Match only documents where all subqueries match near and in order.
Definition: query.h:152
@ OP_SYNONYM
Match like OP_OR but weighting as if a single term.
Definition: query.h:239

Definition at line 103 of file xapian-quest.cc.

Referenced by main(), and show_usage().

◆ flag_tab

const tab_entry flag_tab[]
static
Initial value:
= {
{ "auto_multiword_synonyms", Xapian::QueryParser::FLAG_AUTO_MULTIWORD_SYNONYMS },
{ "no_proper_noun_heuristic", Xapian::QueryParser::FLAG_NO_PROPER_NOUN_HEURISTIC },
}
@ FLAG_LOVEHATE
Support + and -.
Definition: queryparser.h:530
@ FLAG_AUTO_SYNONYMS
Enable automatic use of synonyms for single terms.
Definition: queryparser.h:604
@ FLAG_AUTO_MULTIWORD_SYNONYMS
Enable automatic use of synonyms for single terms and groups of terms.
Definition: queryparser.h:611
@ FLAG_NGRAMS
Generate n-grams for scripts without explicit word breaks.
Definition: queryparser.h:635
@ FLAG_ACCUMULATE
Accumulate unstem and stoplist results.
Definition: queryparser.h:726
@ FLAG_CJK_NGRAM
Generate n-grams for scripts without explicit word breaks.
Definition: queryparser.h:644
@ FLAG_DEFAULT
The default flags.
Definition: queryparser.h:784
@ FLAG_WILDCARD_GLOB
Enable glob-style wildcarding.
Definition: queryparser.h:699
@ FLAG_NO_PROPER_NOUN_HEURISTIC
Turn off special handling of capitalised words.
Definition: queryparser.h:775
@ FLAG_FUZZY
Support fuzzy matching.
Definition: queryparser.h:711
@ FLAG_WORD_BREAKS
Find word breaks for text in scripts without explicit word breaks.
Definition: queryparser.h:658
@ FLAG_BOOLEAN_ANY_CASE
Support AND, OR, etc even if they aren't in ALLCAPS.
Definition: queryparser.h:532
@ FLAG_WILDCARD
Support wildcards.
Definition: queryparser.h:549
@ FLAG_SYNONYM
Enable synonym operator '~'.
Definition: queryparser.h:598
@ FLAG_SPELLING_CORRECTION
Enable spelling correction.
Definition: queryparser.h:592
@ FLAG_WILDCARD_MULTI
Support extended wildcard '*'.
Definition: queryparser.h:673
@ FLAG_WILDCARD_SINGLE
Support extended wildcard '?'.
Definition: queryparser.h:688
@ FLAG_PURE_NOT
Allow queries such as 'NOT apples'.
Definition: queryparser.h:556
@ FLAG_NO_POSITIONS
Produce a query which doesn't use positional information.
Definition: queryparser.h:737
@ FLAG_PHRASE
Support quoted phrases.
Definition: queryparser.h:528
@ FLAG_PARTIAL
Enable partial matching.
Definition: queryparser.h:577
@ FLAG_BOOLEAN
Support AND, OR, etc and bracketed subexpressions.
Definition: queryparser.h:526

Definition at line 78 of file xapian-quest.cc.

Referenced by main(), and show_usage().

◆ stem_strategy_tab

const tab_entry stem_strategy_tab[]
static

◆ 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 xapian-quest.cc.

Referenced by main().