xapian-core  1.4.27
Public Member Functions | Private Attributes | List of all members
Xapian::SimpleStopper Class Reference

Simple implementation of Stopper class - this will suit most users. More...

#include <queryparser.h>

+ Inheritance diagram for Xapian::SimpleStopper:
+ Collaboration diagram for Xapian::SimpleStopper:

Public Member Functions

 SimpleStopper ()
 Default constructor. More...
 
template<class Iterator >
 SimpleStopper (Iterator begin, Iterator end)
 Initialise from a pair of iterators. More...
 
void add (const std::string &word)
 Add a single stop word. More...
 
virtual bool operator() (const std::string &term) const
 Is term a stop-word? More...
 
virtual std::string get_description () const
 Return a string describing this object. More...
 
- Public Member Functions inherited from Xapian::Stopper
 Stopper ()
 Default constructor. More...
 
virtual ~Stopper ()
 Class has virtual methods, so provide a virtual destructor. More...
 
Stopperrelease ()
 Start reference counting this object. More...
 
const Stopperrelease () const
 Start reference counting this object. More...
 
- Public Member Functions inherited from Xapian::Internal::opt_intrusive_base
 opt_intrusive_base (const opt_intrusive_base &)
 
opt_intrusive_baseoperator= (const opt_intrusive_base &)
 
 opt_intrusive_base ()
 Construct object which is initially not reference counted. More...
 
virtual ~opt_intrusive_base ()
 
void ref () const
 
void unref () const
 

Private Attributes

std::set< std::string > stop_words
 

Additional Inherited Members

- Public Attributes inherited from Xapian::Internal::opt_intrusive_base
unsigned _refs
 Reference count. More...
 
- Protected Member Functions inherited from Xapian::Internal::opt_intrusive_base
void release () const
 Start reference counting. More...
 

Detailed Description

Simple implementation of Stopper class - this will suit most users.

Definition at line 100 of file queryparser.h.

Constructor & Destructor Documentation

◆ SimpleStopper() [1/2]

Xapian::SimpleStopper::SimpleStopper ( )
inline

Default constructor.

Definition at line 105 of file queryparser.h.

◆ SimpleStopper() [2/2]

template<class Iterator >
Xapian::SimpleStopper::SimpleStopper ( Iterator  begin,
Iterator  end 
)
inline

Initialise from a pair of iterators.

Xapian includes stopword list files for many languages. You can initialise from a file like so:

std::ifstream words("stopwords/english/stop.txt");
Xapian::SimplerStopper stopper(std::istream_iterator<std::string>(words), std::istream_iterator<std::string>());

In bindings for other languages it isn't possible to pass a C++ iterator pair, so instead this constructor is wrapped to allow passing a filename.

Definition at line 121 of file queryparser.h.

Member Function Documentation

◆ add()

void Xapian::SimpleStopper::add ( const std::string &  word)
inline

Add a single stop word.

Definition at line 124 of file queryparser.h.

Referenced by DEFINE_TESTCASE().

◆ get_description()

string SimpleStopper::get_description ( ) const
virtual

Return a string describing this object.

Reimplemented from Xapian::Stopper.

Definition at line 48 of file queryparser.cc.

Referenced by DEFINE_TESTCASE().

◆ operator()()

virtual bool Xapian::SimpleStopper::operator() ( const std::string &  term) const
inlinevirtual

Is term a stop-word?

Parameters
termThe term to test.

Implements Xapian::Stopper.

Definition at line 126 of file queryparser.h.

Member Data Documentation

◆ stop_words

std::set<std::string> Xapian::SimpleStopper::stop_words
private

Definition at line 101 of file queryparser.h.


The documentation for this class was generated from the following files: