-
Notifications
You must be signed in to change notification settings - Fork 8
search
/search/ endpoint in SWAGGER-UI
curl -X 'GET' \ 'http://peviitorqa.go.ro/api/v0/search/?q=<string>&start=<integer>&rows=<integer>&sort=<string>' \ -H 'accept: application/json'
-
Method:
GET -
Endpoint name:
/search -
Request Parameters:
-
q– Search query string (required). -
start– The starting index for pagination. -
rows– Number of job records to retrieve per request. -
sort– Sorting criteria (e.g.,date,relevance).
-
-
Response Format:
application/json; charset=utf-8
{
"response": {
"numFound": <integer>,
"docs": [
{ "job_title": ["<array>"],
"company": ["<array>"],
"city": ["<array>"],
"remote": ["<array>"],
"job_link": ["<array>"],
"id": "<string>"
}
]
}
}-
200 OK– Request successful, returns list of companies and job counts if applicable. -
400 Bad Request– Invalid request parameters or missing required fields. -
401 Unauthorized– Authentication is required or invalid credentials. -
403 Forbidden– Access denied due to insufficient permissions. -
404 Not Found– The requested endpoint or resource does not exist. -
405 Method Not Allowed– OnlyGETrequests are supported. -
500 Internal Server Error– An unexpected error occurred on the server. -
502 Bad Gateway– The primary and fallback servers are both unreachable. -
503 Service Unavailable– The SOLR server is down or unreachable. -
507 Insufficient Storage– SOLR or API server runs out of space/memory.
{
"error": "<message>",
"code": "<number>"
}- Normalizes search parameters (e.g., removes diacritics).
- Constructs SOLR query with filters for search string, start index, row count, and sorting.
- Implements pagination using
startandrowsparameters. - Falls back to backup server if SOLR is unavailable.
-
CORS policy: Open to all (
Access-Control-Allow-Origin: *). - Rate Limits: Not implemented but recommended.
- SOLR Search Server – Required to fetch job data.
-
PHP
file_get_contentsfunction – Communicates with SOLR API.
-
SOLR Downtime: If SOLR is unavailable, API returns a
503error. - Empty Dataset: If no jobs exist, API returns "There are no jobs to display".
-
Non-negative counts:
totalandstartwill always be a non-negative integer. - Non-empty string: All fields must be non-empty.
-
No Results: Returns
404 Not foundif no jobs are found. -
Invalid Parameters: If parameters are invalid or null, API returns a
400 Bad Requesterror. -
Pagination: Managed via
startandrowsparameters. - Security Risks: No authentication currently implemented.
- To do: Add API keys.
- To do: Prevent abuse.
-
To do: Implement
security.jsonand IP whitelisting.
The objective of this project is to develop an API endpoint that allows users to search for jobs in a SOLR index. This endpoint will provide users with relevant job listings based on their search queries.
-
Functionality:
- The endpoint should accept a search query as input.
- It should return a list of job listings that match the search query.
-
Error Handling:
- The endpoint should handle errors gracefully, providing meaningful error messages to users.
- Specific error handling should include scenarios where no search query is provided or no results are found.
-
User Experience:
- The endpoint should respond quickly to ensure a seamless user experience.
- The response should include clear and relevant job listings.
-
Data Integrity:
- Ensure that the search results are accurate and relevant to the query.
- The endpoint should only return job listings that are present in the SOLR index.
-
Security:
- Implement appropriate security measures to protect user data and prevent unauthorized access to the SOLR index.
-
Scalability:
- The endpoint should be designed to handle a high volume of requests without impacting performance.
- The endpoint successfully retrieves job listings from the SOLR index based on the search query.
- The endpoint returns relevant results that match the query.
- Error messages are clear and informative for users.
- The endpoint responds within an acceptable time frame.
- The SOLR index is properly configured and populated with job data.
- Necessary infrastructure and resources are available to support the endpoint.
-
Risk: Technical issues with the SOLR index could prevent search results from being retrieved.
- Mitigation: Regularly monitor the SOLR index for errors and perform maintenance as needed.
-
Risk: High traffic could impact performance.
- Mitigation: Implement load balancing and optimize server resources to handle increased traffic.
-
Risk: Inaccurate search results could lead to poor user experience.
- Mitigation: Regularly validate the search functionality to ensure relevance and accuracy of results.