Thursday, June 01, 2006

Google Search prefixes

Some Google Search prefixes:
  • link:url Shows other pages with links to that url.
  • related:url same as "what's related" on serps.
  • site:domain restricts search results to the given domain.
  • allinurl: shows only pages with all terms in the url.
  • inurl: like allinurl, but only for the next query word.
  • allintitle: shows only results with terms in title.
  • intitle: similar to allintitle, but only for the next word. "intitle:imagesh Free image hosting" finds only pages with webmasterworld in the title, and google anywhere on the page.
  • cache:url will show the Google version of the passed url.
  • info:url will show a page containing links to related searches, backlinks, and pages containing the url. This is the same as typing the url into the search box.
  • spell: will spell check your query and search for it.
  • stocks: will lookup the search query in a stock index.
  • filetype: will restrict searches to that filetype. "-filetype:doc" to remove Microsoft word files.
  • daterange: is supported in Julian date format only. 2452384 is an example of a Julian date.
  • maps: If you enter a street address, a link to Yahoo Maps and to MapBlast will be presented.
  • phone: enter anything that looks like a phone number to have a name and address displayed. Same is true for something that looks like an address (include a name and zip code)
  • site:www.somesite.net (tells you how many pages of your site are indexed by google)
  • allintext: searches only within text of pages, but not in the links or page title
  • allinlinks: searches only within links, not text or title

Tuesday, May 30, 2006

Little PHP tip: to get a shorter string.

It's simple, but helpful to get the shorter string (for abstract,...)

$num_words=10; // No. of words to get
$i=0;
$array=explode(" ",$longString);
$new_array=array();
$total=count($array);
while (($i<$num_words) && ($i<$total))
{
$new_array[]=$array[$i];
$i++;
}
$shortString = implode(" ",$new_array);

You can then make a function for reusing.

function shortString($longString,$num_words)
{
$i=0;
$array=explode(" ",$longString);
$new_array=array();
$total=count($array);
while (($i<$num_words) && ($i<$total))
{
$new_array[]=$array[$i];
$i++;
}
return implode(" ",$new_array);
}
Cheer!