$memory_filter
$memory_filter :array
Used to hold an in_memory cache of what search results are to be filtered
This class manages the editing of search verticals. This includes allowing one to specify a search result should be filtered from the results of a query, it also includes alterning the title and description of a result from how it is stored in a particular index and it finally includes creating, updating, deleting knowledge wiki results To handle these activities this class leverages the existing group wiki system of Yioop. Edited and filtered search results correspond to group feed entries in a Search Group. Edited knowledge wiki entries correspond to wiki entires in the Search Group.
isFiltered(string $url,boolean $compute_hash_key = false): boolean
Check if a URL is supposed to be filtered from search results.
string | $url | to see if filtered |
boolean | $compute_hash_key | flag to control hashing before computing GROUP_ITEM lookup. Sometimes $url might be already the hash of a URL to check if filtered |
whether the url should be filtered from search results or not
hashIntPair( $input,boolean $compute_hash = true)
Computes a hash value as an ordered pair of ints. Used to store filtered urls into the GROUP_ITEM table. In this situation, the ordered pair is used later for the PARENT_ID and USER_ID in the (both of which have indexes) Search group look-up.
@param string an input to be hash to a pair of integers
$input | ||
boolean | $compute_hash | flag to chheck if a crawlHash is done before converting the result to an ordered pair. In some situations the url or host of the url has already been hashed so don't want to hash it again. @return array [int, int] that corresponds to the hash of the input to keep postgres happy (no unsigned ints) we make the value of this function signed |
getKnowledgeWiki(string $query, $locale_tag, $edit_mode = false)
Get the knowledge wiki page corresponding to a search query.
This is used in wiki read mode for search result verticals or edit mode (the wiki info is not pre-parsed) for editing the knowledge wiki page.
string | $query | to get knowledge wiki results for @param string $locale the locale tag language that one want the results for @param bool $edit_mode whether the wiki page should be pre-parsed (suitable for display in query results) or left unparsed (suitable for editing). @return array knowledge wiki page info |
$locale_tag | ||
$edit_mode |
updateUrlResult(integer $id,integer $type,string $url,string $title,string $description): mixed
Updates the title and description text that will be presented when a given url appears in search results
integer | $id | if the url has been edited previous then the id of the group item with the edit. If this is 0/empty then a new group item for the edit is created. If -1 then deletes the entry |
integer | $type | either SEARCH_FILTER_GROUP_ITEM or SEARCH_EDIT_GROUP_ITEM |
string | $url | to change search result for |
string | $title | new title for search result |
string | $description | new snippet text for search result |
integer id of edited/created result or if used to delete then false
incorporateEditedPageResults(array $results,array $words = null,integer $description_length = self::DEFAULT_DESCRIPTION_LENGTH): array
Given an array page summaries, for each summary check if the url corresponds to a search result that was human edited, if so, replace and format it.
array | $results | web pages summaries (these in turn are arrays!) |
array | $words | keywords (typically what was searched on) |
integer | $description_length | length of the description |
summaries which have been snippified and bold faced