182
182 people found this article helpful
Narrow your search to a single website with this tip
Updated on November 27, 2020
What To Know
- In a Google search, type site: followed by the domain and extension, like site:lifewire.com. Then, include your search, and press Enter.
- To search by domain extension, type site: followed by the extension, like site:.gov followed by your search, and press Enter.
This article explains how to use Google to search within a single website or type of domain. It can be extremely useful when you are confident the information is on a specific site but don’t know where to look to find it. You can also limit your searches by a certain domain extension, like .gov or .edu, which can be extremely useful if you’re doing research or looking for reputable sources.
How to Search Within a Specific Website
To search within a specific website, you must enter the search following the rules that Google recognizes for such a search.
-
Click in Google’s search field.
-
Type site: in the Google search bar followed by the name of the website you want to limit the search to. There’s no need to use the http:// or the www. part of the site name, but you must include the .com or .org or another domain name. Make sure there’s no space between site: and the website address. For example: site:lifewire.com
-
Follow the website name with a single space and then type the search phrase. For example:
site:lifewire.com power search tricks
When you want to search a website for an article on a specific topic, it is better to use more than one word in the search phrase to narrow the search results. Searching only for «tricks» or «search» would be far too general in this example.
-
Press Return or Enter to begin the search.
The results will include any article from the Lifewire website that concerns search tricks.
How to Search a Single Domain
Usually searching an entire domain casts too wide a net, but if you are searching for government information, for example, you could search just within .gov sites by entering only the domain for the name. For example:
site:.gov seized property ohio
This site search is confined to all the websites in the .gov domain.
If you know the specific government agency, it is better to add it to filter your results further. For example, if you seek tax information results only from the IRS website, use:
site:IRS.gov estimated taxes
That’s not the end of the story. Google’s site: syntax can be mixed with other search syntax tricks, such as Boolean searches.
Thanks for letting us know!
Get the Latest Tech News Delivered Every Day
Subscribe
C++
I wrote this one up today. It is not the most efficient way and does not always generate the most random looking word searches but it gets the job done and it does it relatively quick.
Bonus: Supports Palindromes too!!!
It works by taking input for the word and the size of the word search. It then generates infurators by dropping letters, inserting letters, or flipping letters. It then adds those to the grid as well as the correct word. It then checks all instances of the first letter in every direction for the word. If 1 instance is not found ( 2 for palindromes ) it brute forces the cycle over. It then outputs the word search to console as well as a file.
Here it is at 213 lines of code with whitespace and comments.
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <time.h>
// Keep Track of Coordinates
struct XY {
public:
int X;
int Y;
};
// Just in case someone breaks the rules
std::string ToUppercase( const std::string& pWord ) {
char *myArray = new char[ pWord.size() + 1 ];
myArray[ pWord.size() ] = 0;
memcpy( myArray, pWord.c_str(), pWord.size() );
for ( unsigned int i = 0; i < pWord.size(); i++ ) {
if ( (int) myArray[ i ] >= 97 && (int) myArray[ i ] <= 122 ) {
myArray[ i ] = (char) ( (int) myArray[ i ] - 32 );
}
}
return std::string( myArray );
}
// Random number between a max and min inclusively
int RandomBetween( int pMin, int pMax ) {
return rand() % ( pMax - pMin + 1 ) + pMin;
}
// Find all instances of a character
std::vector<XY> FindHotspots( const std::vector<char> &pWordSearch, char pFirstChar, unsigned int pLength ) {
std::vector<XY> myPoints;
for ( unsigned int i = 0; i < pLength; i++ ) {
for ( unsigned int j = 0; j < pLength; j++ ) {
if ( pWordSearch[ i * pLength + j ] == pFirstChar ) {
XY myXY;
myXY.X = i;
myXY.Y = j;
myPoints.push_back( myXY );
}
}
}
return myPoints;
}
// Searchs each index from specific point in certain direction for word
// True if word is found
bool Found( const std::vector<char> &pWordSearch, const std::string &pWord, int pRow, int pCol, int pX, int pY, int pLength ) {
for ( unsigned int i = 0; i < pWord.length(); i++ ) {
if ( pRow < 0 || pCol < 0 || pRow > pLength - 1 || pCol > pLength - 1 )
return false;
if ( pWord[ i ] != pWordSearch[ pRow * pLength + pCol ] )
return false;
pRow += pX;
pCol += pY;
}
return true;
}
// Goes through all the hotspots and searchs all 8 directions for the word
int FindSolution( const std::vector<char> &pWordSearch, const std::string &pWord, unsigned int pLength ) {
std::vector<XY> myHotspots = FindHotspots( pWordSearch, pWord[ 0 ], pLength );
int mySolutions = 0;
for ( unsigned int i = 0; i < myHotspots.size(); i++ ) {
if ( Found( pWordSearch, pWord, myHotspots[ i ].X, myHotspots[ i ].Y, 1, 0, pLength ) )
mySolutions++;
if ( Found( pWordSearch, pWord, myHotspots[ i ].X, myHotspots[ i ].Y, 1, 1, pLength ) )
mySolutions++;
if ( Found( pWordSearch, pWord, myHotspots[ i ].X, myHotspots[ i ].Y, 0, 1, pLength ) )
mySolutions++;
if ( Found( pWordSearch, pWord, myHotspots[ i ].X, myHotspots[ i ].Y, -1, 1, pLength ) )
mySolutions++;
if ( Found( pWordSearch, pWord, myHotspots[ i ].X, myHotspots[ i ].Y, -1, 0, pLength ) )
mySolutions++;
if ( Found( pWordSearch, pWord, myHotspots[ i ].X, myHotspots[ i ].Y, -1, -1, pLength ) )
mySolutions++;
if ( Found( pWordSearch, pWord, myHotspots[ i ].X, myHotspots[ i ].Y, 0, -1, pLength ) )
mySolutions++;
if ( Found( pWordSearch, pWord, myHotspots[ i ].X, myHotspots[ i ].Y, 1, -1, pLength ) )
mySolutions++;
}
return mySolutions;
}
// Generate words that are similar
//
// 1. Word with last character same as first
// 2. Word with 1 character removed
// 3. Word with 1 character added
std::vector<std::string> GenerateInfurators( const std::string &pWord ) {
std::vector<std::string> myInfurators;
for ( unsigned int i = 0; i < pWord.size() / 2; i++ ) {
char myReplace = '0';
do {
myReplace = pWord[ RandomBetween( 0, pWord.size() - 1 ) ];
} while ( myReplace == pWord[ pWord.size() - 1 ] );
myInfurators.push_back( pWord.substr( 0, pWord.size() - 2 ) + myReplace );
}
for ( unsigned int i = 1; i < pWord.size() - 2; i++ ) {
myInfurators.push_back( pWord.substr( 0, i ) + pWord.substr( i + 1 ) );
std::string myWord = pWord;
myInfurators.push_back( myWord.insert( i, 1, pWord[ i - 1 ] ) );
}
return myInfurators;
}
// Adds word in random position in word search
void AddWordRandomly( std::vector<char> &pWordSearch, const std::string &pWord, unsigned int pLength ) {
int myXDirec = 0;
int myYDirec = 0;
do {
myXDirec = RandomBetween( -1, 1 );
myYDirec = RandomBetween( -1, 1 );
} while ( myXDirec == 0 && myYDirec == 0 );
int myRow = 0;
if ( myXDirec == 0 ) {
myRow = RandomBetween( 0, pLength - 1 );
} else if ( myXDirec > 0 ) {
myRow = RandomBetween( 0, pLength - pWord.size() - 1 );
} else {
myRow = RandomBetween( pWord.size(), pLength - 1 );
}
int myCol = 0;
if ( myYDirec == 0 ) {
myCol = RandomBetween( 0, pLength - 1 );
} else if ( myYDirec > 0 ) {
myCol = RandomBetween( 0, pLength - pWord.size() - 1 );
} else {
myCol = RandomBetween( pWord.size(), pLength - 1 );
}
for ( unsigned int i = 0; i < pWord.size(); i++ ) {
pWordSearch[ myRow * pLength + myCol ] = pWord[ i ];
myRow += myXDirec;
myCol += myYDirec;
}
}
// Checks for palindromes
bool WordIsPalindrome( const std::string &pWord ) {
for ( unsigned int i = 0; i < pWord.size(); i++ ) {
if ( pWord[ i ] != pWord[ pWord.size() - 1 - i ] )
return false;
}
return true;
}
int main() {
// Handle all input
std::string myWord;
std::cin >> myWord;
myWord = ToUppercase( myWord );
std::string myStrLength;
std::cin >> myStrLength;
unsigned int mySideLength = std::stoi( myStrLength );
// Setup variables
// New time seed
// Generate infurators
// Add words
std::vector<char> myWordSearch;
srand( ( unsigned int ) time( 0 ) );
std::vector<std::string> myWords = GenerateInfurators( myWord );
myWords.push_back( myWord );
bool myWordIsPalindrome = WordIsPalindrome( myWord );
// Brute force words until 1 instance only
// 2 instances for palindromes
do {
for ( unsigned int i = 0; i < mySideLength * mySideLength; i++ ) {
myWordSearch.push_back( myWord[ RandomBetween( 0, myWord.size() -1 ) ] );
}
for ( unsigned int j = 0; j < 10; j++ ) {
for ( unsigned int i = 0; i < myWords.size() - 1; i++ ) {
AddWordRandomly( myWordSearch, myWords[ i ], mySideLength );
}
}
AddWordRandomly( myWordSearch, myWord, mySideLength );
} while ( ( FindSolution( myWordSearch, myWord, mySideLength ) != 1 && !myWordIsPalindrome ) ||
( FindSolution( myWordSearch, myWord, mySideLength ) != 2 && myWordIsPalindrome ) );
// Output to console && text file
std::ofstream myFile( "word_search.txt" );
for ( unsigned int i = 0; i < mySideLength; i++ ) {
for ( unsigned int j = 0; j < mySideLength; j++ ) {
myFile << myWordSearch[ i * mySideLength + j ] << "";
std::cout << myWordSearch[ i * mySideLength + j ] << " ";
}
myFile << "n";
std::cout << "n" << std::endl;
}
myFile.close();
system( "pause" );
return 0;
}
I am far from a C++ expert so I’m sure there’s places where this code could be improved but I was happy with how it ended up.
Here’s the outputs.
BANANA-12:
BBBBBABANABB
BBANAAANANBB
BABAANABBABA
BNAANAAANABN
BANNNNNANBBB
AANABNNANNAA
NAANANAAAABA
ANNNBAANNNBN
ABABNAANABNA
BNNANNAAANNB
BBABAAANBBAB
BBANANNBBABB
ELEMENT-14:
MLELEMEEETNEET
EMTTELTEETELEE
EMNNELEENLNTEL
TLTNEEMEEELMTM
TLEMLNLMEEEETE
TTEEEEEENLNTLE
NETNENEEMTTMEN
ELELTETEEMNMEE
MTEEMTNEEEENEM
ELENEEEMMENNME
ELLEELELTMLETL
ETLTNEMEEELELE
EELTLLLLLMNEEE
EEEELEMNTLEEEE
ABRACADABRA-22:
ACRABAACADABBADBRRAAAA
BBABAABAARBAAAARBAABAA
RARRARBAAABRRRRAAABBRA
DABARRARABBBBABABARABR
BRBACABBAAAABAARRABDAD
ABRRCBDADRARABAACABACR
DCAAARAABCABRCAAAARAAA
AAABACCDCCRACCDARBADBA
CAARAAAAAACAAABBAACARA
ADRABCDBCARBRRRDAABAAR
RARBADAARRAADADAABAAAB
BBRRABAABAAADACACRBRAA
ARBBBDBRADCACCACARBABD
CAARARAAAACACCDARARAAA
ARABADACRARCDADABADBBA
RARAADRRABADBADAABBAAA
RAAAABBBARRDCAAAAAARRA
BABBAAACRDBABCABBBRAAR
AARARAARABRAAARBRRRAAB
BAAAARBRARARACAARAAAAA
ADCBBABRBCBDBRARAARBAA
AARBADAAAARACADABRAABB
Bonus: RACECAR-14:
RRACEARCECARAR
RRRRRRRRRCARAR
RARRAACECARAAA
CCACECRREAECAR
RECEAEEAAECEAE
RCRRREACCCCEAR
RRRARCERREERRR
CCARAAAAECCARC
ECECARRCCECCRR
CARRRACECCARAC
ACRACCAAACCCAR
ARRECRARRAAERR
RRCRACECARRCRR
RRRRACECRARRRR
I may update this to generate slightly more «random» looking word searches.
We’ve got lots of them! For best results, enter words contained within the clues (or answers) of the puzzle you’re searching for. Advanced search operators are available.
Clear
Tips
Popular Searches
weather
Fruit
pokemon
GEOGRAPHY
baseball
states
books
personal finance
health
math
Harry Potter
soccer
summer
food
hunger games
All Word Searches
You can narrow results for complex searches with Advanced Search. For example, you can find sites in German that were updated in the last 24 hours or clip art images in black and white.
Tip: In the Google search box, you can use Advanced Search filters with search operators like quotes, minus signs, and site:
. Learn more about search operators.
Go to Advanced Search from Google
Important: Advanced Search isn’t available for all types of results.
Use Advanced Search query fields
Important: Search query fields can vary across Advanced Search pages.
In Advanced Search, you can choose words or phrases to include or remove from your results. You can choose:
- “All these words”: Results use all the words you enter.
- “This exact word or phrase”: Results include one exact word or phrase you enter.
- “Any of these words”: Results include at least one of the words you enter.
- “None of these words”: Results don’t have any of the words you enter.
- “Numbers ranging from”: Results include a number between the 2 numbers you enter.
Do an Advanced Search
For webpages & files
- On your computer, go to Advanced Search: google.com/advanced_search.
- Under “Find pages with,” choose the query field/s to:
- Include exact words or a list of words in your results.
- Remove words from your results.
- Enter the words that you want to include or remove from your results.
- Add words without search operators, like quotes or minus signs.
- Under «Then narrow your results by,» choose the filters you want to use.
- You can add more than one filter.
- Click Advanced Search.
Try these filters
- Language: Find pages in a specific language.
- Region: Find pages published in a certain region.
- Last update: Find pages updated within the time you select.
- Site or domain: Search one site like
wikipedia.org
. Or, limit your results to a domain like.edu
,.org
, or.gov
. - Terms appearing: Find pages that have your search terms in a specific part of the page, like the title, text, or URL.
- SafeSearch: Remove explicit results. Learn more about SafeSearch.
- File type: Find files in a specific format, like
.pdf
,.ps
,.dwf
,.kml
,.kmz
,.xls
,.ppt
,.doc
,.rtf
, or.swf
. - Usage rights: Find pages that have license info attached to them.
For images
- On your computer, go to Advanced Image Search: google.com/advanced_image_search.
- Under “Find images with,” choose the query field/s to:
- Include exact words or a list of words in your results.
- Remove words from your results.
- Enter the words that you want to include or remove from your results.
- Add words without search operators, like quotes or minus signs.
- Under «Then narrow your results by,» choose the filters you want to use.
- You can use more than one filter.
- Click Advanced Search.
Try these filters
- Image size: Find images by size or dimensions.
- Aspect ratio: Find images that are a specific shape like tall, square, wide, or panoramic.
- Colors in image: Find full color, black and white, or transparent images. Or, search for images with a specific color.
- Type of image: Find a specific type of image like photos, clip art, or line drawings. Or, search for face or animated images.
- Region: Find images published in a certain region.
- Site or domain: Search one site like
sfmoma.org
. Or limit your results to a domain like.edu
,.org
, or.gov
. - SafeSearch: Remove explicit results. Learn more about SafeSearch.
- File type: Find images in a specific format, like JPG, GIF, PNG, BMP, SVG, WEBP, ICO, or RAW.
- Usage rights: Find images that have license info attached to them. Learn more about usages rights for images.
For videos
- On your computer, go to Advanced Video Search: google.com/advanced_video_search.
- Under “Find videos with,” choose the query field/s to:
- Include exact words or a list of words in your results.
- Remove words from your results.
- Enter the words that you want to include or remove from your results.
- Add words without search operators, like quotes or minus signs.
- Under «Then narrow your results by,» choose the filters you want to use.
- You can use more than one filter.
- Click Advanced Search.
Try these filters
- Language: Find videos in a specific language.
- Duration: Find videos that are 0–4 minutes, 4–20 minutes, or more than 20 minutes.
- Posting date: Find videos posted or updated within a specific time period, like within the past hour, day, week, month, or year.
- Quality: Limit results to HD videos.
- Site or domain: Search one site like
youtube.com
. Or, limit your results to a domain like.edu
,.org
, or.gov
. - Subtitles: Find videos with closed captions.
- SafeSearch: Remove explicit results. Learn more about SafeSearch.
For books
Important: Your search must include a search word, title, author, publisher, subject, ISBN, or ISSN.
- On your computer, go to Advanced Book Search: google.com/advanced_book_search.
- Under “Find results,” choose the query field/s to:
- Include exact words or a list of words in your results.
- Remove words from your results.
- Enter the words that you want to include or remove from your results.
- Add words without search operators, like quotes or minus signs.
- In the next section, choose the filters you want to use.
- At the top right, click Google Search.
Try these filters
- Search: Choose what to include in your search, like:
- Books with a limited preview or full view available.
- Books with a full view available only.
- Google eBooks only.
- Content: Limit results to a specific type, like books, magazines, or newspapers.
- Language: Find books written in a specific language.
- Title: Enter the title of a book.
- Author: Find books written by a certain author.
- Publisher: Limit results to a certain publisher.
- Subject: Find books about a specific topic.
- Publication date: Limit results to books published between specific dates.
- ISBN: Find a book by its International Standard Book Number (ISBN).
- ISSN: Find a book by its International Standard Serial Number (ISSN).
Related resources
- How to search on Google
- Refine web searches
- Filter your search results
- Find images you can use and share
- Search with an image on Google
Was this helpful?
How can we improve it?
in my search form, if the user types ‘good’, it displays all the results which contain the keyword ‘good’. however if the user types in ‘good sweetest’, it displays no results because there is no record with the two words appearing together; BUT appearing in an entry at different places.
for example, the record says:
A good action is an ever-remaining
store and a pure yield
the user types in ‘good’, it will show up this record, but if the user types in ‘good’ + ‘pure’, it will not show anything. or if the record contains the keyword ‘good-deeds’ and if the user types in ‘good deeds’ without the hyphen, it will not show anything.
what i would like is that if the user types in ‘good’ + ‘pure’ or ‘good deeds’ it should records containing these keywords highlighting them.
search.php code:
$search_result = "";
$search_result = $_POST["q"];
$search_result = trim($search_result);
//Check if the string is empty
if ($search_result == "") {
echo "<p class='error'>Search Error. Please Enter Your Search Query.</p>" ;
exit();
}
if ($search_result == "%" || $search_result == "_" || $search_result == "+" ) {
echo "<p class='error1'>Search Error. Please Enter a Valid Search Query.</p>" ;
exit();
}
$result = mysql_query('SELECT cQuotes, vAuthor, cArabic, vReference FROM thquotes WHERE cQuotes LIKE "%' . mysql_real_escape_string($search_result) .'%" ORDER BY idQuotes DESC', $conn)
or die ('Error: '.mysql_error());
function h($s) {
echo htmlspecialchars($s, ENT_QUOTES);
}
function highlightWords($string, $word)
{
$string = preg_replace("/".preg_quote($word, "/")."/i", "<span class='highlight'>$0</span>", $string);
/*** return the highlighted string ***/
return $string;
}
?>
<div class="caption">Search Results</div>
<div class="center_div">
<table>
<?php while ($row= mysql_fetch_array($result, MYSQL_ASSOC)) {
$cQuote = highlightWords(htmlspecialchars($row['cQuotes']), $search_result);
?>
<tr>
<td style="text-align:right; font-size:18px;"><?php h($row['cArabic']); ?></td>
<td style="font-size:16px;"><?php echo $cQuote; ?></td>
<td style="font-size:12px;"><?php h($row['vAuthor']); ?></td>
<td style="font-size:12px; font-style:italic; text-align:right;"><?php h($row['vReference']); ?></td>
</tr>
<?php } ?>
</table>
</div>
search.html:
<form name="myform" class="wrapper">
<input type="text" name="q" onkeyup="showUser()" class="txt_search"/>
<input type="button" name="button" onclick="showUser()" class="button"/>
<p>
<div id="txtHint"></div>
</form>