// - increase score for finding it anywhere else (optimisation)
if (!$bLastToken) {
$oSearch->iSearchRank += 5;
+ $oSearch->iNamePhrase = -1;
}
$aNewSearches[] = $oSearch;
}
) {
$oSearch = clone $this;
$oSearch->iSearchRank++;
+ $oSearch->iNamePhrase = -1;
if (strlen($oSearchTerm->sPostcode) < 4) {
$oSearch->iSearchRank += 4 - strlen($oSearchTerm->sPostcode);
}
if (!$this->sHouseNumber && $this->iOperator != Operator::POSTCODE) {
$oSearch = clone $this;
$oSearch->iSearchRank++;
+ $oSearch->iNamePhrase = -1;
$oSearch->sHouseNumber = $oSearchTerm->sToken;
+ if ($this->iOperator != Operator::NONE) {
+ $oSearch->iSearchRank++;
+ }
// sanity check: if the housenumber is not mainly made
// up of numbers, add a penalty
if (preg_match('/\\d/', $oSearch->sHouseNumber) === 0
) {
if ($this->iOperator == Operator::NONE) {
$oSearch = clone $this;
- $oSearch->iSearchRank++;
+ $oSearch->iSearchRank += 2;
+ $oSearch->iNamePhrase = -1;
$iOp = $oSearchTerm->iOperator;
if ($iOp == Operator::NONE) {
$iOp = Operator::NEAR;
}
$oSearch->iSearchRank += 2;
+ } elseif (!$bFirstToken && !$bLastToken) {
+ $oSearch->iSearchRank += 2;
+ }
+ if ($this->sHouseNumber) {
+ $oSearch->iSearchRank++;
}
$oSearch->setPoiSearch(
if (!empty($this->aName) || !($bFirstPhrase || $sPhraseType == '')) {
if (($sPhraseType == '' || !$bFirstPhrase) && !$bHasPartial) {
$oSearch = clone $this;
+ $oSearch->iNamePhrase = -1;
$oSearch->iSearchRank += 3 * $oSearchTerm->iTermCount;
$oSearch->aAddress[$iWordID] = $iWordID;
$aNewSearches[] = $oSearch;
}
- } else {
+ } elseif (empty($this->aNameNonSearch)) {
$oSearch = clone $this;
$oSearch->iSearchRank++;
$oSearch->aName = array($iWordID => $iWordID);
}
if ((!$this->sPostcode && !$this->aAddress && !$this->aAddressNonSearch)
- && (empty($this->aName) || $this->iNamePhrase == $iPhrase)
+ && ((empty($this->aName) && empty($this->aNameNonSearch)) || $this->iNamePhrase == $iPhrase)
+ && strpos($sToken, ' ') === false
) {
$oSearch = clone $this;
$oSearch->iSearchRank++;
+ if (empty($this->aName) && empty($this->aNameNonSearch)) {
+ $oSearch->iSearchRank++;
+ }
if (preg_match('#^[0-9 ]+$#', $sToken)) {
$oSearch->iSearchRank++;
}