If you are talking about Alfresco on-premise, there are two search engine options: SOLR and Lucene. Lucene was the default until 4.0. Now SOLR is the default (when using the binary installer). The full text of all content and all metadata properties are searchable (unless otherwise configured).
Regardless of the search engine you configure the repository to use, when you need to run a query from code you can do that using the search service. The syntax you use is up to you. The two primary options are AlfrescoFTS and CMIS Query Language. You can also use Lucene syntax (I don't recall whether or not raw Lucene syntax is supported when you have SOLR configured), but AlfrescoFTS is preferred. The repository also supports XPath queries but this is not commonly used. In older versions it was significantly slower than Lucene queries. Not sure whether or not that has changed lately.