Meta-search Engine. More...
#include <gmetaengine.h>
Classes | |
class | Internal |
Public Member Functions | |
GMetaEngine (GSession *session, GPlugInFactory *fac) | |
virtual void | Init (void) |
virtual GSearchQuery * | BuildQuery (const R::RString query, size_t caller) |
void | Request (GSearchQuery *query, size_t caller) |
R::RCursor< GDocRef > | GetResultsByDocs (size_t caller) |
R::RCursor< GDocFragmentRanks > | GetResults (size_t caller) |
size_t | GetNbResults (size_t caller) |
virtual void | Done (void) |
virtual | ~GMetaEngine (void) |
Public Member Functions inherited from GPlugIn | |
GPlugIn (GSession *session, GPlugInFactory *fac) | |
virtual void | ApplyConfig (void) |
void | InsertParam (R::RParam *param) |
template<class T > | |
T * | FindParam (const R::RString &name) |
R::RCursor< R::RParam > | GetParams (const R::RString &cat=R::RString::Null) |
void | GetCategories (R::RContainer< R::RString, true, false > &cats) |
virtual void | CreateConfig (void) |
virtual void | Reset (void) |
GPlugInFactory * | GetFactory (void) const |
int | Compare (const GPlugIn &plugin) const |
int | Compare (const R::RString &plugin) const |
R::RString | GetName (void) const |
R::RString | GetDesc (void) const |
GSession * | GetSession (void) const |
virtual | ~GPlugIn (void) |
Protected Member Functions | |
virtual GConceptExtractor * | CreateConceptExtractor (void) |
GConceptExtractor * | GetExtractor (void) const |
virtual void | FragmentRankAdded (GDocFragmentRank *rank, GEngine *engine, size_t caller) |
virtual void | PrepareRequest (GSearchQuery *query, size_t caller) |
virtual void | RequestEngines (GSearchQuery *query, size_t caller) |
virtual void | ComputeGlobalRanking (size_t caller) |
virtual void | PostRequest (size_t caller) |
Private Member Functions | |
GDocFragmentRank * | AddResult (GDoc *doc, const GConceptRecord *rec, size_t pos, size_t spos, size_t first, size_t last, double ranking, GEngine *engine, size_t caller) |
GDocFragmentRank * | AddResult (size_t docid, const GConceptRecord *rec, size_t spos, size_t pos, size_t first, size_t last, double ranking, GEngine *engine, size_t caller) |
Private Member Functions inherited from RDownloadFile | |
RDownloadFile (void) | |
void | Download (const RURI &uri, const R::RURI &local) |
Private Member Functions inherited from RDownload | |
RDownload (void) | |
void | Download (const RURI &uri) |
RString | GetMIMEType (void) |
virtual | ~RDownload (void) |
Private Attributes | |
R::RThreadLocalStorage< Internal > | Data |
GConceptExtractor * | Extractor |
Additional Inherited Members | |
Protected Attributes inherited from GPlugIn | |
GPlugInFactory * | Factory |
GSession * | Session |
size_t | Id |
Detailed Description
Meta-search Engine.
The GMetaEngine class provides a representation for a generic meta-search engine. In practice, it manages the document fragments retrieved by the different engines. Internally, it maintains two containers:
- A container of document references, each document reference containing the document fragments retrieved.
- A global list of document fragments retrieved and ranked.
In practice, a meta-engine does the following thinks
- It calls the method PrepareRequest(GSearchQuery*). By default, it clears the old results and call GEngine::Clear(GMetaEngine*,GSearchQuery*) for each enabled engine.
- It calls the method RequestEngines(GSearchQuery*). By default, the method forwards the query passed to each enabled engine. Inheriting classes may redefine this method to adapt the query to each engine or to select specific engines. Each time a engine add a fragment as a result, the method FragmentRankAdded(GDocFragmentRank*,GEngine*) is called.
- It calls the method ComputeGlobalRanking(void) to compute a global ranking. This method should be overloaded by inheriting classes.
- The results are ranked by ascending ranking.
- It calls the method PostRequest(void). By default, this method does nothing.
See the documentation related to GPlugIn for more general information.
Constructor & Destructor Documentation
GMetaEngine | ( | GSession * | session, |
GPlugInFactory * | fac | ||
) |
Construct a meta-engine.
- Parameters
-
session Session. fac Factory.
|
virtual |
Destructor of the meta-engine.
Member Function Documentation
|
virtual |
Initialize the plug-in.
Reimplemented from GPlugIn.
|
private |
Add a fragment from a known document as result to the meta-engine. In practice, it adds an entry to the container of results.
- Parameters
-
doc Document. rec Concept record pos Position to the fragment to extract. spos Syntactic position of the fragment centre. first First concept found. last Last concept found. ranking Ranking of the document given by the engine ( ). When a ranking algorithm is associated to the engine, it will overwrite this ranking. engine Engine from which the result come. caller Identifier of the caller (for example a thread).
- Warning
- The deallocation of the record must be managed by the caller.
- Returns
- a pointer to a GDocFragmentRank.
|
private |
Add a fragment from a known document as result to the meta-engine. In practice, it adds an entry to the container of results.
- Parameters
-
docid Identifier of the document. rec Concept record pos Position to the fragment to extract. spos Syntactic position of the fragment centre. first First concept found. last Last concept found. ranking Ranking of the document given by the engine ( ). When a ranking algorithm is associated to the engine, it will overwrite this ranking. engine Engine from which the result come. caller Identifier of the caller (for example a thread).
- Warning
- The deallocation of the record must be managed by the caller.
- Returns
- a pointer to a GDocFragmentRank.
|
protectedvirtual |
Create an extractor.
- Returns
- a pointer to an extractor.
|
protected |
Get the extractor used.
- Returns
- a pointer to an extractor.
|
protectedvirtual |
Method called each time an engine adds a given document fragment as a result. By default, the method does nothing.
- Parameters
-
rank Document fragment added. engine Engine from which the result come. caller Identifier of the caller (for example a thread).
|
protectedvirtual |
Initialise the query. The containers are cleared and the method GEngine::Clear(GMetaEngine*) is called for each enabled engine.
- Parameters
-
query Query. caller Identifier of the caller (for example a thread).
|
protectedvirtual |
Send a query to the engines. By default, it is send to all enabled engines.
- Parameters
-
query Query. caller Identifier of the caller (for example a thread).
|
protectedvirtual |
This function is used to compute the global ranking for documents extracted from different search engines. Results are then sort using this global ranking
- Parameters
-
caller Identifier of the caller (for example a thread).
|
protectedvirtual |
Perform some tasks once the request was treated.
- Parameters
-
caller Identifier of the caller (for example a thread).
|
virtual |
Build a search query. By default, it creates an object of the class QSearchQuery and build it. Moreover, the stems are used to expand the query.
- Parameters
-
query String representing the query. caller Identifier of the caller (for example a thread).
- Returns
- a pointer to a QSearchQuery.
void Request | ( | GSearchQuery * | query, |
size_t | caller | ||
) |
Send a query to the meta-search engine. It call GMetaEngine::PerformRequest and order then all the document fragments.
- Parameters
-
query Query. caller Identifier of the caller (for example a thread).
R::RCursor<GDocRef> GetResultsByDocs | ( | size_t | caller | ) |
Get all the fragments retrieved by documents.
- Parameters
-
caller Identifier of the caller (for example a thread).
- Returns
- a cursor on GDocRef.
R::RCursor<GDocFragmentRanks> GetResults | ( | size_t | caller | ) |
Get all the fragments retrieved by documents.
- Parameters
-
caller Identifier of the caller (for example a thread).
- Returns
- a cursor on GDocRef.
size_t GetNbResults | ( | size_t | caller | ) |
- Returns
- the number of results.
- Parameters
-
caller Identifier of the caller (for example a thread).
|
virtual |
The method is called each time a session is closed.
Reimplemented from GPlugIn.
Member Data Documentation
|
private |
Data used to store the results.
|
private |
Extractor used.