Google Custom Search: how to search posts in a forum? - google-custom-search

I'm not talking about the API, just manual settings.
For example, there's a bbs including several forums whose urls are like "/domain/forum-01", "/domain/forum-02"..., and each forum has its own posts, whose urls are like "/domain/post-123", "/domain/post-456". You can infer that each forum/post has a unique id that is in the url. But it cannot be inferred just from the urls that which post belongs to which forum. Now I just want to search posts in a certain forum, say, all posts in forum "/domain/forum-01", then how should I make the Google Custom Search settings?

You can try search string in format
keyword site:http://site/domain/forum
e.g. search for:
fontaine site:http://www.startrek.com/boards/star-trek-deep-space-nine
UPDATE
In case you want "site" to be fully automatic, just use Google's Custom Search Creator. You supply the site you want to search - and it generates custom search form for you.

You can Use Refinements to narrow the scope of search.
Basically, you apply "labels" to your URL patterns. E.g.
/domain/forum-01/* has "Label A"
/domain/forum-02/* has "Label B"
Then these labels appear as tabs on your search results, each tab containing posts from a different forum.
Is that what you had in mind?

Related

Search in mutliple sites using Google Custom Search JSON

Trying to figure out how can i search in mutliple sites using Google Custom Search JSON API.
Meaning that search will be only from a specific sites list.
i was playing with the api explorer - https://developers.google.com/custom-search/v1/reference/rest/v1/cse/list?apix_params=%7B%22cx%22%3A%22011602274690322925368%3Atkz2zvvpmk0%22%2C%22siteSearch%22%3A%22www.walla.co.il%22%7D
and noticed the site search query key, but it can only accept a single string not a list of sites:
enter image description here
What is the way to search in only in specific sites?
Thanks
There's a couple things you can do.
If you know the specific sites you want to search, you can add them as refinements to your engine. Then query for that refinement by adding 'more:<REFINEMENT_LABEL>' to the query.
Or, add 'site:' operators to the query itself. For example cats site:cnn.com OR site:bbc.com

Wikipedia API for personal website

If I search any keyword on Google like "Sesame oil" it shows content from wiki at right side. Those details are informative for users.
I wanted to know, is there any API provided by WikiPedia which I can use as well? So that if any user search for any keyword, details from Wiki can be shown as well.
You can use wikipedia Search API to find articles that are the closest to the keyword. Then once you've got the title, there's a publicly available summary endpoint, which gives you title, short text extract, wikidata definition and an image for an article what you can present to the user.
As for your question about whether it's legal - yep, it totally is.

Infinite amt of Google custom search boxes per website?

I've got a site where users can create groups (we call them games)
www.ongoingworlds.com/games/270/
www.ongoingworlds.com/games/287/ etc
Each of these games has it's own user-generated content. I want to use a Google custom search for each game. But I can't see an easy way to amend the embed code to add a dynamic path, and I don't want to have to register multiple (hundreds) of GCSEs separately to get an embed code for each.
What would be the best way of allowing each of these URLs (above) to have their own GCSE?
You can search subparts of your site by using a combination of site: operator and webSearchQueryAddition parameter on gcse element.
webSearchQueryAddition appends additional search term to your user's query. If for each of the "games" you change the webSearchQueryAddition to point to the "game" base url, the search results will be matching that url. You can inject that parameter programmatically with e.g. javascript, for each of the "games".
Documentation is here: https://developers.google.com/custom-search/docs/element#supported_attributes
And here is working example:
http://jsfiddle.net/t2s5M/

Make google custom search location-aware

When I search for "football images" on google.co.uk, it knows that I mean the sport that elsewhere might be called "soccer". If I do the same search on google.com, I get American Football.
I'm using the custom search API - how can I tell it that I'm in the UK and would like results relevant to here?
You can limit your engine to operate on sites from a particular country via "cr" param, e.g. in Custom Element it looks like this:
<gcse:search cr="gb"></gcse:search>
Google knows some synonyms on the web, but if your particular use case is not correctly recognized you can add it in Control Panel in Search Features > Synonyms
More on synonyms:
Sorry, I ended up answering this myself. I couldn't get any of the instructions under the custom search API itself to work (although the answer offered above was also mentioned there, but this just made my CSE Context XML apparently invalid), but you can make requests to a custom search engine by using the instructions here https://developers.google.com/custom-search/json-api/v1/using_rest and an API key.
This is how I did it;
<gcse:search cr="countryUK"></gcse:search>
You can even return results in a specific language, code shown below returns results only in french;
<gcse:search lr = "lang_fr"></gcse:search>
This is the reference for Google Custom Search Element Control API: https://developers.google.com/custom-search/docs/element?hl=en
Try to set the 'gl' parameter to the country you want.
For details, look into CSE:list

Google autocomplete api for my site

Is it possible for google autocomplete api to specify to return results only for my site not for all sites? I see that there is param ds, but only purpose for that is to search in youtube. So how can I get autocomplete or maybe related or suggested search words only for single site?
I needed the very same thing and so far the only way I found to get this working is to create a custom search engine and then add it as a parameter to the autocomplete call:
http://clients1.google.com/complete/search?client=partner&gs_ri=partner&partnerid={0}&ds=cse
Where {0} is your custom search id
Certain features such as returning the results as XML don't work if you use the partner id but at least all the autocomplete results will be from your site.
You can also have multiple search engines and use different ones in different textboxes. Results are just a json string you parse.
Good luck