Bing API Azure Marketplace: how to know whether there are more results? - bing-api

I am using the Bing Search API in Windows Azure Marketplace (i.e., the API that replaces the old Bing 2.0 API, that expires on 1st August 2012). The Migration Guide provided by Microsoft states:
If there are no more pages of results, the /feed/link[#rel=’next’] property will no longer appear [...].
However, it seems that this is not always the case. For example, a News query for "Roger Federer" does not contain a link element:
Request: https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query=%27"Roger+Federer"%27
Response:
<feed xmlns:base="https://api.datamarket.azure.com/Data.ashx/Bing/Search/News"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns="http://www.w3.org/2005/Atom">
<title type="text">"Roger Federer"</title>
<subtitle type="text">Bing News Search</subtitle>
<id>https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query='"Roger Federer"'</id>
<rights type="text"/>
<updated>2012-07-26T15:43:03Z</updated>
<entry>
<!-- ... -->
</entry>
<!-- ... -->
</feed>
Nevertheless, there are more news: https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query=%27"Roger+Federer"%27&$skip=50
Does anybody know where the problem might be? (Or where there is reliable documentation for the API?)

One thing to do is to update your BingSearchContainer.cs - I found there was an older version when I first started using it that caused me all sorts of problems like this. When I updated a lot of things started working.
I think the problem is that the BingSearchContainer is "fixing" your query and messing you up. Try the following:
Then try to do the query without the " marks. It will probably succeed and return results.
Try to use ' instead, you will probably get some results.
I think the container is escaping all your queries as a single phrase match by default. So just adding a search will work. Now when you really do have two phrases you need to search for... That I can't get working yet either.

I cannot reproduce this anymore: the response now contains a link element.
I suppose the Bing guys have fixed the problem in the meantime.

Related

Generating Dynamic SSML from "HTTP Request" to be used on a "Get Input"

I'm wondering if anyone can be of assistance.
I am trying to generate some dynamic Amazon Polly SSML to be used on the Plivo PHLO platform. When someone dials into a particular number, they should be greeted with a custom message (in a particular language) and prompted to enter a number.
I have an HTTP request that hits my API, which receives the request and generates the SSML using Plivo's PHP Server SDK.
$response = new Response();
$speak_elem = $response->addSpeak($result['text'], ['language'=> 'en-US, 'voice'=>"Polly.Joanna"]);
Header('Content-type: text/xml');
die( $response->toXML() );
It seems to me that this HTTP Request is working perfectly and returning perfect SSML. When I copy and hard-code-paste the SSML into the Get Input node, it works OK.
<?xml version="1.0" encoding="utf-8"?>
<Response><Speak language="en-US" voice="Polly.Joanna">Welcome To 101 Broadway. For English, press 1.</Speak></Response>
However, when I try to add a Get Input component and link it's "prompt" audio to the resulting SSML, I am getting an error that says Invalid SSML (See Screenshots at the bottom).
WHAT I'VE TRIED
I've tried returning the SSML in plain XML and using {{HTTP_Welcome.response}}
I've tried returning the SSML as text in a JSON object called SSML and using {{HTTP_Welcome.response.SSML}}
I've tried returning the SSML both with and without the xml tag.
I've tried returning the SSML both with and without the Result tag.
I've tried taking a break and coming back to it. Hey, you never know.
No matter how I return the SSML, and how I try to link it to the Get Input prompt, I am unsuccessful. I'm starting to wonder if this is even possible?
Any help would be immensely appreciated. Thanks!
SCREENSHOT 1
SCREENSHOT 2
My name is Mohammed Huzaif, and I work for Plivo as a Developer Evangelist.
Unfortunately, the "GetInput node" in PHLO does not yet implement the feature you are searching for. The best option is to use a standard speak which is customisable in your way, which may have a less natural feel than SSML.
Currently, I've narrow information about your use case as of now but If you still want to use a custom SSML, I'd recommend utilising a framework instead of PHLO to design your call flow. Here's a tutorial that covers a few use cases by Plivo in several frameworks to help you develop one.
If you experience any problems, please feel free to contact our support team.

Microsoft Speech Synthesizer Lexicon not working

I have followed the example here for adding a custom lexicon to my speech SSML. However, it is being ignored. I tried it with my own lexicon and also with the sample. At first the sample seemed to work, but when I removed the lexicon it still expanded out BTW as "By the Way" so it appears it was having no impact for the sample either.
For reference, here is the sample code used to create the lexicon
<?xml version="1.0" encoding="UTF-8"?>
<lexicon version="1.0"
xmlns="http://www.w3.org/2005/01/pronunciation-lexicon"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/01/pronunciation-lexicon
http://www.w3.org/TR/2007/CR-pronunciation-lexicon-20071212/pls.xsd"
alphabet="ipa" xml:lang="en-US">
<lexeme>
<grapheme>BTW</grapheme>
<alias>By the way</alias>
</lexeme>
<lexeme>
<grapheme> Benigni </grapheme>
<phoneme> bɛˈniːnji</phoneme>
</lexeme>
</lexicon>
And here is the sample SSML (in which the lexicon is ignored)
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"
xmlns:mstts="http://www.w3.org/2001/mstts"
xml:lang="en-US">
<voice name="en-US-JennyNeural">
<lexicon uri="MY_PATH_TO/customlexicon.xml"/>
BTW, we will be there probably at 8:00 tomorrow morning.
Could you help leave a message to Robert Benigni for me?
</voice>
</speak>
I have tried accessing the lexicon from local storage as well as from a site hosted by Azure App Service. I also looked to see if the Javascript had any sort of "addLexicon" method within SpeechConfig or SpeechSynthesizer, but I couldn't find anything. Anyone have any ideas why this isn't working and what I need to do to fix it?
According to Microsoft, a path to the lexicon on your local machine does not work. It must be hosted on the web somewhere. If you have any app service plan, this is extremely lightweight (it's just hosting an XML file) so you can just create a new app service to host it. Of course if you have other methods to expose files via web uri that should work fine too.
Also, I was having issues with the hosted files using sapi alphabet. The alphabet abbreviation in the documentation is incorrect. It should be x-microsoft-sapi, not just sapi. Once I corrected that I was able to get both ipa (which is correct as ipa) and sapi lexicons working when hosted on a remote server.

How can I index sub-community discussions and events?

I have written a custom crawler to index all the data from the connections seedlists
https:///forums/seedlist/myserver
When we started utilizing subcommunities, I double checked to make sure subcommunities behave practically the same as communities. They seem to, they have all the same properties in the Connections DB, just subs have a parent uuid. Got it.
I expected my crawler to find the sub communities discussions (basically just iterating through the atom feed with a Java XML parser) and pulling out the relevant information. Are subcommunities not published to this seedlist? If not, there does not seem to be a subcommunity specific seedlist.
We are currently on Connections 4.5
Thank you.
I have found the answer here.
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Community_entry_content_ic45&content=pdcontent
There seems to be an additional element that links to the sub-community feed from within the community. A crawler will need to send a GET request to that link.

IBM SBT: Updating a subcommunity breaks subcommunity relation?

I have implemented creation of subcommunities using IBM SBT 1.0.2.20140527-1807 against IC 4.5 (thanks for heavy API changes from 1.0.1 :-/ ) and want to update a freshly created subcommunity with a nice "content" containing some HTML with links to some content inside this community. Thus I must first create the subcommunity and afterwards update the "content" attribute, because I need some data not yet present before successful creation.
The way I do this is basically as follows:
(1) Create subcommunity [proven successful, and it IS a subcommunity now]
(2) Fetch the new subcommunity using CommunityService.getCommunity(communityUuid) [proven successful]
(3) execute community.setContent(string) [no errors]
(4) execute CommunityService.updateCommunity(community) [no errors]
The REST request created and sent for CREATE is:
POST /communities/service/atom/community/subcommunities?communityUuid=8ea4ff45-ef58-4c9b-b131-def2d3e233f7
The XML data sent is:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">mytitle</title>
<content type="html">mycontent</content>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="mytag"></category>
<snx:communityType xmlns:snx="http://www.ibm.com/xmlns/prod/sn">private</snx:communityType>
</entry>
The REST request created and sent for UPDATE is:
PUT /communities/service/atom/community/instance?communityUuid=ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7
The XML data sent is:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">mytitle</title>
<content type="html">mycontent</content>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="mytag"></category>
<snx:communityType xmlns:snx="http://www.ibm.com/xmlns/prod/sn">private</snx:communityType>
<snx:communityUuid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7</snx:communityUuid>
<id>http://communities.ibm.com:2006/service/atom/community/instance?communityUuid=ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7</id>
</entry>
Afterwards the content is indeed updated -- but the community is not a subcommunity any more, but a regular top level community.
Why is that?
What can I do about it?
For the impatient: I have found the root cause, and in some circumstances this offers the possibility for a workaround.
The root cause is that the Community representation in IBM SBT SDK (Java) currently (as of July 2014) does not offer a "parent community URL" element.
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Community_entry_content_ic45&content=pdcontent says that a community XML representation has a <link rel="http://www.ibm.com/xmlns/prod/sn/parentcommunity" type="application/atom+xml" href="..." /> element (where href is the atom/instance URL, not the "community URL" with html/communityview) if it represents a subcommunity, which is ignored on PUT/POST -- but:
THIS IS NOT TRUE:
In fact this element is REQUIRED on PUT to keep a community's "sub community" nature on change. And worse: If it is broken, it cannot be "repaired": Because of other limitations for subcommunities, an existing community cannot be changed to become a subcommunity of another top level community. Subcommunities can only be CREATED (and kept, of course).
What I have done to work around that pitfall is to subclass Community and some other classes to extend the XML marshal/unmarshal mechanisms in SBT SDK to cope with parent community URLs. If you know what you're doing everything is fine, but if you want generic code which simply does not break subcommunities, you must also READ ALL COMMUNITIES as if they may be subcommunities. If you don't, you won't see this information and write back the community as top level community.
Thus it is better to wait if you can :-(
I expect IBM to extend the implementation of Community and related classes by a parent community URL field. What I am curious about is how they will deal with the fact that the complete Atom feed URL is required, including the server address and the parent community UUID. I took the q&d way and changed the community URL as returned by parentCommunity.getCommunityUrl(), but this eventually does not take into account the various AUTH variants.
IBM SBT SDK 1.1.0 of Jul 17, 2014, seems to be out. At least it is available in Maven central.
This is the better answer of course but will require several code adjustments if you have built code on top of internal structures due to some internal refactorings.

Ellipsis in Firefox without going to Mozilla.org

In order to get ellipsis to work in Firefox, I need to create an extra XML file that makes several references to Mozilla.org to get the Firefox to recognize the CSS3 text-overflow feature.
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
However, if possible, I will like to not having to refer Mozilla.org at all if I can get all the definitions locally on the web servers just in case if the web servers blacklist Mozzila.org.
And curiously "http://www.mozilla.org/xbl" returns a 404 error but the xmlns is definitely required, otherwise ellipsis will not work.
Please let me know if anyone has a better solution.
Thanks,
badallen
The url is really just an identifier that is unique. The fact it looks like a url is just because that is an easy way to create an unique identifier.

Resources