how does the search work
The templateenginge provides a method called search1() (and other search-functions that only wraps around search1() ). This method freezes all its arguments to a textstring and connects (via tcp) to the search-daemon searchd.pm that gives all the arguments to the search()-method in the goldfisch::search2-module. There the search and almost everything else takes place and the result is returned to searchd which freezes the result again and returns to the calling search1()-method. Now the result is a bit restructured to meet the same format then the usual get_data()-method. Then the overview2-structure is created (a better structure for providing an overview over all searchresults).
- goldfisch::tt2:funcs::search1
- searchd
- goldfisch::search2:search
- and back again
goldfisch::search2::search()
The brain of the search !!
It calls create_s_tree to create the search-tree out of the searchterm. The search-tree is a logical tree that represents the searchterm. Each node is a function like AND, OR or a actual data-query. process_s_tree will then do the actual search.
- create_s_tree -> returns the entry-node of the search-term
- process_s_tree -> returns the searchresult $r={result=>, err=>}
- get_val
- match
- get_val_dbi - only for phrase search
- remove_duplicates removes duplicates in the intermediate searchresult to speed up logical operations
- logic perform the logical operations AND OR NOT
- SPLIT :
compressed identificatin of a db-entry
We use a compressed form to describe a db-entry.
byte 1 is the numeric code of the config/database where the result occures. CID
Byte 2-end is the compressed ID.
we call this value the CV. Compressed Value
If we need to know the fields as well we store the FID (numeric code of the filed) as byte 2 and byte 3-end is the compressed ID.
format of $r->{result} in search2
its a array of strings. every string represents one hit in the search. The hits are stored in CV-format.
format of $rv in search2::search()
its a hash of arrays. Each hashkey is the numeric code of the config that points to arrays that holds each result as compressed id.
This structure is a different representation of $r->{result} that is created via the SPLIT-process.
get_val_dbi
gets data from the database
gets_val_dbi($dbh,$cv)
$dbh is a active db-handle
$cv is a hit in CV-format



