diff --git a/asl_articles/search.py b/asl_articles/search.py index c7c4aad..9f28774 100644 --- a/asl_articles/search.py +++ b/asl_articles/search.py @@ -4,6 +4,7 @@ import os import sqlite3 import configparser import itertools +import random import tempfile import re import logging @@ -286,6 +287,10 @@ def _do_fts_search( fts_query_string, col_names, results=None ): #pylint: disabl # add the result to the list results.append( result ) + # check if we should randomize the results + if request.json and to_bool( request.json.get( "randomize" ) ): + random.shuffle( results ) + return jsonify( results ) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web/src/App.css b/web/src/App.css index b060f84..135d6d1 100644 --- a/web/src/App.css +++ b/web/src/App.css @@ -13,6 +13,7 @@ [data-reach-menu-list] { padding: 5px ; } [data-reach-menu-item] { padding: 5px ; } [data-reach-menu-item][data-selected] { background: #90caf9 ; color: black ; } +[data-reach-menu-list] .divider { height: 0 ; margin: 2px 0 ; border-top: 1px solid #aaa ; } .MuiDialogTitle-root { padding: 10px 16px 6px 16px !important ; } .MuiDialogContent-root>div { margin-bottom: 1em ; } diff --git a/web/src/App.js b/web/src/App.js index e6e0ce3..930cad7 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -73,6 +73,13 @@ export default class App extends React.Component const menu = ( + this._onSpecialSearch( "/search/tag/technique", {randomize:1} ) } + >Show technique + this._onSpecialSearch( "/search/tag/tips", {randomize:1} ) } + >Show tips +
PublisherSearchResult.onNewPublisher( this._onNewPublisher.bind(this) ) } >New publisher @@ -207,10 +214,12 @@ export default class App extends React.Component searchForArticle( article_id ) { this._onSpecialSearch( "/search/article/" + article_id ) ; } searchForAuthor( author_id ) { this._onSpecialSearch( "/search/author/" + author_id ) ; } searchForTag( tag ) { this._onSpecialSearch( "/search/tag/" + encodeURIComponent(tag) ) ; } - _onSpecialSearch( url ) { + _onSpecialSearch( url, args ) { // run the search this._searchFormRef.current.setState( { queryString: "" } ) ; - this._doSearch( url, {} ) ; + if ( ! args ) + args = {} ; + this._doSearch( url, args ) ; } _doSearch( url, args ) { // do the search