http://www.greenstone.org/manuals/mgpp_user.pdf describes mg++ the s&r appliance embedded in greenstone
might interest you cheers, stephen On Sunday, May 16, 2010, <zacht...@cis-partners.com> wrote: > I'm making a first pass at implementing code/tickets/wiki search. Anybody > working on something similar? If you have any thoughts on functionality, > implementation, or anything else, let me know. > > diff -rupN fossil_src_orig/src/db.c fossil2/src/db.c > --- fossil_src_orig/src/db.c 2010-03-18 10:20:53.000000000 -0400 > +++ fossil2/src/db.c 2010-05-16 12:11:18.796282921 -0400 > @@ -1040,6 +1040,22 @@ static void db_sql_user( > } > } > > +static void db_sql_content_get( > + sqlite3_context *context, > + int argc, > + sqlite3_value **argv > +){ > + int rid; > + Blob content; > + > + if( argc != 1 ) return; > + rid = sqlite3_value_int(argv[0]); > + content_get(rid, &content); > + sqlite3_result_text(context, blob_str(&content), -1, SQLITE_TRANSIENT); > +} > + > + > + > /* > ** Implement the cgi() SQL function. cgi() takes a an argument which is > ** a name of CGI query parameter. The value of that parameter is returned, > @@ -1156,6 +1172,7 @@ LOCAL void db_connection_init(void){ > sqlite3_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0); > sqlite3_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0); > sqlite3_create_function(g.db, "print", -1, SQLITE_UTF8, > 0,db_sql_print,0,0); > + sqlite3_create_function(g.db, "content_get", 1, SQLITE_ANY, 0, > db_sql_content_get, 0, 0); > sqlite3_create_function( > g.db, "file_is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0 > ); > diff -rupN fossil_src_orig/src/search.c fossil2/src/search.c > --- fossil_src_orig/src/search.c 2010-03-18 10:20:53.000000000 -0400 > +++ fossil2/src/search.c 2010-05-16 17:18:59.343032875 -0400 > @@ -172,6 +172,61 @@ void search_sql_setup(Search *p){ > } > > /* > +** WEBPAGE: search > +** URL: /search > +*/ > +void search(void){ > + const char *zType; > + const char *zContent; > + const char *zSrch; > + const char *zUuid; > + char zrn[4]; > + char zshUuid[10]; > + int zScore; > + int zRid; > + > + Search *zSrchpat; > + Stmt q; > + > + zSrch = PD("search", ""); > + zSrchpat = search_init(zSrch); > + search_sql_setup(zSrchpat); > + > + db_prepare(&q, "SELECT type, rid, content, score(content) AS score FROM " > + "(SELECT 'code' as type, rid as rid, content_get(rid) as > content FROM " > + "(SELECT rid FROM vfile)) ORDER BY score DESC"); > + > + style_header("Search"); > + @ <table> > + @ <tr> > + @ <td bgcolor='red'>code</td> > + @ <td bgcolor='green'>tickets</td> > + @ <td bgcolor='blue'>wiki</td> > + @ </tr> > + @ </table> > + @ <table border=1> > + @ <tr><td>link</td><td>relevance</td><td>type</td></tr> > + while (db_step(&q) == SQLITE_ROW){ > + zType = db_column_text(&q, 0); > + zRid = db_column_int(&q, 1); > + zContent = db_column_text(&q, 2); > + zScore = db_column_int(&q, 3); > + sprintf(zrn, "%i", zScore); > + if (zScore > 0){ > + if (strcmp(zType, "code") == 0){ > + zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", zRid); > + strncpy(zshUuid, zUuid, 10); > + > + @ <tr><td><a > href='/artifact?name=%h(zUuid)'>%h(zshUuid)</td><td>%h(zrn)</td><td>%h(zType)</td></tr> > + } > + } > + } > + @ </table> > + db_finalize(&q); > + style_footer(); > +} > + > +/* > ** Testing the search function. > ** > ** COMMAND: search > diff -rupN fossil_src_orig/src/skins.c fossil2/src/skins.c > --- fossil_src_orig/src/skins.c 2010-03-18 10:20:53.000000000 -0400 > +++ fossil2/src/skins.c 2010-05-15 13:43:35.326471185 -0400 > @@ -183,6 +183,12 @@ static const char zBuiltinSkin1[] = > @ } > @ </th1></nobr></div> > @ </div> > +@ <div class="header"> > +@ <form action="/search" method="post"> > +@ <input type="text" name="search" size=20/> > +@ <input type="submit" value="Search"/> > +@ </form> > +@ </div> > @ <div class="mainmenu"><th1> > @ html "<a href=''$baseurl$index_page''>Home</a> " > @ if {[anycap jor]} { > diff -rupN fossil_src_orig/src/style.c fossil2/src/style.c > --- fossil_src_orig/src/style.c 2010-03-18 10:20:53.000000000 -0400 > +++ fossil2/src/style.c 2010-05-15 13:45:25.581470950 -0400 > @@ -208,6 +208,12 @@ const char zDefaultHeader[] = > @ } > @ </th1></nobr></div> > @ </div> > +@ <div class="header"> > +@ <form action="/search" method="post"> > +@ <input type="text" name="search" size=20/> > +@ <input type="submit" value="Search"/> > +@ </form> > +@ </div> > @ <div class="mainmenu"><th1> > @ html "<a href='$baseurl$index_page'>Home</a> " > @ if {[anycap jor]} { > > > > > _______________________________________________ > fossil-users mailing list > fossil-users@lists.fossil-scm.org > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users > -- -- Stephen De Gabrielle stephen.degabrie...@acm.org Telephone +44 (0)20 85670911 Mobile +44 (0)79 85189045 http://www.degabrielle.name/stephen _______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users