Very frequent partial terms take too long to look up and
do not return any valuable results unless the search is
further narrowed down by an address.
private $aName = array();
/// True if the name is rare enough to force index use on name.
private $bRareName = false;
private $aName = array();
/// True if the name is rare enough to force index use on name.
private $bRareName = false;
+ /// True if the name requires to be accompanied by address terms.
+ private $bNameNeedsAddress = false;
/// List of word ids making up the address of the object.
private $aAddress = array();
/// List of word ids that appear in the name but should be ignored.
/// List of word ids making up the address of the object.
private $aAddress = array();
/// List of word ids that appear in the name but should be ignored.
+ if ($this->bNameNeedsAddress && empty($this->aAddress)) {
+ return false;
+ }
{
$this->aName[$iId] = $iId;
$this->bRareName = $bRareName;
{
$this->aName[$iId] = $iId;
$this->bRareName = $bRareName;
+ $this->bNeedsAddress = false;
* @param integer iID ID of term to add.
* @param bool bSearchable Term should be used to search for result
* (i.e. term is not a stop word).
* @param integer iID ID of term to add.
* @param bool bSearchable Term should be used to search for result
* (i.e. term is not a stop word).
+ * @param bool bNeedsAddress True if the term is too unspecific to be used
+ * in a stand-alone search without an address
+ * to narrow down the search.
* @param integer iPhraseNumber Index of phrase, where the partial term
* appears.
*/
* @param integer iPhraseNumber Index of phrase, where the partial term
* appears.
*/
- public function addPartialNameToken($iId, $bSearchable, $iPhraseNumber)
+ public function addPartialNameToken($iId, $bSearchable, $bNeedsAddress, $iPhraseNumber)
+ if (empty($this->aName)) {
+ $this->bNameNeedsAddress = $bNeedsAddress;
+ } else {
+ $this->bNameNeedsAddress |= $bNeedsAddress;
+ }
if ($bSearchable) {
$this->aName[$iId] = $iId;
} else {
if ($bSearchable) {
$this->aName[$iId] = $iId;
} else {
$oNewSearch->addPartialNameToken(
$this->iId,
$this->iSearchNameCount < CONST_Max_Word_Frequency,
$oNewSearch->addPartialNameToken(
$this->iId,
$this->iSearchNameCount < CONST_Max_Word_Frequency,
+ $this->iSearchNameCount > CONST_Search_NameOnlySearchFrequencyThreshold,
$oPosition->getPhrase()
);
$oPosition->getPhrase()
);