addToSearchIndex [line 165]
void addToSearchIndex(
$arr, [ $type = 'e']
)
|
|
Parses the entry/page, strips punctuation and stop/non-words, lower cases and adds to the global master index array.
Parameters:
API Tags:
| Uses: | filterWords() - The function that strips the stop/non-words |
cmp_weights [line 334]
integer cmp_weights(
assoc.array &$a, assoc.array &$b
)
|
|
Compare weights of search results
Parameters:
|
assoc.array |
&$a: |
search result a |
|
assoc.array |
&$b: |
search result b |
API Tags:
| Return: | -1,0,+1 depending on comparison |
createSearchIndex [line 73]
boolean createSearchIndex(
int $start, int $stop, int $time
)
|
|
Indexes entries and pages in the PivotX database and returns true if there are more entries to index.
Parameters:
|
int |
$start: |
Code for first entry to index |
|
int |
$stop: |
Code for last entry to index |
|
int |
$time: |
Indexing time. |
filterWords [line 251]
array filterWords(
array $arr
)
|
|
Strips stop/non-words from an array of words.
Parameters:
|
array |
$arr: |
Words to be filtered. |
API Tags:
getWord [line 804]
boolean getWord(
string $word
)
|
|
Search for a given word. It branches depending on the selected database model
Parameters:
|
string |
$word: |
Word to search for. |
API Tags:
| Return: | false if not found, else true. |
getWordFlat [line 824]
boolean getWordFlat(
string $word
)
|
|
Checks if a word is part of the search index and if so sets the global variable $matches_entries to the matching entry codes and the global variable $matches_pages to the matching page codes.
Parameters:
|
string |
$word: |
Word to search for. |
API Tags:
| Return: | False if not found, else true. |
getWordSql [line 894]
boolean getWordSql(
string $word
)
|
|
Checks if a word is part of the search index and if so sets the global variable $matches_entries to the matching entry codes and the global variable $matches_pages to the matching page codes.
If this function returns no results when they are expected, keep in mind that:
- Words called stopwords are ignored, you can specify your own stopwords, but
default words include the, have, some - see default stopwords list.
- If a word is present in more than 50% of the rows it will have a weight of
zero. This has advantages on large datasets, but can make testing difficult on
small ones.
http://www.petefreitag.com/item/477.cfm
Parameters:
|
string |
$word: |
Word to search for. |
API Tags:
| Return: | false if not found, else true. |
loadSearchIndex [line 782]
void loadSearchIndex(
array $words
)
|
|
Loads (the needed part of) the search index for the given array of words.
Parameters:
removeFromSearchIndex [line 210]
void removeFromSearchIndex(
$item, [ $type = 'e']
)
|
|
For a given entry/page, removes the related key from the content of the index.
The global master index array contains the altered content (keys).
Parameters:
searchEntries [line 695]
array searchEntries(
string $str
)
|
|
Searches the index and returns the matching entries in an array.
Used in the entries screen/overview search.
Parameters:
|
string |
$str: |
Text/words to search for |
searchIndex [line 433]
string searchIndex(
array $str_a, [string $only = ''], [string $weblog = ''], [string $category = ''], &$searchresults
)
|
|
Searches the index for words.
Parameters:
|
array |
$str_a: |
Contains the display text (index 0) and the search text (index 1). |
|
string |
$only: |
Selects if you want to search "entries" or "pages". |
|
string |
$weblog: |
Selects if you want to search inside a specific weblog. |
|
string |
$category: |
Selects if you want to search inside a specific category. |
|
|
&$searchresults: |
|
API Tags:
| Return: | The search results as a list (in HTML code). |
| Usedby: | searchResult() |
searchIndexKey [line 43]
string searchIndexKey(
string $str
)
|
|
Calculates a search index key (used for file names). Only used be flat file database.
Parameters:
searchResult [line 981]
string searchResult(
&$searchresults
)
|
|
Returns the search form and (possibly) the search results.
Parameters:
API Tags:
updateSearchIndex [line 149]
void updateSearchIndex(
array $item, [string $type = 'e']
)
|
|
Updates the search index for a single entry or page.
Parameters:
|
array |
$item: |
The entry or page to get indexed/updated. |
|
string |
$type: |
Tells if we are indexing an entry or a page. |
weighSearchResult [line 384]
integer weighSearchResult(
assoc.array &$result, assoc.array $params
)
|
|
Default callback for weighing a search result
Parameters:
|
assoc.array |
&$result: |
a single result |
|
assoc.array |
$params: |
an array containts: complete=complete-search-text, words=array-of-search-words |
API Tags:
weighText [line 353]
integer weighText(
string $subject, string $complete, array $words, integer $max
)
|
|
Weight a text part relative to some other part
Parameters:
|
string |
$subject: |
the subject to search in |
|
string |
$complete: |
the complete search term (lowercased) |
|
array |
$words: |
all the individuele search terms (lowercased) |
|
integer |
$max: |
maximum number of points to return |
API Tags:
writeSearchIndex [line 281]
void writeSearchIndex(
[boolean $silent = false], [ $loadindex = true]
)
|
|
Write the index to file (using the global variable $master_index.
Parameters:
|
boolean |
$silent: |
|
|
|
$loadindex: |
|