1
0
mirror of https://github.com/bigchaindb/bigchaindb.git synced 2024-06-28 00:27:45 +02:00

Clean up code

- Fixed docstrings
This commit is contained in:
Rodolphe Marques 2017-05-26 10:34:58 +02:00
parent 56379e9bec
commit 3819ae5d65
3 changed files with 8 additions and 7 deletions

View File

@ -371,8 +371,8 @@ def text_search(conn, search, *, language='english', case_sensitive=False,
if text_score:
return cursor
else:
return (_remove_text_score(asset) for asset in cursor)
return (_remove_text_score(asset) for asset in cursor)
def _remove_text_score(asset):

View File

@ -363,17 +363,19 @@ def text_search(conn, search, *, language='english', case_sensitive=False,
"""Return all the assets that match the text search.
The results are sorted by text score.
For more information about the behavior of text search on MongoDB see
https://docs.mongodb.com/manual/reference/operator/query/text/#behavior
Args:
search (str): Text search string to query the text index
language (str, optional): The language for the search and the rules for
stemmer and tokenizer. If the language is `None` text search uses
stemmer and tokenizer. If the language is ``None`` text search uses
simple tokenization and no stemming.
case_sensitive (bool, optional): Enable or disable case sensitive
search.
diacritic_sensitive (bool, optional): Enable or disable case sensitive
diacritic search.
text_score (bool, optional): If `True` returns the text score with
text_score (bool, optional): If ``True`` returns the text score with
each document.
limit (int, optional): Limit the number of returned documents.

View File

@ -246,9 +246,8 @@ class TestBigchainApi(object):
assets = list(b.text_search('bigchaindb'))
except OperationError as exc:
assert not isinstance(b.connection, MongoDBConnection)
return
assert len(assets) == 3
else:
assert len(assets) == 3
@pytest.mark.genesis
def test_text_search_returns_valid_only(self, monkeypatch, b):