I am going thru IndexDB or lovefield but so far could not find way to search partial text like we do in SQL queries via LIKEkeyword. Can someone guide me how could it be achieved?
lovefield has the match function for pattern matching which is similar to the SIMILAR keyword in SQL which inturn is similar to the LIKE keyword. Please have a look at it and see if it does the job
https://github.com/google/lovefield/blob/master/docs/spec/04_query.md
What I want to achieve is that when I focus on the search bar, it should show me a list of recent searches done during this session and I should be able to select one of them and it should appear on the textbook.
Any help appreciated. If possible I woul like to store these recent searches data to browser cache so that whenever I reach this website it should show me the list.
Thanks in advance.
Assuming you will be using a web based language like html or JavaScript, a good start would be to store each search in an array.
using javascript along with the jQuery library you can easily add items to an array each time a user clicks a button.
JavaScript:
var myArray = [];
myArray.push($('#yourTextBox').val());
Then you could use jquery's $.each function to display each item in a DOM element.
See the sample below: (I used HTML and javascript with jquery 1.11)
http://jsfiddle.net/1ncf0b6f/3/
TL;DR I've written a library to handle this + it's edge cases, see https://github.com/JonasBa/recent-searches#readme for usage.
You should store the recent searchees in LocalStorage and retrieve them, then decide on your implementation on how you want to render them. This obviously has some edge cases that you need to consider, which is why I wrote a library to do exactly this, see below examples
Examples
Expiration:
Consider that someone searches for a query iPhone, but has looked for a query repairing iPhone 1 month ago, that repairing iPhone query is likely obsolete.
Ranking of recent searches
Same goes for ranking when doing prefix search, if a user has made a query "apple television" 3h ago and a query "television cables" 8h ago, and they now search for "television", you want to probably implement a ranking system for the two.
Safely handling storage
Just writing to LocalStorage will result in a massive JSON that you'll need to parse every time, thus gradually slowing down your application until you hit the limit and loose this functionality.
I've built a recent-searches library which helps you tackle all that. You can use it via npm and find it here. It will help you with all of the above issues and allow you to build recent-searches really quickly!
Is it possible to use gdata javascript or any other javascript api to retrieve the list of blog posts based on labels?
My usage case:
Each blog post has a label that means its category. Some posts are labelled with 'Summary' and the category it belongs.
I want to be able to display the summary of MyCategory(Label) on the label's page. e.g. http://myblog.blogspot.com/search/label/MyCategory
Is it possible to retrieve the list of blog posts matching 'Summary' and 'MyCategory'?
UPDATE:
more details:
it is a blog I have edit access to
the js can be placed on google sites or inside the blog html
the blog has 18k+ posts, so listing all posts and filtering is not an option.
myblog.blogspot was referring to any blogger, not the actual one. I was just talking about label-based blogger filter.
I've read and re-read this question and blogspot-link a couple of times. It's difficult to understand.
I think it would help if you gave some more information:
where do you want to place this javascript? I mean: is it going to be
placed on the same blog? I'm asking because this determines cross-site security requirements.
I have a strong feeling this is actually a question where you want to a cross-domain request (load data from a different domain|server (blogspot.com)) that you do not control, otherwise you'd be playing with 'Access-Control-Allow-Origin' on the server-side.
Will this script be located in a online or local (x)html source?
Could you please provide a more elaborate example (or sample) of an existing list that contain's this labels, or do you want to crawl a blog like a spider|index-robot?
If the above assumptions are correct, the first part of your problem is retrieving cross-domain data (which is hard nowadays using simple solutions like XMLHttpRequest aka AJAX).
You could then start looking at some own server-side scripts (php) to get this data and send it (pre-parsed) to your browser-application (effectively this is simply a proxy located on your own domain).
I have also heard of using a java-object (or silverlight? or flash which nowadays also suffers from cross-domain-security restrictions), to get around this modern day cross-domain security.
You could then embed one or more of these objects (that retrieve the source) and communicate with them through javascript. A variation of this technique is also often used for cross-browser multiple file-uploads.
There is a big chance there is already a solution (object) to this part of your problem here on StackOverflow.
If you fix this first part of the problem, the second part of your problem simply comes down to parsing (regex for example) your retrieved 'label'-data, building new links from them to retrieve the 'summary'-content you where after, using the same data-retrieval technique that was used to get the labels-list in the first place..
Is this what you are after?
UPDATE:
In pure javascript/json there is an excellent topic here on SO.
Should you go with java, you could look at this.
In php you use file_get_contents() or file_get_html(). See also this topic on SO.
UPDATE2: The accepted ANSWER (out of comment's below:)
On google's developers blogger docs 2.0 you can find: RetrievingWithQuery.
Quote:
/category
Specifies categories (also known as labels) to filter the feed results. For example,
blogger.com/feeds/blogID/posts/default/-/Fritz/Laurie returns entries
with both the labels Fritz and Laurie.
You can also find a working piece of javascript that uses this technique over here: list-recent-posts-by-label
Now you can simply continue 'AJAX'ing your summary's out of this filtered list.
Good luck!
I am wanting to make a Javascript widget that can pull "X" number of the most recent posts from a RSS Feed.
My question is:
What is the fundamentals that i should be looking into in order to achieve this?
AJAX or JSON/script-tag methods of retrieving remote data from the browser (or writing a server-side proxy to retrieve data and set it up for your widget to consume from the browser)
DOM manipulation, for formatting your data into markup on a page
CSS for styling your markup
Yahoo! Pipes can be very helpful for this sort of thing... this Pipe can take your X and your RSS feed URL and return JSON for you to work with in JavaScript, saving tons of time... http://pipes.yahoo.com/pipes/pipe.info?_id=2FV68p9G3BGVbc7IdLq02Q
does Google index content generated using javascript I'm using this function to write the text
document.write(String.fromCharCode(...))
something like that
document.write(String.fromCharCode(60,112,62,65,100,100,32,100,101,115,99,114,105,112,116,105,111,110,32,102,111,114,32,121,111,117,114,32,65,114,116,105,99,108,101,32,102,114,111,109,32,104,101,114,101,46,60,47,112,62,10));
and if Google don't index javascript will it regard this code as malicious as this function is also used to generate malicious javascript codes of course I'm not using malicious
Thanks in advance.
Yes/No
Google WILL index content if you give it some hints. For example, you'd need to use the #! format and your URLs need to resolve WITHOUT the #!. Like Twitter:
http://twitter.com#!/oscargodson and http://twitter.com/oscargodson work. Google sees a link to the first link then forwards onto the second.
For random bits of JS though? Most likely not. Google doesn't give out specific details to their algorithm. They have quitely switched to indexing PDFs, Flash, Docs, and more when before they said they didn't. With the rise of JS, i wouldn't be surprised if they officially did tho sometime soon.
Here are Google's docs on it:
http://code.google.com/web/ajaxcrawling/
Yes. As of May of 2014, they publicized their move.
http://googlewebmastercentral.blogspot.com.es/2014/05/understanding-web-pages-better.html