Represent the search result by adding relevant description - search-engine

I'm developing simple search engine.If I search some thing using my search engine it will produce the list of urls which are relating with that search query.
I want to represent the search result by giving small,relevant description under each resulting url.(eg:- if we search something on google,you can see they will provide small description with the each resulting link.)
Any idea..?
Thank in advance!

You need to store position of each word in a webpage while indexing.
your index should contain- word id , document id of the document containing this word, number of occurrence of the word in that document , all the positions where the word occurred.
For more info you can read the research paper by Google founders-
The Anatomy of a Large-Scale Hypertextual Web Search Engine

You can fetch the meta content of that page and display it as a small description . Google also does this.

Related

Supported search queries with OneDrive

What values the 'search-text' can take in the following query?
GET /me/drive/root/search(q='{search-text}')
From experiments, it looks like the {search-text} is a single string that would be searched in the contents of the file. Meaning if the search text is a multiple word sentence then entire sentence is searched rather than individual works in the sentence? Is this right assumption?
Eg: Say If I would like to search 'word1' 'word2' ... 'wordn' then it looks like search query should be issued for all the n words individually. Is there a format/way in which we can search all the n words in single query?
Thanks,
/Girish BK
Searching is phrase based and does not support wildcards or similar search augmentations.
For example, the query /me/drive/search(q='pizza shop') would search for files that contain the phrase "pizza shop" in a filename, a file's metadata, and a file's content.

Search Engine for a blog_website(searching inside links )

I created a very basic search option for my blog, and as per topics and key words it is generating results but what i am looking for is in certain articles i have to add links so if my search can go through those links that are basically external websites for example if i am referring to someone else blog for more information then search to find from that.Is it possible ? And i don't want to go for GCSE.
Thanks in advance. It will be of great help.
Thanks again.
Yes, it is possible to write a bot to crawl external websites from links. I've made one. It crawled 100K+ website URLs. So yes, it is possible to make one, which can crawl links from your blog.
To create a search engine, you'll need to know some internals regarding how they work...
Search Bots work like this:
Crawler fetches pages. This step is pretty easy, as it uses curl.
Parser splits the HTML into pieces, so that data can be extracted from the page. This has 2 sub-components to it, which...
a. Extracts any data from the page that you want to capture & then saves that data into a database.
b. Extracts links & places them back into the crawling queue. This creates an infinite loop, so your bot never stops crawling... (Unless someone else's malformed URL crashes it, which happens a lot. So be ready to frequently fix it.)
Indexer creates lookup indexes, which map keywords to the web page's contents. This has 2 sub-components to it, as it...
a. Creates a Forward Index, which maps each document to keywords that are inside of that document.
doc1 | bird, aviary, robin, dove, blue jay, cardinal
doc2 | birds, bird watching, binoculars
doc3 | cats, eat, birds
doc4 | cats, generally, don't, like, water, nor, neighborhood, dogs
doc5 | dog, shows, look, fun
b. Creates an Inverted Index from the Forward Index, which reverses the indices. This allows users to search by keyword & then the search script looks up & suggests which documents, that users may want to view. Like so...
bird | doc1, doc2
cat | doc3, doc4
dog | doc4, doc5
Search Forms work like this:
Search Form shows the HTML input box to the user.
Search Script will search the Inverted Index to find which document links to display in the Search Engine Results Page.
Search Engine Results Page (yes, SERP is an actual industry acronym for Search Engine Results Page). This displays the list of search result links. You can style it any way that you'd like & it doesn't have to look like Google's, Microsoft's Bing nor Yahoo's engines.
Examples:
Searching for:
"bird" returns links to "doc1, doc2"
"cat" returns links to "doc3, doc4"
"dog" returns links to "doc4, doc5"
Good luck building your search engine for your blog!

Identifying the most relavant document in a information retrieval system

I am developing a search engine modeled after google in my spare time.
I am using the original google research paper located at http://infolab.stanford.edu/~backrub/google.html as my guideline.
As i am developing a very very simplified version of google i am not using pagerank algorithm at all for now.
So far i have developed a simple parser and indexer whose result is that i have an inverted index containing number of hits, hit location and document hash against each unique word.
Now i am trying to develop a query engine. However i am finding it hard to identify the most relevant document for a multi token query.
Specifically lets say i am having difficulty in calculating the proximity of the query words to each other in a document.
I have thought of a algorithm that scans each document for the query words and calculates the proximity score based on how much the query words are close to each other however i suspect this would take a long time, and i think there is a better way to do this of which i am not aware and the research paper is too general to get an answer.
I am just looking for a pointer in the right direction.
Any sort of help would be very very very appreciated.
Look at the inverted index section of "Search Engine Indexing" on Wikipedia http://en.wikipedia.org/wiki/Search_engine_indexing#Inverted_indices
Basically, you want to save the position information of a given word within a document, this makes it easy to compute proximity. This information is saved in the index.
The key point is to index your documents so you don't need to scan them every time. The search for keywords is done on the index that points to the documents containing those keywords.
P.S. don't forget that you're trying to keep the index as small as possible, so storing gaps or differences for word positions will save same memory (as explained in: J. Zobel, A. Moffat - Inverted Files for Search Text Engines at page 23).

How can I smartly extract information from an HTML page?

I am building something that can more or less extract key information from an arbitrary web site. For example, if I crawled a McDonalds page and wanted to figure out programatically the opening and closing time of McDonalds, what is an intelligent way to do it?
In a general case, maybe I also want to find out whether McDonalds sells chicken wings, or the address of McDonalds.
What I am thinking is that I will have a specific case for time, wings, and address and have code that is unique for each of those 3 cases.
But I am not sure how I can approach this. I have the sites crawled and HTML and related information parsed into JSON already. My current approach is something like finding the title tag and checking if the title tag contains key words like address or location, etc. If the title contains those key words, then I will look through the current page and identify chunks of content that resemble an address, such as content that are cities or countries or content that has the word St or Street inside.
I am wondering if there is a better approach to look for key data, and looking for a nicer starting point or bounce some ideas and whatnot. Or even if there are good articles to read about this would be great as well.
Let me know if this is unclear.
Thanks for the help.
In order to parse such HTML pages you have to have knowlege about their structure. There's no general solution for this problem. Each webpage needs its own solution. However, a good approach would be to ensure the HTML code is valid XML too and then use XPath to access elements at known positions. Maybe there's even an XPath like solution for standard HTML (which is not always valid xml). This way you can define a set of XPaths for each page which give you the specific elements if they exist.

Two pages with the same title and/or meta-description within one domain

Is there any penalty on Google rankings for using two pages with the same title and/or meta-description? If so, what is the penalty?
Both pages are on the same domain. One page URL is example.com/abcd and the other page URL is example.com/uvwxyz. The H1 header for both pages is the same, and both have the same meta-description.
I don't think Google would punish this.
Think of YouTube (which is owned by Google): The content of the title element follows this schema: [user-contributed video title] - YouTube. The meta-description consists of the user-contributed video description.
Now, there are probably thousands of videos with the very same title ("My cute cat") and some of them could even have the same description ("See my cute cat").
However, if a website consists of many (or even only) pages with same title and meta-description, it gambles away the possibilty for a better ranking. But when all these pages really have different content, it won't be punished.
Title, Meta Description are among the signals which search engines uses to identify topic of the page and rank them in search results. Weight of Title is high in search rankings & both title/description are displayed in search results along with URL.
As you have mentioned content of both pages are different, than by
having duplicate title/description you are loosing some opportunity
of targeting different keywords for search rankings.
Having same title/description makes it difficult for both user as well as search
engines to identify & differentiate between them.
Even though there is no negative influence, but you are loosing on important signal (title) which can help in improving search ranking.
Some ref reading on title: http://www.searchenabler.com/blog/title-tag-optimization-tips-for-seo/
& duplicate content: http://www.searchenabler.com/blog/learn-seo-duplicate-content/
There is not a punishment per se' it just isn't best practice to use. Why will you have duplicate meta information? Is the information the same on each page? Does it need to be?

Resources