function apachesolr_proximity_match_keywords in Apache Solr Term Proximity 7
Same name and namespace in other branches
- 6.3 apachesolr_proximity.apachesolr.inc \apachesolr_proximity_match_keywords()
Helper function that matches terms and phrases in the search query.
Parameters
string $search_query: The search query that the terms and phrases are being matched in. This is usually either the raw search query entered by the end user through the search form or a phrase matched in the search query.
Return value
array An array of matches, one per row.
2 calls to apachesolr_proximity_match_keywords()
- apachesolr_proximity_build_query in ./
apachesolr_proximity.apachesolr.inc - Builds the proximity query to be set as the "q" parameter.
- apachesolr_proximity_parse_query in ./
apachesolr_proximity.apachesolr.inc - Parses the search query into terms and phrases.
File
- ./
apachesolr_proximity.apachesolr.inc, line 146 - Implementation of Apache Solr Search Integration hooks.
Code
function apachesolr_proximity_match_keywords($search_query) {
$keywords = array();
if (preg_match_all(APACHESOLR_PROXIMITY_REGEX, ' ' . $search_query, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$keywords[] = $match[2];
}
}
return $keywords;
}