Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#565, #566 and minor repairs #568

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,3 @@ Learning more
* Read the online documentation at https://whoosh.readthedocs.org/en/latest/

* Join the Whoosh mailing list at http://groups.google.com/group/whoosh

* File bug reports and view the Whoosh wiki at
http://bitbucket.org/mchaput/whoosh/

Getting the source
==================

Download source releases from PyPI at http://pypi.python.org/pypi/Whoosh/

You can check out the latest version of the source code using Mercurial::

hg clone http://bitbucket.org/mchaput/whoosh

2 changes: 1 addition & 1 deletion src/whoosh/codec/whoosh3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ def _read_values(self):
vs = self._data[2]
if fixedsize is None or fixedsize < 0:
self._values = vs
elif fixedsize is 0:
elif fixedsize == 0:
self._values = (None,) * self._blocklength
else:
assert isinstance(vs, bytes_type)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def matcher(self, searcher, context=None):
c = collectors.TimeLimitCollector(c, 0.2)
with pytest.raises(searching.TimeLimit):
_ = s.search_with_collector(q, c)
assert time.time() - t < 0.5
assert time.time() - t < 0.5, 'Actual time interval: {}'.format(time.time() - t)


def test_reverse_collapse():
Expand Down
22 changes: 22 additions & 0 deletions tests/test_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,28 @@ def test_current_terms():
m.next()


def test_dismax():
schema = fields.Schema(id=fields.ID(stored=True), title=fields.TEXT, body=fields.TEXT)
ix = RamStorage().create_index(schema)

with ix.writer() as w:
w.add_document(id=u('1'), title='alfa', body='bravo')
w.add_document(id=u('1'), title='charlie', body='bravo')
w.add_document(id=u('1'), title='alfa', body='alfa')

with ix.searcher() as s:
qp = qparser.MultifieldParser(['title', 'body'], schema)
dp = qparser.DisMaxParser({"body": 1.0, "title": 2.5}, None)

query_text = u("alfa OR bravo")
qqp = qp.parse(query_text)
qdp = dp.parse(query_text)
rq = s.search(qqp, limit=1)
rd = s.search(qdp, limit=1)

assert rq[0].score < rd[0].score


def test_exclusion():
from datetime import datetime

Expand Down