How to make a text search template?
Posted
by
Flipper
on Programmers
See other posts from Programmers
or by Flipper
Published on 2012-02-21T18:10:21Z
Indexed on
2012/09/15
9:50 UTC
Read the original article
Hit count: 252
I am not really sure what to call this, but I am looking for a way to have a "template" for my code to go by when searching for text.
I am working on a project where a summary for a piece of text is supplied to the user. I want to allow the user to select a piece of text on the page so that the next time they come across a similar page I can find the text.
For instance, lets say somebody goes to foxnews.com and selects the article like in the image below. Then whenever they go to any other foxnews.com article I would be able to identify the text for the article and summarize it for them.
But an issue I see with this is for a site like Stack Exchange where you have multiple comments to be selected (like below) which means that I would have to be able to recursively search for all separate pieces of text.
Requirements
- Be able to keep pieces of text separate from each other.
Possible Issues
- DIV's may not contain ids, classes, or names.
- A piece of text may span across multiple DIVs
- How to recognize where an old piece of text ends and a new begins.
- How to store this information for later searching?
© Programmers or respective owner