aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat/search.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-10-03 14:17:50 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-10-03 14:17:50 -0700
commitc538d614819fff471cff821adfa302b563c87a2f (patch)
treee9ff1e1f736ec1400020471f79fbe2e5bad97674 /python/fatcat/search.py
parent9623cd35e5342f8ec9b6052261f4d0bc3094dedc (diff)
downloadfatcat-c538d614819fff471cff821adfa302b563c87a2f.tar.gz
fatcat-c538d614819fff471cff821adfa302b563c87a2f.zip
improve search UI
Diffstat (limited to 'python/fatcat/search.py')
-rw-r--r--python/fatcat/search.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/fatcat/search.py b/python/fatcat/search.py
index c179b12e..b6826110 100644
--- a/python/fatcat/search.py
+++ b/python/fatcat/search.py
@@ -4,13 +4,16 @@ from flask import abort
from fatcat import app
-def do_search(q, limit=20):
+def do_search(q, limit=50, fulltext_only=True):
#print("Search hit: " + q)
if limit > 100:
# Sanity check
limit = 100
+ if fulltext_only:
+ q += " file_in_ia:true"
+
search_request = {
"query": {
"query_string": {
@@ -20,11 +23,12 @@ def do_search(q, limit=20):
"analyze_wildcard": True,
"lenient": True,
"fields": ["title^5", "contrib_names^2", "container_title"]
- }
+ },
},
"size": int(limit),
}
+ #print(search_request)
resp = requests.get("%s/%s/_search" %
(app.config['ELASTIC_BACKEND'], app.config['ELASTIC_INDEX']),
json=search_request)