> While at this, could you try to explain to me how the search system of FreeTrade 
>works. I know I asked this before, and I know you did answar, but I do not understand 
>. Maybe if take it slow and step by step?  Please?

Bjarne, how could I say no to a plea like that!  Here it goes:

When you search with the generic search form, what the user is searching
for is stored in the $inputKeywords variable.  If they search via the
advanced search, what the user enters is stored in the fields
$inputName, $inputDescription, and $inputKeywords.  

Having hit the search button, the user is transfered to the
search_results screen.  In the search results screen, the system starts
off by pulling the names, descriptions, and keywords of every item in
the system into an array.  Note that the keywords field is a field where
the administrator can associate key words with an item--i.e. he must do
these associations manually.  Then the $inputName, $inputDescription,
and $inputKeywords variables are tokenized into a series of separate
words, and funky characters are thrown away.  Having broken up the input
into something recognizable, each token in the search criteria is
compared to each token that results from breaking every item's name,
description, and key words field.  If there are any matches between any
of these tokens, the system reports the matching item.  

Aside from matching items, if SEARCH_INDEX is true, each of the
tokenized search criteria is compared to words in the $ScreenIndex
array.  The $ScreenIndex array is an array of word=>number mappings. 
The array is created by parsing every page in the site, and tokenizing
that page into words.  The number associated with each word is the
number of times that word is used in the site.  Naturally, certain words
like "an" and "the" are not stored in the $ScreenIndex array because
doing so would be pointless.  Having explained the $ScreenIndex array, I
can continue to state again that the tokenized search criteria is
compared to the words in the $ScreenIndex array to see if there are any
pages that match the search criteria.  If so, the system reports the
matching pages.

Whew!  That was a lot of typing.  I hope that it helped.  Bjarne,
perhaps you can put this into the FAQ ;)

-jj

-- 
if (shannon - jj) * behrens == webEngineer["CLEAR INK�"]:
    print "<i>imagination is the only real medium(sm)</i><br>"


------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Site:            http://www.working-dogs.com/freetrade/
Problems?:       [EMAIL PROTECTED]

Reply via email to