|
Defines |
#define | APR_WANT_STRINGS |
#define | APR_WANT_MEMFUNC |
#define | APR_WANT_STDIO |
#define | MOD_SEARCHM_SET_MUTEX_PERMS |
#define | SEARCHM_DESCRIPTION_PRE 24 |
| The number of characters before the matched term.
|
#define | SEARCHM_DESCRIPTION_POST 24 |
| The number of characters after the matched term.
|
#define | SEARCHM_DESCRIPTION_MAX 512 |
| The maximum number of characters to be in the returned searchm_description tag. Not an absolute value. Searching stops when p_ret becomes greater than this value.
|
#define | SEARCHM_SEARCH_SUBS 2 |
| The number of subs in the RE. RE will always contain one SUB.
|
#define | SEARCHM_PARAMETER_DISPLAY_MIN 0 |
#define | SEARCHM_PARAMETER_DISPLAY_MAX 10000 |
#define | SEARCHM_PARAMETER_PAGE_MIN 0 |
#define | SEARCHM_PARAMETER_PAGE_MAX 10000 |
#define | TEST_LOCKFILE "/var/searchm/test.lock" |
Functions |
void * | searchm_merge_per_server_config (apr_pool_t *p, void *base, void *virt) |
void * | searchm_per_server_config (apr_pool_t *p, server_rec *s) |
| Creates the per server configuration structure.
|
int | searchm_hook_post_config (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) |
| Complete post configuration of global server. Allocates the state table.
|
apr_status_t | searchm_pool_post_config_cleanup (void *data) |
| When server restart or shutdown, cleans up the post config.
|
void | searchm_hook_child_init (apr_pool_t *p, server_rec *s) |
| Sets up child process for forking MPMs.
|
apr_status_t | searchm_pool_child_init_cleanup (void *parm) |
| Child/process termination cleanup. If threaded MPM, destroys thread mutex.
|
void | searchm_process_init (int bSS, apr_pool_t *p) |
| process common initialization.
|
void | searchm_process_cleanup (int bSS, apr_pool_t *p) |
| process common cleanup.
|
int | searchm_method_handler (request_rec *r) |
| handles the request.
|
apr_status_t | searchm_get_querystring (p_query_info_t p_qi) |
| Obtains the query string for the request. Places into p_qi->querystring; If method is GET, then returns parsed_uri.query If method is POST, then reads input to obtain query string. searchm_qcmdstring.
|
apr_status_t | searchm_tags_cache_cmdline (p_query_info_t p_qi) |
apr_status_t | searchm_tags_cache_add (p_query_info_t p_qi, char *s, searchm_tag_ids_e tag_id, int bDel) |
searchm_tag_ids_e | searchm_tagid (char *t, int *p_rval, char **p_str) |
searchm_auto_tags_e | searchm_tagid_auto (char *tag) |
unsigned int | searchm_desc_trim_begin (const char *desc, unsigned int mpos, int *bStart) |
unsigned int | searchm_desc_trim_end (const char *desc, unsigned int mpos, int *bEnd) |
char * | searchm_description_handler (apr_pool_t *pool, apr_pool_t *ptemp, const char *desc, const char **stopword_list, const char **removed_list, p_searchm_termlist_t const p_tl) |
| create replacement string. p_tl may be a null list.
|
apr_status_t | searchm_replace_file (p_query_info_t p_qi, apr_file_t *fp) |
char * | searchm_replace_searchm_tag (p_query_info_t p_qi, searchm_tag_ids_e tag_id, int tval, char *p_str) |
int | searchm_parse_cmdline (p_query_info_t p_qi) |
| Associates paramters with values.
|
apr_status_t | searchm_parse_cmdline_display (p_query_info_t p_qi, const char *p_value) |
| Process the display command/query line value The value may only contain isdigit characters. (Not UTF-8 compat.) Duplicate display= parameters not allowed. Value must be reasonable. An empty value is allowed, and is considered '0'. "none" is only for missing display parameter. searchm_qdisplay.
|
apr_status_t | searchm_parse_cmdline_page (p_query_info_t p_qi, const char *p_value) |
| Process the page command/query line value The value may only contain isdigit characters. (Not UTF-8 compat.) Duplicate page parameters are ignored. This is required for second time thru. Value must be reasonable. searchm_qpage.
|
apr_status_t | searchm_parse_cmdline_reqid (p_query_info_t p_qi, const char *p_value) |
| Process the reqid command/query line value Only one reqid parameter allowed.
|
apr_status_t | searchm_parse_cmdline_within (p_query_info_t p_qi, const char *p_value) |
| Process the wiithin command/query line value Duplicate within parameters allowed, and accumulate Duplicate within values not allowed. A within value that is an empty string is ignored. Value is one of file title head body comments header emphasized meta all.
|
apr_status_t | searchm_parse_cmdline_index (p_query_info_t p_qi, const char *p_value, int nval) |
| Process the indexN command/query line value Empty values are ignored. If SearchmStrict, then value may not contain 2f.
|
apr_status_t | searchm_parse_cmdline_conj (p_query_info_t p_qi, const char *p_value, int nval) |
| Process the conjN command/query line value Only may be "and", "not", "or" or the empty string "".
|
apr_status_t | searchm_parse_cmdline_query (p_query_info_t p_qi, const char *p_value, int nval) |
| Process the queryN command/query line value.
|
apr_status_t | searchm_parse_cmdline_metatag (p_query_info_t p_qi, const char *p_value, int nval) |
| Process the metatagN command/query line value May only contain ASCII alpha characters (not UTF-8 okay). May be empty string "".
|
apr_status_t | searchm_parse_cmdline_order (p_query_info_t p_qi, const char *p_value, int nval) |
| Process the orderN command/query line value May only be one of "asc", "desc", or "" An empty string is dropped later.
|
apr_status_t | searchm_parse_cmdline_sort (p_query_info_t p_qi, const char *p_value, int nval) |
| Process the sortN command/query parameter value May only be a valid metaname, or empty string. An empty string is dropped later.
|
apr_status_t | searchm_parse_cmdline_limit (p_query_info_t p_qi, const char *value, int n, searchm_limit_attr_e ltype, int lstype) |
| Adds the information to the p_qi->limit[] structure. Sets bEntries to indicate at least one value was added.
|
int | searchm_limit_process_date (const char *const ld[SEARCHM_LIMIT_MAX_SUB], apr_time_t *t) |
| Processes the SUBS for type date into a C time structure. type=date 0 => month (0-11) 1=day(1-31) 2=century(19=1900, 20=2000) 3=year (00-99) 4=hour (0-23) past midnight 5=minutes (0-59) past hour 6=seconds (0-59) past minute converts to apr_ctime_t value (similar to C time_t) all 0-7 limit_hi and limit_low must be valid.
|
int | searchm_limit_process_string (const char *const ld[SEARCHM_LIMIT_MAX_SUB], char **str, apr_pool_t *p) |
| Processes the SUBS for type string into a string.
|
int | searchm_limit_process_integer (const char *const ld[SEARCHM_LIMIT_MAX_SUB], char **str, apr_pool_t *p) |
| Processes the SUBS for type string into a string.
|
int | searchm_limit_process (p_query_info_t p_qi) |
| creates the SwishSetSearchLimit paramters, if any
|
int | searchm_create_filepath (p_query_info_t p_qi) |
| Takes the index itemlist and creates the fname entry for each item. Takes the index itemlist and creates the fname entry for each item. Depends on SearchmStrict, SearchmAbsolute, SearchmRelative settings. Complicated by many issues. SearchmStrict May only be a valid filename. SearchmRelative May be a valid filename, or a valid relative filename/path specification. The releative spec should probably be given in generic API terms, using a '/', then converted to OS specific. SearchmAbsolute May be a valid filename, or a valid relative filename/path specification, or an absolute filename/path specification. The releative spec should probably be given in generic API terms, using a '/', then converted to OS specific. The absolute spec should probably be given in OS specific terms. Unix: /absolute/file_name DOS: c:/absolute/file_name (future).
|
int | searchm_cmp_weighted (char *p, char *t, int *v) |
int | searchm_cmp_stringed (char *p, char *t, char **p_str) |
int | searchm_cmp_limit (const char *param, int *n, p_searchm_limit_attr_e ltype, int *lstype, apr_pool_t *p) |
apr_status_t | searchm_itemlist_add (p_query_info_t p_qi, void *list, void *item, searchm_itemlist_e listtype, searchm_tag_ids_e itemtype) |
apr_status_t | searchm_pre_query (p_query_info_t p_qi) |
| Adjust values in p_qi after parsing command/query line. But prior to initiating the query. Returns error if no swishindex value given. Returns error if no query string value given.
|
apr_status_t | searchm_create_within (p_query_info_t p_qi) |
| Creates the p_qi->within string for searchm_within tag. From the p_qi->cmd.structure values.
|
int | searchm_structure_to_id (char *p_value) |
int | searchm_error_to_api (apr_status_t rs) |
| Returns the error page to return. Returns the error page to return.
|
const char * | searchm_set_absolute (cmd_parms *parms, void *dummy, const int arg) |
| Sets the p_sdc->bAbsolute from value given in configuration file. Called during the per-server-configuration if specified in the config file.
|
const char * | searchm_set_relative (cmd_parms *parms, void *dummy, const int arg) |
| Sets the p_sdc->bRelative from value given in configuration file. Called during the per-server-configuration if specified in the config file.
|
const char * | searchm_set_strict (cmd_parms *parms, void *dummy, const int arg) |
| Sets the p_sdc->bStrict from value given in configuration file. Called during the per-server-configuration if specified in the config file.
|
const char * | searchm_set_indexdir (cmd_parms *parms, void *dummy, const char *arg) |
| Sets the p_sc->sza_indexdir string from value given in the httpd configuration file. Associated with "SearchmIndexDir" httpd configuration file directive. Called during the per-server-configuration. If not specified in the httpd config file, this routine is not called.
|
const char * | searchm_set_lockfile (cmd_parms *parms, void *dummy, const char *arg) |
| Sets the p_sc->sza_lockfile string from value given in the httpd configuration file. Associated with "SearchmLockFile" httpd configuration file directive. Called during the per-server-configuration. If not specified in the httpd config file, this routine is not called.
|
const char * | searchm_set_begin (cmd_parms *parms, void *dummy, const char *arg) |
| Sets the p_sc->sza_begin string from value given in the httpd configuration file. Associated with "SearchmBegin" httpd configuration file directive.
|
const char * | searchm_set_result (cmd_parms *parms, void *dummy, const char *arg) |
| Sets the p_sc->sza_result string from value given in the httpd configuration file. Associated with "SearchmResult" httpd configuration file directive.
|
const char * | searchm_set_end (cmd_parms *parms, void *dummy, const char *arg) |
| Sets the p_sc->sza_end string from value given in the httpd configuration file. Associated with "SearchmEnd" httpd configuration file directive.
|
const char * | searchm_set_nohits (cmd_parms *parms, void *dummy, const char *arg) |
| Sets the p_sc->sza_nohits string from value given in the httpd configuration file. Associated with "SearchmNoHits" httpd configuration file directive.
|
const char * | searchm_set_activate (cmd_parms *parms, void *dummy, int bool) |
| Sets the p_sc->bActivate string from value given in configuration file. Called during the per-server-configuration if specified in the config file.
|
const char * | searchm_set_usertrack_cookie_name (cmd_parms *parms, void *dummy, const char *arg) |
| Sets the p_sc->sza_usertrack_cookie_name string from value given in the httpd configuration file. Associated with mod_usertrack "CookieName" httpd config file directive. Does not "Own" the CookieName directive, just snoop it to see what it is.
|
void * | searchm_merge_per_dir_config (apr_pool_t *p, void *basev, void *newv) |
| merge the directories into r->per_dir_config
|
void * | searchm_per_dir_config (apr_pool_t *p, char *dir) |
| allocate Director (Location) information.
|
int | searchm_spot_usertrack_cookie (request_rec *r) |
| Looks at incoming headers to determine if mod_usertrack cookie present. bUsertrackCookie=0 means cookie not part of request. bUsertrackCookie=1 means cookie part of request. If the mod_usertrack CookieName directive is set, use that value, Otherwise, use SEARCHM_DEFAULT_COOKIE_NAME. For now, just scans the string.
|
apr_status_t | searchm_qi_setup (p_query_info_t p_qi, request_rec *r, p_searchm_config_t p_sc, p_searchm_dir_config_t p_sdc) |
| Sets up p_qi, and checks some server settings. Verifies that SearchmBegin, SearchmResults, SearchmEnd, and SearchmNoHits are at least defined, and create reasonable filenames. Verifies the URI is parsed. Add server configuration settings to tag cache. searchm_date searchm_cabsolute searchm_crelative searchm_cstrict searchm_cindexdir searchm_cbegin searchm_cresult searchm_cend searchm_cnohit.
|
apr_status_t | searchm_metalist_process (p_query_info_t p_qi) |
| called during results phase to create the meta list
|
apr_status_t | searchm_subquery_process (p_searchm_metalist_t const p_ml, const char **sl, unsigned int *index_sl, const char *meta_def, apr_pool_t *p) |
| process a Swish-e subquery (as opposed to a searchm sub-query)
|
searchm_termtype_e | searchm_gettermtype (const char *t) |
| determines a term type.
|
searchm_termtype_e | searchm_conjtype (const char *const t) |
| Determines if t is a conjunction. Case is irrelevant.
|
apr_status_t | searchm_addterm (p_searchm_metalist_t p_ml, const char **sl, int *index_sl, const char *m, int bP, int nterms, apr_pool_t *p) |
apr_status_t | searchm_metalist_add (p_searchm_metalist_t const p_ml, const char *mn, p_searchm_metaelem_t *pp_me, apr_pool_t *p) |
p_searchm_metaelem_t | searchm_metalist_get (p_searchm_metalist_t p_ml, const char *mn, int *bFound) |
apr_status_t | searchm_nodelist_add (p_searchm_metaelem_t const p_me, const char **sl, int *index_sl, int bP, int nterms, apr_pool_t *p) |
| adds the term(s) at index_sl in sl to nodelist of me. me->l may be null. if nterms==1, then in phrase with one term. When added to nodelist, will become a single term, with phrase distinction lost. return:
|
void | searchm_metalist_destroy (p_searchm_metalist_t const p_ml) |
| destroys the metalist.
|
int | searchm_nullstrcmp (const char *const t1, const char *const t2, const int bCase) |
| compares t1 and t2, allowing for t1 and/or t2 to be NULL. if t1 and t2 are NULL, strings are considered equal The NULL string is considered less than a non NULL string. return: 0 strings are equal 1 strings are not equal
|
apr_status_t | searchm_nodelist_match (p_searchm_metaelem_t const p_me, const char **sl, const int index_sl, const int bP, const int nterms, int *bFound, apr_pool_t *p) |
apr_status_t | searchm_phrase_match (p_searchm_metaelem_t const p_me, const char **sl, const int index_sl, const int bP, const int nterms, int *bResult, apr_pool_t *p) |
| Checks if this phrase at ls[index_sl] is a match of an existing phrase in nodelist. If an existing phrase may be modified to match this phrase, it is modified, and match is successful. A match: If each term of a phrase is exaclty equal. Ex: "jack and jill" matches "jack and jill" If each term in phrase matches, with swap if necessary, match. Ex: "ja* and ji*" match "jack and jill" Ex: "jack and jill" match "ja* and ji*", with swap. Ex: "blackja* and ji*" match "ja* and ji*" with swap. If nterms in this phrase is not equal to the the number of terms in match phrase, then assume never equal.
|
apr_status_t | searchm_single_match (const char *t1, const char *t2, const int bWay, int *Result, apr_pool_t *p) |
apr_status_t | searchm_termlist_create (p_searchm_metalist_t const p_ml, const char *mn, int bUseNull, p_searchm_termlist_t const p_tl, int *bResult, apr_pool_t *p) |
void | searchm_termlist_destroy (p_searchm_termlist_t const p_tl, apr_pool_t *p) |
int | searchm_nextmatch (p_searchm_termlist_t const p_tl, const char *desc, unsigned int *pos, int *i_match, unsigned int *mpos_b) |
apr_status_t | searchm_cookie_process (p_query_info_t p_qi) |
apr_status_t | searchm_process_requestinfo (p_query_info_t p_qi) |
| Processes information for both initiating and requery search threads. Process the within structure. Process the index parameters. Add reqid parameter to cache.
|
void | searchm_test (p_query_info_t p_qi) |
| Testing locks, etc. The first thread/process will sleep for 60 seconds. While the first lock is held, all other process/threads will continue.
|
apr_status_t | searchm_swishexecute (p_query_info_t p_qi) |
| Sets up and calls SwishExecute Sets up and calls SwishExecute Update tag cache, after successful query, but prior to determine if query produced any hits. searchm_dbname searchm_dbdesc searchm_dbpointer searchm_dbadmin searchm_header_names Determines number of hits. searchm_hits hits Set to the number of hits/results from the query. If no hits, returns SEARCHM_ERROR_NOHITS. If hits, calculates and sets appropriate tags. Page numbers start at 1 Number of pages start at 1 Alway return at least one page. display set properly page set properly pagenext The next page to display pageprev The previous page to display i_start The start record i_end The end record searchm_page searchm_display searchm_pagenext searchm_pageprev searchm_total_pages searchm_full_pages searchm_start searchm_end searchm_last_page.
|
apr_status_t | searchm_phases (p_query_info_t p_qi) |
| Process the begin, results, and end phases Process the begin, results, and end phases. Opens the required files.
|
apr_status_t | searchm_phases_nohits (p_query_info_t p_qi) |
| Process the nohits phase.
|
void | searchm_error_doc (p_query_info_t p_qi) |
| Sends the error document to client, instead of results or nohits. Sends the error document to client, instead of results or nohits. An error here is a serious problem...
|
apr_status_t | searchm_generate_reqid (p_query_info_t p_qi) |
| Generates a unique id, in the form of a MD5 sum. For now, just uses current time. On systems with usec capability, this should be adequate.
|
apr_status_t | searchm_packet_make (p_query_info_t p_qi, void **pkt, unsigned int *psize) |
apr_status_t | searchm_next_string (char **s, void *v, unsigned int *pos, apr_pool_t *p) |
apr_status_t | searchm_packet_split (p_query_info_t p_qi, void *pkt, unsigned int psize) |
| Splits a database packet.
|
apr_status_t | searchm_buffer_expand (p_searchm_buffer_t pb, unsigned int min, apr_pool_t *p) |
| expands the buffer.
|
apr_status_t | searchm_buffer_add_string (const char *s, p_searchm_buffer_t pb, apr_pool_t *p) |
| Adds string (including the terminating null 0) to the buffer.
|
apr_status_t | searchm_buffer_add (void *pv, unsigned int size, p_searchm_buffer_t pb, apr_pool_t *p) |
| Adds the byte string to the buffer.
|
int | searchm_absolute_path (const char *path) |
int | searchm_check_filename (const char *file) |
int | searchm_strcmp (const char *s1, const char *s2) |
apr_status_t | searchm_dbase_open (p_query_info_t p_qi) |
apr_status_t | searchm_dbase_close (p_query_info_t p_qi) |
apr_status_t | searchm_dbase_get (p_query_info_t p_qi) |
| Retrieves any information for request id from database.
|
apr_status_t | searchm_dbase_put (p_query_info_t p_qi) |
| Store the search thread information in database. Uses the unique id as the key.
|
apr_status_t | searchm_dbase_purge (p_query_info_t p_qi) |
| Purges information from database, if necessary. See SEARCHM_PURGE_TIME and SEARCHM_INVALIDATE_TIME compile time options. The last purge time is stored in the SEARCHM_KEY_PURGETIME key. File is purged if SEARCHM_PURGE_TIME seconds have passed since last purge. If a SEARCHM_KEY_PURGETIME is not in database, file is purged. At end of purge, old SEARCHM_KEY_PURGETIME is replaced with new one. During purge, any key with SEARCHM_INVALIDATE_TIME seconds difference between current time and stored time is deleted.
|
void | searchm_register_hooks (apr_pool_t *p) |
Variables |
module AP_MODULE_DECLARE_DATA | searchm_module |
command_rec | searchm_cmds [] |