diff --git a/app/forms.py b/app/forms.py index 3c749ac..6083f5a 100755 --- a/app/forms.py +++ b/app/forms.py @@ -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') diff --git a/app/templates/red_link.html b/app/templates/red_link.html index 22f101d..77883b0 100755 --- a/app/templates/red_link.html +++ b/app/templates/red_link.html @@ -60,19 +60,16 @@ -
+
+
Category: {{ form.category(size=27, class="form-control") }}
-
- Year published: {{ form.year_published(size=8, class="form-control") }} -

{{ form.file }} {{ form.upload }} {{ form.wish }}
-

go back home


diff --git a/app/templates/show_book_detail.html b/app/templates/show_book_detail.html index 25ad556..056d5b0 100755 --- a/app/templates/show_book_detail.html +++ b/app/templates/show_book_detail.html @@ -63,6 +63,7 @@ + Add book to Stack ===>

download {{ book.fileformat }}
@@ -93,7 +94,7 @@
{% else %} diff --git a/app/views.py b/app/views.py index b8b9882..9548e4f 100755 --- a/app/views.py +++ b/app/views.py @@ -524,6 +524,9 @@ 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) @@ -531,8 +534,7 @@ def search_results(searchtype, query, viewby): 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'))