text
stringlengths
0
828
return instance"
765,"def mlt(cls, like_text, fields=None, percent_terms_to_match=None, min_term_freq=None, max_query_terms=None, stop_words=None, min_doc_freq=None, max_doc_freq=None, min_word_len=None, max_word_len=None, boost_terms=None, boost=None, analyzer=None):
'''
http://www.elasticsearch.org/guide/reference/query-dsl/mlt-query.html
More like this query find documents that are ""like"" provided text by running it against one or more fields.
> query = ElasticQuery().mlt('text like this one', fields=['post.content'])
'''
instance = cls(more_like_this={'like_text': like_text})
if fields is not None:
instance['more_like_this']['fields'] = fields
if percent_terms_to_match is not None:
instance['more_like_this']['percent_terms_to_match'] = percent_terms_to_match
if min_term_freq is not None:
instance['more_like_this']['min_term_freq'] = min_term_freq
if max_query_terms is not None:
instance['more_like_this']['max_query_terms'] = max_query_terms
if stop_words is not None:
instance['more_like_this']['stop_words'] = stop_words
if min_doc_freq is not None:
instance['more_like_this']['min_doc_freq'] = min_doc_freq
if max_doc_freq is not None:
instance['more_like_this']['max_doc_freq'] = max_doc_freq
if min_word_len is not None:
instance['more_like_this']['min_word_len'] = min_word_len
if max_word_len is not None:
instance['more_like_this']['max_word_len'] = max_word_len
if boost_terms is not None:
instance['more_like_this']['boost_terms'] = boost_terms
if boost is not None:
instance['more_like_this']['boost'] = boost
if analyzer is not None:
instance['more_like_this']['analyzer'] = analyzer
return instance"
766,"def query_string(cls,
query,
default_field=None,
default_operator=None,
analyzer=None,
allow_leading_wildcard=None,
lowercase_expanded_terms=None,
enable_position_increments=None,
fuzzy_prefix_length=None,
fuzzy_min_sim=None,
phrase_slop=None,
boost=None,
analyze_wildcard=None,
auto_generate_phrase_queries=None,
minimum_should_match=None):
'''
http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html
A query that uses a query parser in order to parse its content.
> query = ElasticQuery().query_string('this AND that OR thus', default_field='content')
'''
instance = cls(query_string={'query': query})
if default_field is not None:
instance['query_string']['default_field'] = default_field
if default_operator is not None:
instance['query_string']['default_operator'] = default_operator
if analyzer is not None:
instance['query_string']['analyzer'] = analyzer
if allow_leading_wildcard is not None:
instance['query_string']['allow_leading_wildcard'] = allow_leading_wildcard
if lowercase_expanded_terms is not None:
instance['query_string']['lowercase_expanded_terms'] = lowercase_expanded_terms
if enable_position_increments is not None:
instance['query_string']['enable_position_increments'] = enable_position_increments
if fuzzy_prefix_length is not None:
instance['query_string']['fuzzy_prefix_length'] = fuzzy_prefix_length
if fuzzy_min_sim is not None:
instance['query_string']['fuzzy_min_sim'] = fuzzy_min_sim
if phrase_slop is not None:
instance['query_string']['phrase_slop'] = phrase_slop
if boost is not None:
instance['query_string']['boost'] = boost
if analyze_wildcard is not None:
instance['query_string']['analyze_wildcard'] = analyze_wildcard
if auto_generate_phrase_queries is not None:
instance['query_string']['auto_generate_phrase_queries'] = auto_generate_phrase_queries
if minimum_should_match is not None:
instance['query_string']['minimum_should_match'] = minimum_should_match
return instance"
767,"def an_text_url(identifiant, code):
""""""
Port of the PHP function used by the National Assembly:
public function urlOpaque($identifiant, $codeType = NULL)
{
$datas = array(
'PRJL' => array('repertoire' => 'projets', 'prefixe' => 'pl', 'suffixe' => ''),
'PION' => array('repertoire' => 'propositions', 'prefixe' => 'pion', 'suffixe' => ''),
'PNRECOMENQ' => array('repertoire' => 'propositions', 'prefixe' => 'pion', 'suffixe' => ''),
'PNREAPPART341' => array('repertoire' => 'propositions', 'prefixe' => 'pion', 'suffixe' => ''),
'PNREMODREGLTAN' => array('repertoire' => 'propositions', 'prefixe' => 'pion', 'suffixe' => ''),
'AVCE' => array('repertoire' => 'projets', 'prefixe' => 'pl', 'suffixe' => '-ace'),
'ETDI' => array('repertoire' => 'projets', 'prefixe' => 'pl', 'suffixe' => '-ei'),
'ACIN' => array('repertoire' => 'projets', 'prefixe' => 'pl', 'suffixe' => '-ai'),
'LETT' => array('repertoire' => 'projets', 'prefixe' => 'pl', 'suffixe' => '-l'),
'PNRETVXINSTITEUROP' => array('repertoire' => 'europe/resolutions', 'prefixe' => 'ppe', 'suffixe' => ''),