Exemplo n.º 1
0
def search_public_fields(request):
    """Search across all public fields.

    Payload::

        {
         'q': a string to search on (optional),
         'show_shared_buildings': True to include buildings from other
             orgs in this user's org tree,
         'order_by': which field to order by (e.g. pm_property_id),
         'import_file_id': ID of an import to limit search to,
         'filter_params': { a hash of Django-like filter parameters to limit
             query.  See seed.search.filter_other_params.  If 'project__slug'
             is included and set to a project's slug, buildings will include
             associated labels for that project.
           }
         'page': Which page of results to retrieve (default: 1),
         'number_per_page': Number of buildings to retrieve per page
                            (default: 10),
        }

    Returns::

        {
         'status': 'success',
         'buildings': [
          { all fields for buildings the request user has access to;
            e.g.:
           'canonical_building': the CanonicalBuilding ID of the building,
           'pm_property_id': ID of building (from Portfolio Manager),
           'address_line_1': First line of building's address,
           'property_name': Building's name, if any
            ...
           }...
          ]
         'number_matching_search': Total number of buildings matching search,
         'number_returned': Number of buildings returned for this page
        }
    """
    from seed.views.main import _search_buildings

    _search_buildings(request)
Exemplo n.º 2
0
def search_public_fields(request):
    """Search across all public fields.

    Payload::

        {
         'q': a string to search on (optional),
         'show_shared_buildings': True to include buildings from other
             orgs in this user's org tree,
         'order_by': which field to order by (e.g. pm_property_id),
         'import_file_id': ID of an import to limit search to,
         'filter_params': { a hash of Django-like filter parameters to limit
             query.  See seed.search.filter_other_params.  If 'project__slug'
             is included and set to a project's slug, buildings will include
             associated labels for that project.
           }
         'page': Which page of results to retrieve (default: 1),
         'number_per_page': Number of buildings to retrieve per page
                            (default: 10),
        }

    Returns::

        {
         'status': 'success',
         'buildings': [
          { all fields for buildings the request user has access to;
            e.g.:
           'canonical_building': the CanonicalBuilding ID of the building,
           'pm_property_id': ID of building (from Portfolio Manager),
           'address_line_1': First line of building's address,
           'property_name': Building's name, if any
            ...
           }...
          ]
         'number_matching_search': Total number of buildings matching search,
         'number_returned': Number of buildings returned for this page
        }
    """
    from seed.views.main import _search_buildings
    _search_buildings(request)