SolrTTMServer Class Reference
[The Translate extension translation memory interface]

TTMServer backed based on Solr instance. More...

Inheritance diagram for SolrTTMServer:
Inheritance graph
[legend]
Collaboration diagram for SolrTTMServer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 __construct ($config)
 isLocalSuggestion (array $suggestion)
 Determines if the suggestion returned by this TTMServer comes from this wiki or any other wiki.
 expandLocation (array $suggestion)
 Given suggestion returned by this TTMServer, constructs fully qualified URL to the location of the translation.
 query ($sourceLanguage, $targetLanguage, $text)
 Fetches all relevant suggestions for given text.
 update (MessageHandle $handle, $targetText)
 Shovels the new translation into translation memory.
 beginBootstrap ()
 Called when starting to fill the translation memory.
 beginBatch ()
 Called before every batch (MessageGroup).
 batchInsertDefinitions (array $batch)
 Called multiple times per batch if necessary.
 batchInsertTranslations (array $batch)
 Called multiple times per batch if necessary.
 endBatch ()
 Called before every batch (MessageGroup).
 endBootstrap ()
 Do any cleanup, optimizing etc.
 getSolarium ()

Public Attributes

const COMMIT_WITHIN = 5000
 In case auto-commit is not enabled, or even if it is, tell solr to commit before this time has passed, in milliseconds.

Protected Member Functions

 doQuery ($sourceLanguage, $targetLanguage, $text)
 createDocument (MessageHandle $handle, $text, $revId)

Protected Attributes

 $client
 $updates
 $revIds

Detailed Description

TTMServer backed based on Solr instance.

Depends on Solarium.

Since:
2012-06-27

Definition at line 17 of file SolrTTMServer.php.


Constructor & Destructor Documentation

SolrTTMServer::__construct ( config  ) 

Reimplemented from TTMServer.

Definition at line 28 of file SolrTTMServer.php.


Member Function Documentation

SolrTTMServer::batchInsertDefinitions ( array $  batch  ) 

Called multiple times per batch if necessary.

Implements WritableTTMServer.

Definition at line 281 of file SolrTTMServer.php.

Here is the call graph for this function:

SolrTTMServer::batchInsertTranslations ( array $  batch  ) 

Called multiple times per batch if necessary.

Implements WritableTTMServer.

Definition at line 295 of file SolrTTMServer.php.

Referenced by batchInsertDefinitions().

Here is the call graph for this function:

SolrTTMServer::beginBatch (  ) 

Called before every batch (MessageGroup).

Implements WritableTTMServer.

Definition at line 277 of file SolrTTMServer.php.

SolrTTMServer::beginBootstrap (  ) 

Called when starting to fill the translation memory.

Set up necessary variables and remove old content from the server.

Implements WritableTTMServer.

Definition at line 269 of file SolrTTMServer.php.

SolrTTMServer::createDocument ( MessageHandle handle,
text,
revId 
) [protected]
See also:
schema.xml

Definition at line 247 of file SolrTTMServer.php.

Referenced by batchInsertTranslations(), and update().

Here is the call graph for this function:

SolrTTMServer::doQuery ( sourceLanguage,
targetLanguage,
text 
) [protected]
See also:
ReadableTTMServer::query

Definition at line 56 of file SolrTTMServer.php.

Referenced by query().

SolrTTMServer::endBatch (  ) 

Called before every batch (MessageGroup).

Implements WritableTTMServer.

Definition at line 307 of file SolrTTMServer.php.

SolrTTMServer::endBootstrap (  ) 

Do any cleanup, optimizing etc.

Implements WritableTTMServer.

Definition at line 312 of file SolrTTMServer.php.

SolrTTMServer::expandLocation ( array $  suggestion  ) 

Given suggestion returned by this TTMServer, constructs fully qualified URL to the location of the translation.

Parameters:
array $suggestion
Returns:
String URL

Implements ReadableTTMServer.

Definition at line 43 of file SolrTTMServer.php.

SolrTTMServer::getSolarium (  ) 

Definition at line 319 of file SolrTTMServer.php.

SolrTTMServer::isLocalSuggestion ( array $  suggestion  ) 

Determines if the suggestion returned by this TTMServer comes from this wiki or any other wiki.

Parameters:
array $suggestion
Returns:
Bool

Implements ReadableTTMServer.

Definition at line 39 of file SolrTTMServer.php.

SolrTTMServer::query ( sourceLanguage,
targetLanguage,
text 
)

Fetches all relevant suggestions for given text.

Parameters:
$sourceLanguage String: language code for the provide text
$targetLanguage String: language code for the suggestions
$text String: the text for which to search suggestions
Returns:
array List: unordered suggestions, which each has fields:
  • source: String: the original text of the suggestion
  • target: String: the suggestion
  • context: String: title of the page where the suggestion comes from
  • quality: Float: the quality of suggestion, 1 is perfect match

Implements ReadableTTMServer.

Definition at line 47 of file SolrTTMServer.php.

Here is the call graph for this function:

SolrTTMServer::update ( MessageHandle handle,
targetText 
)

Shovels the new translation into translation memory.

Use this for single updates (=after message edit). If no text is provided, entry will be removed from the translation memory.

Parameters:
MessageHandle $handle
string|null $targetText Use null to only delete.

Implements WritableTTMServer.

Definition at line 168 of file SolrTTMServer.php.

Here is the call graph for this function:


Member Data Documentation

SolrTTMServer::$client [protected]

Definition at line 24 of file SolrTTMServer.php.

SolrTTMServer::$revIds [protected]

Definition at line 26 of file SolrTTMServer.php.

SolrTTMServer::$updates [protected]

Definition at line 25 of file SolrTTMServer.php.

In case auto-commit is not enabled, or even if it is, tell solr to commit before this time has passed, in milliseconds.

Definition at line 22 of file SolrTTMServer.php.


The documentation for this class was generated from the following file:
Generated on Tue Oct 29 00:00:52 2013 for MediaWiki Translate Extension by  doxygen 1.6.3