I am looking for a means of implementing a "Search" routine/page that I can apply to my site that is purely a HTML website only.
I have provided a Search box for the user but unsure what the next step is, i.e. can I insert php to perform the Search of my site.
You could set up a Google Custom Search. It has the functionality of a Google Search, it is customizable, and it is really easy to set up. All you need is a site and a Google Account.
Here's how you get started:
http://code.google.com/intl/en/apis/customsearch/docs/start.html
Related
All I want to do is a simple Google Images search. We were doing the old, really, incredibly simple way using the now completely deprecated JSON Image Search API.
That page now says it is included in Google Custom Search. The problem is that I don't want to search my own website, I want to search the web for images still. I cannot, for the life of me, find what the new way to do this is.
I have tried the Google API for PHP, it also works only with Custom Search which is only for searches on my website and not the entire web.
I have tried it using https://www.googleapis.com/customsearch/v1?key=MYKEY&cx=MYCX&q=candy and it's still searching our website only not the web in general.
Can someone point me to a documentation page that describes how to use an API to do an image search on the web in general and get results in the JSON?
You can indeed use the Google API for PHP. You just need to configure your custom search engine to search the entire web. To do this, login to your CSE settings at https://cse.google.com/cse/, and remove all sites.
Then, change 'Sites to search' to 'Search the entire web but emphasize included sites'.
Since you don't have any sites specified, it will just search the whole web.
You can test using the box on the right.
As for documentation, the CSE API is documented here https://developers.google.com/custom-search/json-api/v1/reference/cse/list#parameters
My company crawls the websites of companies in our system and allows users to search those companies specifically. We currently use Sphinx for all our search tools.
Our customers ( the companies we index ) are asking for a search widget that they can embed on their sites to add search functionality to their own websites. The search widget will allow a user to submit a search query from our customer's website. The results will then load on our site ( this search functionality is already working on our site ... just not the embeddable widget ). At first this seemed simple, but then I started thinking about security and cross domain form submissions.
The search functionality already exists on our site at a uri like this:
/companies/profile_search/1581/die-cutting
companies is my controller. profile_search is my method. 1581 is the id of the company to be searched. die-cutting is the search query.
I'd like our customers to be able to simply cut and paste code into their site to embed the widget.
Should I simply direct the search query to the above url?
If no, how should I set this up so that it's secure?
Are there other concerns I'm overlooking here?
Our site is built mostly in PHP using CodeIgniter and Sphinx for search, if that is helpful.
CodeIgniter has built-in CSRF protection, which might get in your way if you ask your customers paste a form into their sites.
The easy way to do this would be to give your customers an iframe tag to paste in, and serve the form from your site, using target="_top" to make form submissions reload the whole window.
You could also simply disable CSRF for this method only; using either a pre-system hook or, more hackishly as a conditional in config.php such as:
$config['csrf_protection'] = (stripos($_SERVER["REQUEST_URI"],'/controller/method') === FALSE) ? TRUE : FALSE;
A detailed discussion on temporarily disabling CSRF can be found here.
For cross-domain requests you can use JSONP: http://en.wikipedia.org/wiki/JSONP
As I come to the end of my project I am starting to wonder if I made it too dynamic. I have designed this social networking site and 90% of it is based on JQuery. It looks nice, it loads fast but I started to wonder if it is too dynamic...
My concern is that basically once you log in, 95% of what you do is JQuery based therefore the user never leaves the same URL. If this is true, how is a search engine like Google supposed to index my website?
Is this the part where I ask myself what parts of the site I want to be indexed and make them static pages instead?
Basically it has occurred to me that if when you browse my site for user profiles, these profiles are displayed to you through JQuery requests, then it is safe to assume that these profiles can never be found in a Google search, because the Google spider would never see it. Is this true?
Thank you for any thoughts on this,
Vini
Make your site work in both "modes". For example, I'm on my dashboard and I want to check out my friend Joe's profile, there should just be an A tag with the href set to something like "/profiles/joe".
Now, onDomReady, when the page loads, run your javascript to go through the links and attach click handers to those links, and load the profile dynamically using your existing jQuery style.
This development style is called "progressive enhancement" and allows both search engines and human accessibility devices to work better with your website. Check it out.
I am developing a search solution for my photo community web application. I am making use of Google Site Search. There are various ways to make use of it, but because I want a seamless fit with custom search result rendering, I went for the XML option.
It works really simple. I have a custom-styled search box on the site which posts to my back-end, a CodeIgniter PHP controller. The controller then will do a GET to the Google Site Search XML service, which returns me the search results in XML.
It works brilliantly and gives me full control over output rendering. There is just one little thing missing. If I search for a misspelled word, let's say "crocodilw" (should be "crocodile") I would like to get the "did you mean "crocodile?" functionality that is so common in Google.
This feature does work when you use the front-end integration method of Google Site Search. I kind of expected the correct search suggestion to be part of the return XML as well, but I can't seem to find it.
Any clues on how/if this is possible using the XML method?
This will only work on the first page (start=0) of the results. On the second page, it's gone.
http://www.google.com/cse/docs/resultsxml.html#results_xml_tag_Spelling
I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
UPDATE:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you
Google doesn't find database records. Google finds web pages. If you want your classifieds to be found then they'll need to be on a Web page of some kind. You can help this process by giving Google a site map/index of all your classifieds.
I suggest you take a look at Google Basics and Creating and submitting SitemapsPrint
. Basically the idea is to spoon feed Google every URL you want Google to find. So if your reference your classifieds this way:
http://www.mysite.com/classified?id=1234
then you create a list of every URL required to find every classified and yes this might be hundreds of thousands or even millions.
The above assumes a single classified per page. You can of course put 5, 10, 50 or 100 on a single page and then create a smaller set of URLs for Google to crawl.
Whatever you do however remember this: your sitemap should reflect how your site is used. Every URL Google finds (or you give it) will appear in the index. So don't give Google a URL that a user couldn't reach by using the site normally or that you don't want a user to use.
So while 50 classifieds per page might mean less requests from Google, if that's not how you want users to use your site (or a view you want to provide) then you'll have to do it some other way.
Just remember: Google indexes Web pages not data.
How would you normally access these classifieds? You're not just keeping them locked up in the database, are you?
Google sees your website like any other visitor would see your website. If you have a normal database-driven site, there's some unique URL for each classified where it it displayed. If there's a link to it somewhere, Google will find it.
If you want Google to index your site, you need to put all your pages on the web and link between them.
You do not have to auto-generate a static HTML page for everything, all pages can be dynamically created (JSP, ASP, PHP, what have you), but they need to be accessible for a web crawler.
Google can find you no matter where you try to hide. Even if you can somehow fit yourself into a mysql table. Because they're Google. :-D
Seriously, though, they use a bot to periodically spider your site so you mostly just need to make the data in your database available as web pages on your site, and make your site bot-friendly (use an appropriate robots.txt file, provide a search engine-friendly site map, etc.) You need to make sure they can find your site, so make sure it's linked to by other sites -- preferably sites with lots of traffic.
If your site only displays specific results in response to search terms you'll have a harder time. You may want to make full lists of the records available for people without search terms (paged appropriately if you have lots of data).
First Create a PHP file that pulls the index plus human readable reference for all records.
That is your main page broken out into categories (like in the case of Craigslist.com - by Country and State).
Then each category link feeds back to the php script the selected value regardless of level(s) finally reaching the ad itself.
So, If a category is selected which contains more categories (like states contain cities) Then display the next list of categories. Else display the list of ads for that city.
This will give Google.com a way to index a site (aka mysql db) dynamically with out creating static content for the millions (billions or trillions) of records involved.
This is Just an idea of how to get Google.com to index a database.