Last active
February 2, 2018 16:29
-
-
Save dapangmao/c3945d38829114f8f5157f8b5ec4d60c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from loc.models.index import get_solr_connection | |
from loc.models.index import solr_safe_value | |
import json | |
conn = get_solr_connection() | |
my_fq = ["original-format:newspaper", "hassegments:true", 'partof_title:"yellowstone monitor. \(glendive, mont.\) 1905-1928"', 'date:[1911-01-01T00:00:00Z TO 1912-12-31T00:00:00Z]'] | |
res = conn.raw_query(fq=my_fq, wt='json', rows=1000) | |
c = json.loads(res)['response']['docs'] | |
print len(c) | |
Out[55]: 104 | |
{'content_filter': None, 'all': None, 'page_has_campaign': False, 'request_params': {}, 'item': None, 'attribute': None, 'site_id': None, 'latlong': None, 'startPage': None, 'operator': None, 'path_info': '/item/sn99065841/', 'facetLimits': '', 'port': '8082', 'index': None, 'style': None, 'clip': None, 'redirect_proxy': False, 'segments': None, 'attribute!': None, 'content_replacement': '', 'facet_count': None, 'id': u'sn99065841/', 'is_portal': None, 'field': None, 'newSearch': None, 'sortOrder': None, 'searchIn': None, 'facetPrefix': None, 'scheme': 'http', 'display_level': None, 'method': 'GET', 'api_version': '1', 'iiif': False, 'onsite': False, 'release_id': 63033, 'outputEncoding': 'UTF-8', 'format': 'html', 'keys': None, 'timestamp': 1517515584.603255, 'digital_id': None, 'searchTerms': '', 'host': '127.0.0.1:8082', 'ical': False, 'referer': None, 'sortBy': None, 'inputEncoding': 'UTF-8', 'resource': None, 'application_version': '$Revision: 63033 $', 'site_type': None, 'suggested': None, 'distance': None, 'dates': None, 'proxypath': None, 'target': None, [01/Feb/2018 15:06:24] "GET /static/images/beacon.gif?rt_tstart=1517515536857&rt_bstart=1517515538765&rt_end=1517515584530&rt_quit=&vis_st=visible&ua_plt=MacIntel&ua_vnd=Google%20Inc. HTTP/1.1" 200 807 | |
'language': None, 'facet_style': None, 'count': None, 'app_context': None, 'excludeTerms': None, 'callback': None, 'query_string': '', 'portal': None, 'embed': None, 'page': None, 'resource_sequence': None} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
{u'location_county': [u'knox'], u'access_restricted': False, u'site': [u'catalog'], u'original_format': [u'newspaper'], u'partof_title': [u"brownlow's knoxville whig. (knoxville, tenn. :) 1868-18??"], u'publication_frequency': [u'three times a week'], u'extract_urls': [u'http://lccn.loc.gov/sn99065841#sgp/catalog'], 'id': u'http://www.loc.gov/item/sn99065841/', u'partof': [u"brownlow's knoxville whig. (knoxville, tenn. :) 1868-18??", u'catalog'], u'subject': [u'knox', u'knox county (tenn.)', u'knoxville', u'knoxville (tenn.)', u'newspapers', u'tennessee', u'united states'], 'index': 1, u'group': [u'sgp/catalog', u'newspaper-catalog'], u'location_country': [u'united states'], u'title': u"Brownlow's Knoxville Whig.", u'score': 11.667542, u'location': [u'knox', u'knox county', u'knoxville', u'tennessee', u'united states'], u'version': 1589335131539111936L, u'digitized': True, u'location_city': [u'knoxville'], u'description': [u'Three times a week Vol. 1, no. 1 (July 18, 1868)- Archived issues are available in digital format as part of the Library of Congress Chronicling America online collection.'], u'timestamp': datetime.datetime(2018, 1, 11, 22, 1, 35, 46000, tzinfo=<solr.core.UTC object at 0x10c6ff610>), 'campaigns': [], 'extract_timestamp': datetime.datetime(2018, 1, 11, 14, 19, 5, 920000, tzinfo=<solr.core.UTC object at 0x10c6ff610>), u'date': u'1868', u'shelf_id': u'Newspaper', u'data': u'{\n "item": {\n "source_collection": [], \n "contributors": [], \n "date": "1868", \n "created_published": [\n "Knoxville, Tenn. : Brownlow & Haws, 1868-"\n ], \n "contents": [], \n "digital_id": [], \n "call_number": [\n "Newspaper"\n ], \n "title": "Brownlow's Knoxville Whig.", \n "related_items": [], \n "subjects": [\n "Knoxville (Tenn.)--Newspapers", \n "Knox County (Tenn.)--Newspapers", \n "United States--Tennessee--Knox--Knoxville"\n ], \n "location": [\n "Knoxville (Tenn.)", \n "Knox County (Tenn.)"\n ], \n "rights_advisory": [], \n "medium": [\n "v."\n ], \n "reproduction_number": [], \n "repository": [], \n "format": [\n "newspaper"\n ], \n "genre": [], \n "other_title": [\n "Tri-weekly Whig", \n "Knoxville Whig"\n ], \n "language": [\n "eng"\n ], \n "notes": [\n "Three times a week", \n "Vol. 1, no. 1 (July 18, 1868)-", \n "Archived issues are available in digital format as part of the Library of Congress Chronicling America online collection."\n ], \n "summary": [], \n "access_advisory": []\n }, \n "resources": []\n}', 'other_title': [u'Tri-weekly Whig', u'Knoxville Whig'], u'location_state': [u'tennessee'], u'dates': [[1868, 1899]], u'language': [u'english'], u'url': u'//localhost:8082/item/sn99065841/', u'hassegments': False, 'image_url': [], u'aka': [u'http://www.loc.gov/item/sn99065841/', u'http://lccn.loc.gov/sn99065841']}