mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
disable sorting for now
This commit is contained in:
parent
1ed9c245f5
commit
b7063b199a
@ -193,20 +193,21 @@ class DelayedQuery:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def _query_sortedby(self):
|
def _query_sortedby(self):
|
||||||
if not 'ordering' in self.query_params:
|
# if not 'ordering' in self.query_params:
|
||||||
return None, False
|
return None, False
|
||||||
|
|
||||||
o: str = self.query_params['ordering']
|
# o: str = self.query_params['ordering']
|
||||||
if o.startswith('-'):
|
# if o.startswith('-'):
|
||||||
return o[1:], True
|
# return o[1:], True
|
||||||
else:
|
# else:
|
||||||
return o, False
|
# return o, False
|
||||||
|
|
||||||
def __init__(self, searcher: Searcher, query_params, page_size):
|
def __init__(self, searcher: Searcher, query_params, page_size):
|
||||||
self.searcher = searcher
|
self.searcher = searcher
|
||||||
self.query_params = query_params
|
self.query_params = query_params
|
||||||
self.page_size = page_size
|
self.page_size = page_size
|
||||||
self.saved_results = dict()
|
self.saved_results = dict()
|
||||||
|
self.first_score = None
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
page = self[0:1]
|
page = self[0:1]
|
||||||
@ -219,7 +220,6 @@ class DelayedQuery:
|
|||||||
q, mask = self._query
|
q, mask = self._query
|
||||||
sortedby, reverse = self._query_sortedby
|
sortedby, reverse = self._query_sortedby
|
||||||
|
|
||||||
print("OY", self.page_size)
|
|
||||||
page: ResultsPage = self.searcher.search_page(
|
page: ResultsPage = self.searcher.search_page(
|
||||||
q,
|
q,
|
||||||
mask=mask,
|
mask=mask,
|
||||||
@ -233,6 +233,15 @@ class DelayedQuery:
|
|||||||
surround=50)
|
surround=50)
|
||||||
page.results.formatter = HtmlFormatter(tagname="span", between=" ... ")
|
page.results.formatter = HtmlFormatter(tagname="span", between=" ... ")
|
||||||
|
|
||||||
|
if not self.first_score and len(page.results) > 0:
|
||||||
|
self.first_score = page.results[0].score
|
||||||
|
|
||||||
|
if self.first_score:
|
||||||
|
page.results.top_n = list(map(
|
||||||
|
lambda hit: (hit[0] / self.first_score, hit[1]),
|
||||||
|
page.results.top_n
|
||||||
|
))
|
||||||
|
|
||||||
self.saved_results[item.start] = page
|
self.saved_results[item.start] = page
|
||||||
|
|
||||||
return page
|
return page
|
||||||
|
Loading…
x
Reference in New Issue
Block a user