Skip to content

Commit

Permalink
Merge branch 'release/0.8.2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rlskoeser committed Feb 7, 2022
2 parents 0ffb746 + 36bb3c1 commit 069f54e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
CHANGELOG
=========

0.8.2
-----

* When subclassing ``SolrQuerySet``, result documents can now be customized by extending ``get_result_document``

0.8.1
-----
* Exclude proxy models when collecting indexable subclasses
Expand Down
2 changes: 1 addition & 1 deletion parasolr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
default_app_config = "parasolr.apps.ParasolConfig"

__version_info__ = (0, 8, 1, None)
__version_info__ = (0, 8, 2, None)

# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = ".".join([str(i) for i in __version_info__[:-1]])
Expand Down
8 changes: 6 additions & 2 deletions parasolr/query/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def get_results(self, **kwargs) -> List[dict]:
Returns:
Solr response documents as a list of dictionaries.
"""

# TODO: can we store the result cache and only retrieve
# if query options have changed?
# For now, always query.
Expand All @@ -83,9 +82,14 @@ def get_results(self, **kwargs) -> List[dict]:
self._result_cache = self.solr.query(**query_opts)
# if there is a query error, result will not be set
if self._result_cache:
return [doc.as_dict() for doc in self._result_cache.docs]
return [self.get_result_document(doc) for doc in self._result_cache.docs]
return []

def get_result_document(self, doc):
"""Method to transform document results. Default behavior is to
convert from attrdict to dict."""
return doc.as_dict()

def _set_highlighting_opts(self, query_opts: Dict) -> None:
"""Configure highlighting attributes on query_opts. Modifies
dictionary directly."""
Expand Down

0 comments on commit 069f54e

Please sign in to comment.