added outlier search category
This commit is contained in:
parent
561d38fa49
commit
aa3c461d2e
@ -76,7 +76,8 @@ class SearchForm(FlaskForm):
|
||||
('Title', 'Title'),
|
||||
('Author', 'Author'),
|
||||
('Category', 'Category'),
|
||||
('Stack', 'Stack')]
|
||||
('Stack', 'Stack'),
|
||||
('Outliers', 'Outliers')]
|
||||
select = SelectField('', choices=choices, default='All')
|
||||
search = StringField('', validators=[InputRequired()])
|
||||
grid = SubmitField('Grid')
|
||||
|
@ -60,19 +60,16 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding-left:10px; padding-bottom: 50px;">
|
||||
<div style="padding-left:10px; padding-bottom: 100px;">
|
||||
<br>
|
||||
Category: {{ form.category(size=27, class="form-control") }}
|
||||
<br>
|
||||
<br>
|
||||
Year published: {{ form.year_published(size=8, class="form-control") }}
|
||||
<br>
|
||||
<br>
|
||||
{{ form.file }}
|
||||
{{ form.upload }}
|
||||
{{ form.wish }}
|
||||
</form>
|
||||
<br>
|
||||
<p><a href="{{ url_for('home') }}" style="font-size: 9pt;">go back home</a></p>
|
||||
<br>
|
||||
</div>
|
||||
<div class= "Container" style= "border-top: dashed; border-width: 1px;">
|
||||
|
@ -93,7 +93,7 @@
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span>
|
||||
<h3>A message from the uploading librarian:</h3>
|
||||
<span style="font-style: italic;">"{{book.message or 'Happy reading.'}}" </span><br>
|
||||
<span style="font-style: italic;">"{{book.message or '...'}}" </span><br>
|
||||
<h4><a href="../uploads/{{ book.file }}"> >>>> Link to file <<<<</h4></a></div>
|
||||
</div>
|
||||
{% else %}
|
||||
|
@ -525,14 +525,16 @@ def search_results(searchtype, query, viewby):
|
||||
if searchtype== 'Stack':
|
||||
results=db.session.query(Book).join(Book.stacks).filter(Stack.stack_name.contains(query)).order_by(Book.title)
|
||||
|
||||
if searchtype== 'Outliers':
|
||||
results=Book.query.filter(Book.sameness > 50).order_by(Book.title)
|
||||
|
||||
if searchtype== 'All':
|
||||
# results=Book.query.whoosh_search(query)
|
||||
results=Book.query.filter(Book.title.contains(query))
|
||||
results=results.union(Book.query.filter(Book.category.contains(query)))
|
||||
results=results.union(Book.query.filter(Book.year_published.contains(query)))
|
||||
results=results.union(db.session.query(Book).join(Book.authors).filter(Author.author_name.contains(query)))
|
||||
results=results.union(db.session.query(Book).join(Book.stacks).filter(Stack.stack_name.contains(query)))
|
||||
results=results.union(db.session.query(Book).join(Book.stacks).filter(Stack.stack_description.contains(query))).order_by(Book.title)
|
||||
results=results.union(db.session.query(Book).join(Book.stacks).filter(Stack.stack_name.contains(query))).order_by(Book.title)
|
||||
|
||||
if results.count() == 0:
|
||||
books = Book.query.filter(Book.file.like('potential.pdf'))
|
||||
|
Loading…
Reference in New Issue
Block a user