Allura/allura/lib/search.py
def search_artifact(atype, q, history=False, rows=10, short_timeout=False, filter=None, **kw):
    """Performs SOLR search.

    Raises SearchError if SOLR returns an error.
    """
    # first, grab an artifact and get the fields that it indexes
    a = atype.query.find().first()
    if a is None:
        return  # if there are no instance of atype, we won't find anything
    fields = a.index()
    # Now, we'll translate all the fld:
    q = atype.translate_query(q, fields)
    fq = [
        'type_s:%s' % fields['type_s'],
        'project_id_s:%s' % c.project._id,
        'mount_point_s:%s' % c.app.config.options.mount_point ]
    for name, values in (filter or {}).iteritems():
        field_name = name + '_s'
        parts = []
        for v in values:
            # Specific solr syntax for empty fields
            if v == '' or v is None:
                part = '(-%s:[* TO *] AND *:*)' % (field_name,)
            else:
                part = '%s:%s' % (field_name, escape_solr_arg(v))
            parts.append(part)
        fq.append(' OR '.join(parts))
    if not history:
        fq.append('is_history_b:False')
    return search(q, fq=fq, rows=rows, short_timeout=short_timeout, ignore_errors=False, **kw)
Performs SOLR search.

    Raises SearchError if SOLR returns an error.
    
Performs SOLR search.
Raises SearchError if SOLR returns an error.
Performs SOLR search . Raises SearchError if SOLR returns an error .
def search_artifact(atype, q, history=False, rows=10, short_timeout=False, filter=None, **kw):
    a = atype.query.find().first()
    if a is None:
        return  
    fields = a.index()
    q = atype.translate_query(q, fields)
    fq = [
        'type_s:%s' % fields['type_s'],
        'project_id_s:%s' % c.project._id,
        'mount_point_s:%s' % c.app.config.options.mount_point ]
    for name, values in (filter or {}).iteritems():
        field_name = name + '_s'
        parts = []
        for v in values:
            if v == '' or v is None:
                part = '(-%s:[* TO *] AND *:*)' % (field_name,)
            else:
                part = '%s:%s' % (field_name, escape_solr_arg(v))
            parts.append(part)
        fq.append(' OR '.join(parts))
    if not history:
        fq.append('is_history_b:False')
    return search(q, fq=fq, rows=rows, short_timeout=short_timeout, ignore_errors=False, **kw)
def search_artifact ( atype , q , history = False , rows = 10 , short_timeout = False , filter = None , ** kw ) : a = atype . query . find ( ) . first ( ) if a is None : return fields = a . index ( ) q = atype . translate_query ( q , fields ) fq = [ 'type_s:%s' % fields [ 'type_s' ] , 'project_id_s:%s' % c . project . _id , 'mount_point_s:%s' % c . app . config . options . mount_point ] for name , values in ( filter or { } ) . iteritems ( ) : field_name = name + '_s' parts = [ ] for v in values : if v == '' or v is None : part = '(-%s:[* TO *] AND *:*)' % ( field_name , ) else : part = '%s:%s' % ( field_name , escape_solr_arg ( v ) ) parts . append ( part ) fq . append ( ' OR ' . join ( parts ) ) if not history : fq . append ( 'is_history_b:False' ) return search ( q , fq = fq , rows = rows , short_timeout = short_timeout , ignore_errors = False , ** kw )
Performs SOLR search.
Performs SOLR search .
"""Performs SOLR search.

    Raises SearchError if SOLR returns an error.
    """ # first, grab an artifact and get the fields that it indexes # if there are no instance of atype, we won't find anything # Now, we'll translate all the fld: # Specific solr syntax for empty fields
atype
q
history
rows
short_timeout
filter