To search within artifacts, pass the SearchQuery.SEARCH_WITHIN_ARTIFACTS_FLAG flag to the SearchQuery.setSearchModes(int) method. The artifacts that match the query will be returned by the AssetSearchResult.getMatchingArtifacts() method.
RAMAssetQueryBuilder query = (RAMAssetQueryBuilder)session.createAssetQuery("text that would be in my artifact");
query.setSearchModes(SearchQuery.SEARCH_WITHIN_ARTIFACTS_FLAG);
SearchResult result = session.getAssets(query);
AssetSearchResult[] results = result.getAssetSearchResults();
asset = (RAMAsset)results[0].getAsset();
ArtifactSearchResult[] artifactResults = results[0].getMatchingArtifacts();
RAMArtifact artifact = (RAMArtifact)artifactResults[0].getArtifact();