Skip to content
ojahagirdar edited this page Feb 23, 2022 · 20 revisions

search-as-a-service-egress-clientlib

  • Egress Refers to any access that involves an API client or resources within the service perimeter and resources outside a service perimeter.

  • Examples:

  • A Compute Engine client within a service perimeter called a Compute Engine creates an operation where the image resource is outside the perimeter. A Cloud Storage client – within or outside the perimeter – that calls a copy command where one bucket is within the perimeter and the other bucket is outside it.

  • We are creating the entity class SolrSearchResponseDTO with parameters solrDocuments.



@Data
@NoArgsConstructor
@Component
public class SolrSearchResponseDTO {

	private  Object solrDocuments;
	
	}

  • For getting a record we are using the service layer, In the service layer, there is a setUpSelectQueryAdvancedSearch method which is retrieving the record.
   @Autowired
    SolrSearchResult solrSearchResult;

   public ResponseEntity<SolrSearchResponseDTO> searchRecordsInGivenCollectionAdvanced(@PathVariable int clientId, @PathVariable String tableName,
            @RequestParam(defaultValue = "*") String queryField, @RequestParam(defaultValue = "*") String searchTerm, @RequestParam(defaultValue = "0") String startRecord,
            @RequestParam(defaultValue = "5") String pageSize, @RequestParam(defaultValue = "id") String orderBy, @RequestParam(defaultValue = "asc") String order) {
       

       
        SolrSearchResponseDTO solrSearchResponseDTO = solrSearchAdvanced.search(clientId, tableName, queryField, searchTerm, startRecord, pageSize, orderBy, order,loggersDTO);


		
        if (solrSearchResponseDTO.getStatusCode() == 200) {
        	LoggerUtils.printlogger(loggersDTO,false,false);
            return ResponseEntity.status(HttpStatus.OK).body(solrSearchResponseDTO);
        } else {
        	LoggerUtils.printlogger(loggersDTO,false,true);
            return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(solrSearchResponseDTO);
        }
    }
}

q paramerter

The query (q parameter), as the name suggests, is the main query used for searching. Example

 q = title:james

queryField(name)

The name of the field. Field names should consist of alphanumeric or underscore characters only and not start with a digit. This is not currently strictly enforced, but other field names will not have first class support from all components and back compatibility is not guaranteed. Names with both leading and trailing underscores (e.g., version) are reserved. Every field must have a name.

Example

q = title:james

in above example title is our name and james is search term

searchTerm(*)

The query (q parameter), as the name suggests, is the main query used for searching. Example

q = title:james

in search term * is default value which means wildcard search Example

jam*

startRecord(start) Specifies an offset (by default, 0) into the responses at which Solr should begin displaying content.

You can use the start parameter this way for paging. For example, if the rows parameter is set to 10, you could display three successive pages of results by setting start to 0, then re-issuing the same query and setting start to 10, then issuing the query again and setting start to 20.

pageSize(row)

You can use the rows parameter to paginate results from a query. The parameter specifies the maximum number of documents from the complete result set that Solr should return to the client at one time.

The default value is 5. That is, by default, Solr returns 5 documents at a time in response to a query.

order(Sort)

Sorts the response to a query in either ascending or descending order based on the response’s score or another specified characteristic.

Clone this wiki locally