Skip to content

Commit

Permalink
Example edits.
Browse files Browse the repository at this point in the history
  • Loading branch information
coady committed Jan 24, 2020
1 parent 7bb203b commit 2a7ae49
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ html:
make -C docs $@ SPHINXOPTS=-W

pages: html
ghp-import -nm "GH pages autocommit." docs/_build/$?
ghp-import -n docs/_build/$?

check:
python3 setup.py $@ -ms
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ Read the [documentation](https://coady.github.io/lupyne/).

# Installation

$ pip install lupyne[server]
```console
% pip install lupyne[server]
```

PyLucene is not `pip` installable.
* [Install](http://lucene.apache.org/pylucene/install.html) instructions
Expand All @@ -65,7 +67,9 @@ Optional server extras:
# Tests
100% branch coverage.

$ pytest [--cov]
```console
% pytest [--cov]
```

# Changes
dev
Expand Down
10 changes: 5 additions & 5 deletions docs/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
" for _ in range(facets[color]):\n",
" indexer.add(color=color)\n",
"indexer.commit()\n",
"query = engine.Query.alldocs()"
"query = Q.alldocs()"
]
},
{
Expand All @@ -430,7 +430,7 @@
"source": [
"for hits in indexer.groupby('color', query):\n",
" assert facets[hits.value] == hits.count\n",
" hit, = hits\n",
" (hit,) = hits\n",
" assert hit['color'] == hits.value"
]
},
Expand All @@ -450,7 +450,7 @@
"hits = indexer.search(query)\n",
"for hits in hits.groupby(hits.docvalues('color').__getitem__, docs=1):\n",
" assert facets[hits.value] == hits.count\n",
" hit, = hits\n",
" (hit,) = hits\n",
" assert hit['color'] == hits.value"
]
},
Expand Down Expand Up @@ -483,8 +483,8 @@
"metadata": {},
"outputs": [],
"source": [
"queries = {'additive': engine.Query.any(color=colors[:3]), 'subtractive': engine.Query.any(color=colors[3:])}\n",
"indexer.facets(query, color=queries)['color']"
"queries = {'additive': Q.any(color=colors[:3]), 'subtractive': Q.any(color=colors[3:])}\n",
"indexer.facets(query, color=queries)"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Quickstart
>>> hits = indexer.search('text:hello') # run search and return sequence of documents
>>> len(hits), hits.count # 1 hit retrieved (out of a total of 1)
(1, 1)
>>> hit, = hits
>>> (hit,) = hits
>>> hit['name'] # hits support mapping interface for their stored fields
'sample'
>>> hit.id, hit.score # plus internal doc number and score
Expand Down
2 changes: 1 addition & 1 deletion lupyne/engine/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def scores(self) -> Iterator[float]:
@property
def maxscore(self) -> float:
"""max score of present hits; not necessarily of all matches"""
return max(self.scores) if self else float('nan')
return max(self.scores, default=float('nan'))

def items(self) -> Iterator[tuple]:
"""Generate zipped ids and scores."""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
author='Aric Coady',
author_email='aric.coady@gmail.com',
url='https://github.com/coady/lupyne',
project_urls={'Documentation': 'https://lupyne.surge.sh'},
project_urls={'Documentation': 'https://coady.github.io/lupyne/'},
license='Apache Software License',
packages=['lupyne', 'lupyne.engine'],
extras_require={'server': ['cherrypy>=11', 'clients>=0.2'], 'docs': ['nbsphinx', 'jupyter']},
Expand Down

0 comments on commit 2a7ae49

Please sign in to comment.