Welcome to WebmasterWorld Guest from 54.157.225.99

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Functional search box

     
4:04 pm on Jul 21, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


Hi,

I have some knowledge in HTML,PHP and CSS, and I want to implement a functional
search box on a syte and I don't know where to start.

I want that the search to be made whithin my site content.

Please help me to do that.

Thank you in advance.
4:13 pm on July 21, 2013 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4845
votes: 4


ghid, how big is your site?

If Google has your site well spidered, particularly if you don't add lots of new pages... then using their search may be good enough [google.com...]
4:23 pm on July 21, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


But you have to pay if you exceed 100 searches? Isn't it so?
I want a free option please.

Thank you.
4:29 pm on July 21, 2013 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4845
votes: 4


Wow, never realised they charge for that.

There will be free options, but depending on your confidence of using PHP, there are a number of PHP libraries you could use, sphinx being oft mentioned.
4:48 pm on July 21, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


I am disposed to learn. I will read about this sphinx library. Thank you for the start point gived by you.
5:01 pm on July 21, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


Using sphinx I have to upload my content in a database?
9:17 pm on July 21, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:13268
votes: 363


Wow, never realised they charge for that.

Do they? My understanding was that it's always free if you let them show advertising; you have to pay to eliminate the ads.
9:21 pm on July 21, 2013 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4845
votes: 4


You could be right lucy, I always thought there was a free option as it's so prevalent. It was my first thought of a suggestion for ghid to have a look at.
9:24 pm on July 21, 2013 (gmt 0)

Full Member

5+ Year Member

joined:Aug 16, 2010
posts:229
votes: 12


Yes it is absolute free, i use CSE and have >100 queries a day. Only Google Site Search is a paid option. No ads are displayed and there is an API and XML interface.
9:36 pm on July 21, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 7, 2003
posts:4783
votes: 0


I've been using CSE linked to my adsense account for years. Never paid a penny, on the contrary, Google pays me ... (not that much)
4:11 pm on Aug 11, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


Hi!

I have made a new site and implemented the google custom search on it.
When I typed a word or a group of words from my site ( this site consists in just one page ) the result displayed was nothing.
It is because de google didn't indexed my site or why?
4:36 pm on Aug 11, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Feb 12, 2006
posts:2561
votes: 48


google search only returns the pages that are in google's index, i believe. installing the custom search doesn't make them spider it anymore than they normally would. that was a deal breaker for me, because my site is thousands of pages and half of them might drop out of the search making it look like they don't exist.

there's an open source script that's been around for years, called "sphider". that's what i've been using. you'll need a database to install it, but it can spider you whole site and even has a few logs so you can see what's being searched for. the templates are totally customisable too.
4:25 pm on Aug 19, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


Thank you londrum for your response.
I downloaded and installed sphider following the steps posted on the sphider site and I can't make it working.

I have tested it on my own local PC Apache and Mysql servers.

And it shows me errors.

- When I enter the sphider search page
" http://localhost/sphider/search.php"

are displayed in page next to the search form the following two messages:


SELECT count(*) FROM categories WHERE parent_num=0
Table 'sphider.categories' doesn't exist


and



SELECT * FROM categories WHERE parent_num=0 ORDER BY category
Table 'sphider.categories' doesn't exist



Please help me if you can.

Thank you.

[edited by: phranque at 7:31 pm (utc) on Aug 19, 2013]
[edit reason] unlinked url [/edit]

7:48 pm on Aug 19, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Feb 12, 2006
posts:2561
votes: 48


have you got phpmyadmin, or something like that? check that the categories table exists. if it doesnt then just create it manually (have a look at the sphider install script to see which fields you need to add)
8:23 pm on Aug 19, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


I had readed in sphider forum that I have to install sphider again
I had installed again and when I access search.php doesn't apear any error, but when I press search button appears the following error:



Table 'sphider.query_log' doesn't exist



I will take a look in install.php to more digging.

Thank you.
5:57 pm on Aug 29, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


About the error -> " Table 'sphider.query_log' doesn't exist "
I have readed in the Spider forum that this error had appeared because the size of the column " time timestamp(14) " was to big, so I chaghed in the install.php time timestamp(14) with timestamp(6) and solved appearing of this error and I hope that my change to not affect good functioning of this application

I have idexed my localhost site but searching doesn't works. After a search this message appears: The search "home" did not match any documents.

Please help me to set up sphider. Thank you.
6:29 pm on Aug 29, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


Problem solved. I had less than 10 words and my site wasn't indexed.
I hope to have succes with custom dysplayng because at he result search it apears all page, and the searched word is not highlighted.
7:34 pm on Aug 29, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Feb 12, 2006
posts:2561
votes: 48


it takes a bit of fiddling with, like most open source stuff. but its definitely worth persevering with. it's a good little search script once you get it up and running, and the stats are handy too, so you can see what people are having trouble finding on your site
5:33 am on Aug 30, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


Thank you very much on your advice of using this search script, because I don't like at all google custom search and nobody gived me alternatives ( with except of a sphinx php library.

Two quickly qwestions before I start to study the problem:

-The search result can be customized? The searched words can be highlighted, bordered e.t.c on the displaing search page?

- It is difficult of online implementing? ( because now I test it on localhost server)

Thank you very much.
6:26 am on Sept 1, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


Why I can't include the search.php of sphider within a div from my page? It is a common problem?
8:43 am on Sept 1, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Feb 12, 2006
posts:2561
votes: 48


i haven't even got a search.php file. my main page is index.php
what is it, the results page? or just a little search box?

if it's just a search box then you don't really have to include the file, just copy the search box code straight into your main page. as long as the search form leads to the same page in the end, thats all that matters

if it's the result page, then just amend the search.php file directly, and include all your headers and sidebars, or whatever, around it. pretend that it is just a template file
10:16 am on Sept 1, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


It is a search php page that displays a search box but it have a lot of code in that page, it is a code that I don't understand, it's complicated to me, I think is a php database code.

I tried to copy this code inside a div of my index page, but it has no effect.
10:53 am on Sept 1, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Feb 12, 2006
posts:2561
votes: 48


actually, i remember now... i think i renamed my search.php page as index.php

but that search.php is just a standalone page, which shows the search results, is that right?

just pretend that it is a normal page, and include all your html inside it -- including all the <head> and <body> stuff, and then find and remove the lines which call the template files. that is what i did i think
11:13 am on Sept 1, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


yes, it is a standalone php page. It is an ideea to start constructing my page after it, but why I can't include it in my site with this code <?php include("/path/search.php") ?>
11:26 am on Sept 1, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Feb 12, 2006
posts:2561
votes: 48


its probably because its got a load of php headers in it, and you cant call those after you have already written some stuff to the page (which you would have done in the page that "included" it)

try turning on php errors, and then you will be able to see exactly why its not working
1:49 pm on Sept 1, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


And how I do that? How I turn PHP erors on?
2:13 pm on Sept 1, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Feb 12, 2006
posts:2561
votes: 48


put these two lines at the very top of the .php file (before anything else is written)

error_reporting(E_ALL);

ini_set('display_errors', 1);


if you are including the search.php page in another file, then it needs to go at the top of the other file
2:58 pm on Sept 1, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


I have to pot these within a php statment?

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

?>
3:01 pm on Sept 1, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


It had needed with php statments :)
6:00 pm on Sept 2, 2013 (gmt 0)

New User

joined:Apr 30, 2013
posts:34
votes: 0


Man, I'm struggling and I'm struggling again, it's out of my league, but I'm not giving up, please help me.


I had activated the php errors, and so, the errors has comed:

I will post just the first error:

Warning: include(./include/commonfuncs.php) [function.include]: failed to open stream: No such file or directory in C:\Server\Apache2\htdocs\clothes.php on line 118

I finded the comonfucs.php file and I replaced the path with /localhost/sphider/include/comonfuncs.php

and the error has become:

Warning: include(localhost/sphider/include/commonfuncs.php) [function.include]: failed to open stream: No such file or directory in C:\Server\Apache2\htdocs\clothes.php on line 118

Those errors appears in my clothes.php where I had integrated the content of search.php page

Why this error appears?
This 43 message thread spans 2 pages: 43
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members