Returns true if index contain documents with specified term.

Is used for query optimization.

@param  Zend_Search_Lucene_Index_Term $term
@return boolean
185818
public function hasTerm(Zend_Search_Lucene_Index_Term $term)
    {
        foreach ($this->_indices as $index) {
            if ($index->hasTerm($term)) {
                return true;
            }
        }

        return false;
    }
1151656
public function isKeyword($word)
    {
        if ($this->keywords === null) {
            $this->initializeKeywords();
        }

        return isset($this->keywords[strtoupper($word)]);
    }
532118
public function getTerm($term, $taxonomy = '', $parent = null)
    {
        $cacheKey = 'term_' . md5(implode('_', func_get_args()));

        if (Cache::tags('taxonomies')->has($cacheKey)) {
            return Cache::tags('taxonomies')->get($cacheKey);
        }

        if (is_int($term)) {
            if ($term == 0) {
                return false;
            }
            $query = $this->termRepository->getTermById($term, $taxonomy, $parent);
        }

        if (is_string($term)) {
            if ($term == '') {
                return false;
            }
            if ( ! empty($taxonomy)) {
                if (is_int($parent)) {
                    $query = $this->termRepository->getByNameOrSlugWithTaxonomy($term, $taxonomy, $parent);
                } else {
                    $query = $this->termRepository->getByNameOrSlugWithTaxonomy($term, $taxonomy);
                }
            } else {
                $query = $this->termRepository->getByNameOrSlug($term);
            }
        }

        if ($query) {
            Cache::tags('taxonomies')->forever($cacheKey, $query);

            return $query;
        }

        return false;

    }
515642
public function updateOrFail(Term $term)
    {
        $status = $this->update($term);

        if (is_wp_error($status)) {
            throw new QueryException("Taxonomy [{$this->slug}] could not update term.");
        }

        return $status;
    }
991711
public function contains($element)
    {
        $hashIndex = $this->hashIndex($element);

        if (array_key_exists($hashIndex, $this->_items)) {
            return true;
        }
        return false;
    }
581995
public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null)
    {
        $subResults = array();
        $segmentStartDocId = 0;

        foreach ($this->_segmentInfos as $segmentInfo) {
            $subResults[] = $segmentInfo->termDocs($term, $segmentStartDocId, $docsFilter);

            $segmentStartDocId += $segmentInfo->count();
        }

        if (count($subResults) == 0) {
            return array();
        } else if (count($subResults) == 1) {
            // Index is optimized (only one segment)
            // Do not perform array reindexing
            return reset($subResults);
        } else {
            $result = call_user_func_array('array_merge', $subResults);
        }

        return $result;
    }
1156338
public function getSearchFilters($term)
    {
        $filters = [];
        
        foreach ($this->getSearchFields() as $field) {
            $filters[$this->getSearchFilterName($field)] = $term;
        }
        
        return $filters;
    }
449896
public function countLinesContaining($term)
    {
        if (is_bool($term) || is_null($term))
            trigger_error(sprintf('%s::countLinesLike - %s input seen, which results in empty string when typecast. Please check input value.', get_class($this), gettype($term)));

        if (is_scalar($term) || (is_object($term) && method_exists($term, '__toString')))
        {
            $term = (string)$term;

            if ($term === '')
                return count($this);

            $count = 0;

            for(parent::rewind(); parent::valid(); parent::next())
            {
                if (stripos(parent::current(), $term) !== false)
                    $count++;
            }

            parent::rewind();

            return $count;
        }

        throw new \InvalidArgumentException(get_class($this).'::countLinesLike - Argument 1 expected to be castable to string, "'.gettype($term).'" seen.');
    }
776969
public function addTerm(Term $term)
    {
        if (false === $this->terms->contains($term)) {
            $this->terms->add($term);
        }

        return $this;
    }
1315922
public function searchFile(string $word) {
		$index   = $this->addFilter(new Search($word));
		$content = $this->listFiles(true);
		$this->removeFilter($index);

		return $content;
	}
165048
public function contains( $item ) {
			
			for ( $i=0; $i < $this->len; $i++ ) {
			
				if ( $this->compare( $item, $this->items[$i] ) === 0 ) {
			
					return true;
			
				}
			
			}

			return false;
		}
102422
def has_child(self, term):
        """"""
        for parent in self.children:
            if parent.item_id == term or parent.has_child(term):
                return True
        return False
745298
public function setSearchTerm($term)
    {
        if (!empty($term)) {
            $this->showTree = false;
        }

        $this->searchTerm = $term;
    }
1260914
public boolean contains(String word) {
		if(word.length()>maxLen)
			return false;
		return dict.contains(word);
	}
481887
public boolean filter(Term term) {

        if (!stop.isEmpty() && (stop.contains(term.getName()))) {
            return true;
        }

        if (!natureStop.isEmpty() && (natureStop.contains(term.natrue().natureStr))) {
            return true;
        }

        if (!regexList.isEmpty()) {
            for (Pattern stopwordPattern : regexList) {
                if (stopwordPattern.matcher(term.getName()).matches()) {
                    return true;
                }
            }
        }

        return false;
    }
1308524
public function rewrite(Zend_Search_Lucene_Interface $index)
    {
        if ($this->_term->field != null) {
            return $this;
        } else {
            include_once 'Zend/Search/Lucene/Search/Query/MultiTerm.php';
            $query = new Zend_Search_Lucene_Search_Query_MultiTerm();
            $query->setBoost($this->getBoost());

            include_once 'Zend/Search/Lucene/Index/Term.php';
            foreach ($index->getFieldNames(true) as $fieldName) {
                $term = new Zend_Search_Lucene_Index_Term($this->_term->text, $fieldName);

                $query->addTerm($term);
            }

            return $query->rewrite($index);
        }
    }
1071171
public function find($term, $fields = [])
    {
        Wildcard::setMinPrefixLength($this->minPrefixLength);
        Lucene::setResultSetLimit($this->resultsLimit);

        if (empty($fields)) {
            return [
                'results' => $this->luceneIndex->find($term),
                'query' => $term
            ];
        }

        $fieldTerms[] = new IndexTerm($term);
        foreach ($fields as $field => $fieldText) {
            $fieldTerms[] = new IndexTerm($fieldText, $field);
        }
        return [
            'results' => $this->luceneIndex->find(new MultiTerm($fieldTerms)),
            'query' => $term
        ];
    }