forked from hans/Nominatim
remove special handling for reversed queries in getGroupedSearches
getGroupedSearches is guaranteed not to be called with reversed structured queries, so there is no need to have special exclusion code.
This commit is contained in:
@@ -323,7 +323,7 @@ class Geocode
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGroupedSearches($aSearches, $aPhrases, $oValidTokens, $bIsStructured)
|
public function getGroupedSearches($aSearches, $aPhrases, $oValidTokens)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Calculate all searches using oValidTokens i.e.
|
Calculate all searches using oValidTokens i.e.
|
||||||
@@ -338,7 +338,7 @@ class Geocode
|
|||||||
*/
|
*/
|
||||||
foreach ($aPhrases as $iPhrase => $oPhrase) {
|
foreach ($aPhrases as $iPhrase => $oPhrase) {
|
||||||
$aNewPhraseSearches = array();
|
$aNewPhraseSearches = array();
|
||||||
$sPhraseType = $bIsStructured ? $oPhrase->getPhraseType() : '';
|
$sPhraseType = $oPhrase->getPhraseType();
|
||||||
|
|
||||||
foreach ($oPhrase->getWordSets() as $aWordset) {
|
foreach ($oPhrase->getWordSets() as $aWordset) {
|
||||||
$aWordsetSearches = $aSearches;
|
$aWordsetSearches = $aSearches;
|
||||||
@@ -381,7 +381,7 @@ class Geocode
|
|||||||
$aNewSearches = $oCurrentSearch->extendWithPartialTerm(
|
$aNewSearches = $oCurrentSearch->extendWithPartialTerm(
|
||||||
$sToken,
|
$sToken,
|
||||||
$oSearchTerm,
|
$oSearchTerm,
|
||||||
$bIsStructured,
|
(bool) $sPhraseType,
|
||||||
$iPhrase,
|
$iPhrase,
|
||||||
$oValidTokens->get(' '.$sToken)
|
$oValidTokens->get(' '.$sToken)
|
||||||
);
|
);
|
||||||
@@ -600,10 +600,8 @@ class Geocode
|
|||||||
// Commas are used to reduce the search space by indicating where phrases split
|
// Commas are used to reduce the search space by indicating where phrases split
|
||||||
if ($this->aStructuredQuery) {
|
if ($this->aStructuredQuery) {
|
||||||
$aInPhrases = $this->aStructuredQuery;
|
$aInPhrases = $this->aStructuredQuery;
|
||||||
$bStructuredPhrases = true;
|
|
||||||
} else {
|
} else {
|
||||||
$aInPhrases = explode(',', $sQuery);
|
$aInPhrases = explode(',', $sQuery);
|
||||||
$bStructuredPhrases = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::printDebugArray('Search context', $oCtx);
|
Debug::printDebugArray('Search context', $oCtx);
|
||||||
@@ -677,7 +675,7 @@ class Geocode
|
|||||||
|
|
||||||
Debug::newSection('Search candidates');
|
Debug::newSection('Search candidates');
|
||||||
|
|
||||||
$aGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $oValidTokens, $bStructuredPhrases);
|
$aGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $oValidTokens);
|
||||||
|
|
||||||
if (!$this->aStructuredQuery) {
|
if (!$this->aStructuredQuery) {
|
||||||
// Reverse phrase array and also reverse the order of the wordsets in
|
// Reverse phrase array and also reverse the order of the wordsets in
|
||||||
@@ -688,7 +686,7 @@ class Geocode
|
|||||||
if (count($aPhrases) > 1) {
|
if (count($aPhrases) > 1) {
|
||||||
$aPhrases[count($aPhrases)-1]->invertWordSets();
|
$aPhrases[count($aPhrases)-1]->invertWordSets();
|
||||||
}
|
}
|
||||||
$aReverseGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $oValidTokens, false);
|
$aReverseGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $oValidTokens);
|
||||||
|
|
||||||
foreach ($aGroupedSearches as $aSearches) {
|
foreach ($aGroupedSearches as $aSearches) {
|
||||||
foreach ($aSearches as $aSearch) {
|
foreach ($aSearches as $aSearch) {
|
||||||
|
|||||||
Reference in New Issue
Block a user