View previous topic :: View next topic |
Author |
Message |
cjc
Joined: 24 Dec 2002 Posts: 146 Location: New York
|
Posted: Mon May 05, 2003 8:06 pm Post subject: b2search Release v1.0 |
|
|
It's up at http://www.cjc.org/blog/files/b2search.zip.
The README.b2search should be read first. It has install instructions, etc. Basically, you'll need to run a script to create the database tables, edit the include file b2es.functions.php to make the common_words array more to your liking, then run a second script to index your current posts.
There are a few other changes that involve editing existing b2 files to integrate the search into your local installation, mainly indexing posts automatically. It's not necessary to do this, but everything works much more nicely if you do.
You can look at a demo of the improved search by going to http://www.cjc.org/blog/b2search.php. |
|
Back to top |
|
 |
cjc
Joined: 24 Dec 2002 Posts: 146 Location: New York
|
Posted: Mon May 05, 2003 9:10 pm Post subject: |
|
|
Spoke too soon.
Some changes I made to get wildcard searches running appears to make index updates break. I'll have a new version up shortly. |
|
Back to top |
|
 |
cjc
Joined: 24 Dec 2002 Posts: 146 Location: New York
|
Posted: Mon May 05, 2003 9:24 pm Post subject: |
|
|
OK, fixed now. The README should say version 1.0.1. |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Tue May 06, 2003 4:45 am Post subject: |
|
|
great job. Just dled it.
But there is one slight problem. It is using the CSS to highlight, if that search term appear in any other part of the page it willbe also highlighted.
For example i search for "cheng", the author part will be highlighted also. _________________
++ GamerZ.Per.Sg - Complex Simplicity |
|
Back to top |
|
 |
cjc
Joined: 24 Dec 2002 Posts: 146 Location: New York
|
Posted: Tue May 06, 2003 5:31 am Post subject: |
|
|
GamerZ wrote: | great job. Just dled it.
But there is one slight problem. It is using the CSS to highlight, if that search term appear in any other part of the page it willbe also highlighted.
For example i search for "cheng", the author part will be highlighted also. |
Actually, the CSS highlighting is entirely separate. I just happen to have it from a different hack, and it's substantially unrelated to the enhanced search engine. I did make a modification to accomodate it, but it's neither here nor there.
Perhaps a CSS/JS guru can take a look at the thing, and recommend a way to change things. |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Tue May 06, 2003 12:53 pm Post subject: |
|
|
cjc wrote: | GamerZ wrote: | great job. Just dled it.
But there is one slight problem. It is using the CSS to highlight, if that search term appear in any other part of the page it willbe also highlighted.
For example i search for "cheng", the author part will be highlighted also. |
Actually, the CSS highlighting is entirely separate. I just happen to have it from a different hack, and it's substantially unrelated to the enhanced search engine. I did make a modification to accomodate it, but it's neither here nor there.
Perhaps a CSS/JS guru can take a look at the thing, and recommend a way to change things. | how abt using php to highlight? maybe like replace testing with <b>testing</b> ? _________________
++ GamerZ.Per.Sg - Complex Simplicity |
|
Back to top |
|
 |
cjc
Joined: 24 Dec 2002 Posts: 146 Location: New York
|
Posted: Tue May 06, 2003 1:21 pm Post subject: |
|
|
GamerZ wrote: | how abt using php to highlight? maybe like replace testing with <b>testing</b> ? |
The problem with that is that I'd like to do relatively little server side processing, so as to return the results quickly. That, and my server box kind of sucks, so any extra text processing will make everything slower.
You're perfectly free to modify you b2functions.php to achieve this. I'm passing the search string back to index.php using the GET variable "sh". You just need to modify the function that displays the post content to do the preg_replace. This modification actually shouldn't touch the b2search files, in fact, since all b2search.php does is return postIDs without any massaging of the post contents. |
|
Back to top |
|
 |
blog17
Joined: 28 Jan 2003 Posts: 144 Location: London, UK
|
Posted: Tue May 06, 2003 1:55 pm Post subject: |
|
|
Its one of the most prettiest things Ive ever seen, well done.
I cant wait to slap it in my up and coming design.  _________________ Check this out! The ULTIMATE site! |
|
Back to top |
|
 |
thmz
Joined: 03 Nov 2002 Posts: 14 Location: ID
|
Posted: Sun May 11, 2003 12:10 am Post subject: |
|
|
hello, i got problem on this feature:
I edited the b2edit.php ( as it is mentioned in the readme file)
In each of these clauses, there will be a line stating "require_once('./b2header.php');". You will also need to add the following line right below each of these lines: require_once($b2inc.'/b2es.functions.php');
I have done that to the "post", "editpost" and "delete" clauses.
I continue to edit, and ...
In the Case "delete" clause:
At around line 240, _above_ the '$query = "DELETE FROM $tableposts WHERE ID=$post";' line:
b2es_del_post_concordance($post);
The original lines:
Code: |
case "delete":
$standalone = 1;
require_once("./b2header.php");
if ($user_level == 0)
die ("Cheatin' uh ?");
$post = $HTTP_GET_VARS['post'];
$postdata=get_postdata($post) or die("Oops, no post with this ID. <a href=\"b2edit.php\">Go back</a> !");
$authordata = get_userdata($postdata["Author_ID"]);
if ($user_level < $authordata[13])
die ("You don't have the right to delete <b>".$authordata[1]."</b>'s posts.");
$query = "DELETE FROM $tableposts WHERE ID=$post";
$result = mysql_query($query) or die("Oops, no post with this ID. <a href=\"b2edit.php\">Go back</a> !");
if (!$result)
die("Error in deleting... contact the <a href=\"mailto:$admin_email\">webmaster</a>...");
|
and I changed that into:
Code: |
case "delete":
$standalone = 1;
require_once("./b2header.php");
require_once($b2inc.'/b2es.functions.php');
if ($user_level == 0)
die ("Cheatin' uh ?");
$post = $HTTP_GET_VARS['post'];
$postdata=get_postdata($post) or die("Oops, no post with this ID. <a href=\"b2edit.php\">Go back</a> !");
$authordata = get_userdata($postdata["Author_ID"]);
if ($user_level < $authordata[13])
die ("You don't have the right to delete <b>".$authordata[1]."</b>'s posts.");
b2es_del_post_concordance($post);
$query = "DELETE FROM $tableposts WHERE ID=$post";
|
But i got this:
Parse error: parse error, unexpected T_CASE in /home/*******/public_html/*******/b2edit.php on line 253
and line 253 is case "delete":
Any idea? _________________ http://thomas.warnadunia.net/ - what is your color? |
|
Back to top |
|
 |
cjc
Joined: 24 Dec 2002 Posts: 146 Location: New York
|
Posted: Sun May 11, 2003 5:52 am Post subject: |
|
|
thmz wrote: | hello, i got problem on this feature:
But i got this:
Parse error: parse error, unexpected T_CASE in /home/*******/public_html/*******/b2edit.php on line 253
and line 253 is case "delete":
Any idea? |
Please email me the b2edit.php file. Send it to [email protected]. |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Sun May 11, 2003 7:04 am Post subject: |
|
|
cjc wrote: | GamerZ wrote: | how abt using php to highlight? maybe like replace testing with <b>testing</b> ? |
The problem with that is that I'd like to do relatively little server side processing, so as to return the results quickly. That, and my server box kind of sucks, so any extra text processing will make everything slower.
You're perfectly free to modify you b2functions.php to achieve this. I'm passing the search string back to index.php using the GET variable "sh". You just need to modify the function that displays the post content to do the preg_replace. This modification actually shouldn't touch the b2search files, in fact, since all b2search.php does is return postIDs without any massaging of the post contents. | hehe okie, hope i ahve got teh time to edit LOL _________________
++ GamerZ.Per.Sg - Complex Simplicity |
|
Back to top |
|
 |
blog17
Joined: 28 Jan 2003 Posts: 144 Location: London, UK
|
Posted: Sun May 18, 2003 3:51 pm Post subject: Error & Question |
|
|
Hi, this script is excellent! I get this at the top of my b2search.php page:
Code: | Warning: main(./b2-include/searchhi.js) [function.main]: failed to create stream: No such file or directory in /home/....../public_html/b2/b2search.php on line 74
Warning: main() [function.main]: Failed opening './b2-include/searchhi.js' for inclusion (include_path='') in /home/....../public_html/b2/b2search.php on line 74 |
Is it possible to re-index the whole thing? I did the dumb thing and put in the commonly used words AFTER I indexed it all! _________________ Check this out! The ULTIMATE site! |
|
Back to top |
|
 |
cjc
Joined: 24 Dec 2002 Posts: 146 Location: New York
|
Posted: Sun May 18, 2003 4:05 pm Post subject: Re: Error & Question |
|
|
blog17 wrote: | Hi, this script is excellent! I get this at the top of my b2search.php page:
Code: | Warning: main(./b2-include/searchhi.js) [function.main]: failed to create stream: No such file or directory in /home/....../public_html/b2/b2search.php on line 74
Warning: main() [function.main]: Failed opening './b2-include/searchhi.js' for inclusion (include_path='') in /home/....../public_html/b2/b2search.php on line 74 |
|
OK, just remove that line. I have searchhi.js installed; if you don't, then remove the line, comment it out, or install it yourself. You can grab it from http://www.cjc.org/blog/files/searchhi.js.zip and then install it in the b2-include directory. It's just a piece of javascript that does search term hilighting, and isn't necessary for the basic functionality of the search.
blog17 wrote: |
Is it possible to re-index the whole thing? I did the dumb thing and put in the commonly used words AFTER I indexed it all! |
The easiest thing to do is edit the b2search_installDB.php script. Around line 35, there are two lines that are commented out. These two lines drop the b2search tables b2searchterm and b2concordance. The following lines will recreate them without any data. At this point, you can re-run your big indexing job. |
|
Back to top |
|
 |
blog17
Joined: 28 Jan 2003 Posts: 144 Location: London, UK
|
Posted: Sun May 18, 2003 4:32 pm Post subject: |
|
|
Hi;
Ok, I re-idexed it... but when the common word searches are still being displayed. I know that I have put the common words in correctly because it says: common words: blah blah _________________ Check this out! The ULTIMATE site! |
|
Back to top |
|
 |
cjc
Joined: 24 Dec 2002 Posts: 146 Location: New York
|
Posted: Sun May 18, 2003 5:19 pm Post subject: |
|
|
Can you give me a URL? |
|
Back to top |
|
 |
|