コード例 #1
0
ファイル: views.py プロジェクト: HackTheHearst/pahma_project
def images(request):
    """
    takes two parameters pgNum and pgSz, retrieves XML via service call, parses the XML to get
    blob and other info, builds a page to retrieve thumbnails of all images in the set.

    NB: currently the target server for the links is hardcoded here and in the showImages.html template.

    :param request: two parameters to pass to CSpace: pgNum and pgSz
    :return: page of images
    """
    #if 'keyword' in request.GET and request.GET['keyword']:
    if request.method == 'GET' and request.GET != {}:
        context = {'searchValues': request.GET}

        context = setConstants(context)

        context['text'] = request.GET['text']
        #context['pgNum'] = pgNum if 'pgNum' in context else '1'
        #context['url'] = url
        context['displayType'] = 'list'
        context['pixonly'] = 'true'
        context['title'] = TITLE

        # do search
        loginfo('start search', context, request)
        context = doSearch(SOLRSERVER, SOLRCORE, context)

        return render(request, 'showImages.html', context)

    else:
        return render(request, 'showImages.html', {'title': TITLE, 'pgNum': 10, 'maxresults': 20})
コード例 #2
0
ファイル: views.py プロジェクト: HackTheHearst/pahma_project
def images(request):
    """
    takes two parameters pgNum and pgSz, retrieves XML via service call, parses the XML to get
    blob and other info, builds a page to retrieve thumbnails of all images in the set.

    NB: currently the target server for the links is hardcoded here and in the showImages.html template.

    :param request: two parameters to pass to CSpace: pgNum and pgSz
    :return: page of images
    """
    #if 'keyword' in request.GET and request.GET['keyword']:
    if request.method == 'GET' and request.GET != {}:
        context = {'searchValues': request.GET}

        context = setConstants(context)

        context['text'] = request.GET['text']
        #context['pgNum'] = pgNum if 'pgNum' in context else '1'
        #context['url'] = url
        context['displayType'] = 'list'
        context['pixonly'] = 'true'
        context['title'] = TITLE

        # do search
        loginfo('start search', context, request)
        context = doSearch(SOLRSERVER, SOLRCORE, context)

        return render(request, 'showImages.html', context)

    else:
        return render(request, 'showImages.html', {
            'title': TITLE,
            'pgNum': 10,
            'maxresults': 20
        })
コード例 #3
0
ファイル: eloanutils.py プロジェクト: RjLi13/ucjeps_project
def build_solr_query(solr_server, solr_core, solr_queryparam_key, solr_queryparam_value):
    """
    Takes solr query information, searches against ucjeps_project publicsearch portal.


    Returns search results.

    :param solr_server:
    :param solr_core:
    :param solr_queryparam_key:
    :param solr_queryparam_value:
    :return: results:
    """
    query_dictionary = {solr_queryparam_key: solr_queryparam_value, 'displayType': 'full', 'maxresults': '2000'}
    solr_context = {'searchValues': query_dictionary}
    # from publicsearch/utils.py
    results = doSearch(solr_server, solr_core, solr_context)
    return results
コード例 #4
0
def build_solr_query(solr_server, solr_core, solr_queryparam_key,
                     solr_queryparam_value):
    """
    Takes solr query information, searches against ucjeps_project publicsearch portal.


    Returns search results.

    :param solr_server:
    :param solr_core:
    :param solr_queryparam_key:
    :param solr_queryparam_value:
    :return: results:
    """
    query_dictionary = {
        solr_queryparam_key: solr_queryparam_value,
        'displayType': 'full',
        'maxresults': '2000'
    }
    solr_context = {'searchValues': query_dictionary}
    # from publicsearch/utils.py
    results = doSearch(solr_server, solr_core, solr_context)
    return results