This is a discussion on Site Search within the PHP Language forums, part of the PHP Programming Forums category; I am making an In-Site Search for a website, it is a PHP page where user can enter the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am making an In-Site Search for a website,
it is a PHP page where user can enter the keyword(s), and then the page will read through all other html/php pages to find that keyword(s). My problem is how to avoid searching the tags? For example, when user typed in "$PHPSELF", how to avoid searching the code within <?php ?> tag? Also, how to avoid searching the attributes in other tags? Assume that the server doesn't have MYSQL installed, and no index file is made. Thanks! And by the way, do you have better solutions to do the In-Site search without using MYSQL? Thanks! KC |
|
|||
|
"KC Wong1" wrote:
> I am making an In-Site Search for a website, > it is a PHP page where user can enter the keyword(s), > and then the page will read through all other html/php pages to find > that keyword(s). > My problem is how to avoid searching the tags? > For example, when user typed in "$PHPSELF", how to avoid searching the > code within <?php ?> tag? Also, how to avoid searching the > attributes > in other tags? > Assume that the server doesn’t have MYSQL installed, and no > index file > is made. > Thanks! > > And by the way, do you have better solutions to do the In-Site search > without using MYSQL? > Thanks! > > KC KC, you are much better off simply putting in one of the many free site search buttons. Google has one, and so do others. You are done in 5 minutes vs. spending quite a few days, and never getting it to work quite right. Just my 2 cents. -- http://www.dbForumz.com/ This article was posted by author's request Articles individually checked for conformance to usenet standards Topic URL: http://www.dbForumz.com/PHP-Site-Sea...ict140737.html Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=471682 |
|
|||
|
KC Wong a écrit :
> I am making an In-Site Search for a website, > it is a PHP page where user can enter the keyword(s), > and then the page will read through all other html/php pages to find > that keyword(s). > My problem is how to avoid searching the tags? > For example, when user typed in "$PHPSELF", how to avoid searching the > code within <?php ?> tag? Also, how to avoid searching the attributes > in other tags? > Assume that the server doesn't have MYSQL installed, and no index file > is made. > Thanks! > > And by the way, do you have better solutions to do the In-Site search > without using MYSQL? > Thanks! You've already got some good answers and advices... Now, if you insist on reinventing the wheel and rolling your own search engine, there's also some documentation on the subject - at least the source code of some free full-text indexers. The standard solution is to have an index with words as keys and lists of matchings pages as values, which quite easily fits PHP's associative arrays. And it's quite easy (and fast) to serialize a PHP array and write it in a file. This probably wouldn't do if you plan to kick google out of business, but for a single, medium size site, this is surely enough !-) my 2 cents Bruno |