Implementing custom Searcher in vespa - bigdata

I have created Basic search application in Vespa with an implementation of the Searcher class. I have fed these below documents using my application one by one.
{
"fields": {
"album": "Good",
"artist": "Arijit",
"title": "tum ho",
"year": 2017,
"duration": 300
}
}
{
"fields": {
"album": "Good",
"artist": "Atif",
"title": "bewajah",
"year": 2017,
"duration": 300
}
}
{
"fields": {
"album": "bad",
"artist": "Neha",
"title": "tere",
"year": 2017,
"duration": 400
}
}
My Searcher class is below:
public class ExampleSearcher extends Searcher {
#Override
public Result search(Query query, Execution execution) {
retrun execution.search(query);
}
}
Now when I search using the API:
http://localhost:8080/search/?album=good OR http://localhost:8080/search/?=good
I got the result:
{
"root": {
"id": "toplevel",
"relevance": 1,
"fields": {
"totalCount": 0
}
}
}
But I should get this result output:
{
"root": {
"id": "toplevel",
"relevance": 1,
"fields": {
"totalCount": 2
},
"children": [{
"id": "good",
"relevance": 1,
"fields": {
"album": "Good",
"artist": "Arijit",
"title": "tum ho",
"year": 2017,
"duration": 300
}
}, {
"id": "good",
"relevance": 1,
"fields": {
"album": "Good",
"artist": "Atif",
"title": "bewajah",
"year": 2017,
"duration": 300
}
}]
}
}
What am I doing wrong or how should I do it?

To actually search the content node(s) instead of just mocking a Hello world result as in the example you'll need to add to your chain 'inherits=vespa' to the search chain configuration in services.xml.

Related

SABRE Hotel Book request is missing TravelItineraryRead in the response

I'm having an issue performing the following SABRe hotel book in the CRT environment using an orchestrated workflow.
{
"CreatePassengerNameRecordRQ": {
"version": "2.3.0",
"TravelItineraryAddInfo": {
"CustomerInfo": {
"ContactNumbers": {
"ContactNumber": [
{
"NameNumber": "1.1",
"Phone": "17805555555",
"PhoneUseType": "H"
}
]
},
"Email": [
{
"Address": "chris#test.com",
"Type": "TO"
}
],
"PersonName": [
{
"NameNumber": "1.1",
"PassengerType": "ADT",
"GivenName": "Chris",
"Surname": "test"
}
]
}
},
"HotelBook": {
"BookingInfo": {
"BookingKey": "5d07cdba-0123-4510-9f9a-5257973b5f98",
"RequestorID": "SG000000"
},
"Rooms": {
"Room": [
{
"Guests": {
"Guest": [
{
...
}
]
},
"RoomIndex": 1
}
]
},
"PaymentInformation": {
"FormOfPayment": {
"PaymentCard": {
"PaymentType": "CC",
"CardCode": "VI",
"CardNumber": "4111111111111111",
"ExpiryMonth": 3,
"ExpiryYear": "2024",
"FullCardHolderName": {
"FirstName": "Chris",
"LastName": "test",
"Email": "chris#test.com"
},
"CSC": "013",
"Address": {
...
},
"Phone": {
"PhoneNumber": "17805555555"
}
}
},
"Type": "GUARANTEE"
},
"POS": {
"Source": {
"RequestorID": {
"Type": 5,
"Id": "XXX",
"IdContext": "IATA"
},
"AgencyAddress": {
"AddressLine1": "1 Lincoln Blvd",
"CountryName": {
"Code": "US"
}
},
"AgencyName": "Flying Wings",
"ISOCountryCode": "US",
"PseudoCityCode": "1MNJ"
}
}
},
"PostProcessing": {
"EndTransaction": {
"Source": {
"ReceivedFrom": "Flying Wings Web"
},
"Email": {
"Ind": true
}
}
}
}
}
The response I get is:
{
"CreatePassengerNameRecordRS": {
"ApplicationResults": {
"status": "Complete",
"Success": [
{
"timeStamp": "2021-03-08T01:18:50.544-06:00"
}
]
},
"ItineraryRef": {
"ID": "VKIJSI"
}
},
"Links": [
]
}
So a successful booking however I am expecting a TravelItineraryRead returned in the response and am not getting one. Am I missing something in the request?
Thanks.
try redisplaing the newly created reservation.
"RedisplayReservation": {
"waitInterval": 100
}
that should include the itinerary in the response

AWS Stepfunctions dynamodb States.Runtime catch fails

My Stepfunction is supposed to check whether an item exist in the dynamo. if it does, it needs to generate the presigned url, otherwise it has to update the dynamodb item.
When it matches the item, it works as expected where as it fails when dynamo getitem output is null fails with states.runtime error. It does not going through catch statement. appreciate any help.
Here is my code.
{ "Comment": "A Hello World example of the Amazon States Language using Pass states", "StartAt": "Hello", "States": {
"Hello": {
"Type": "Pass",
"Next": "Verify item from DynamoDB"
},
"s3_url": {
"Type": "Pass",
"Result": "Hello",
"End": true
},
"Verify item from DynamoDB": {
"Type": "Task",
"Resource": "arn:aws:states:::dynamodb:getItem",
"Parameters": {
"TableName": "s3_table",
"Key": {
"etag": {
"S.$": "$.Records[0].s3.object.eTag"
}
}
},
"ResultPath": "$.DynamoDB",
"OutputPath": "$.DynamoDB.Item",
"Next": "s3_url",
"Catch": [
{
"ErrorEquals": [
"States.Runtime"
],
"Next": "DynamoDB Update"
}
]
},
"DynamoDB Update": {
"Type": "Task",
"Resource": "arn:aws:states:::dynamodb:putItem",
"Parameters": {
"TableName": "s3_table",
"Item": {
"etag": {
"S.$": "$.eTag"
},
"filekey": {
"S": "mp3Files"
}
}
},
"End": true
} } }
solved this using choice state. Open to hear any suggestions on Catch state.
Here is the code.
{
"Comment": "A Hello World example of the Amazon States Language using Pass states",
"StartAt": "Hello",
"States": {
"Hello": {
"Type": "Pass",
"Next": "Verify item from DynamoDB"
},
"s3_url": {
"Type": "Pass",
"Result": "Hello",
"End": true
},
"Verify item from DynamoDB": {
"Type": "Task",
"Resource": "arn:aws:states:::dynamodb:getItem",
"Parameters": {
"TableName": "s3_table",
"Key": {
"etag": {
"S.$": "$.Records[0].s3.object.eTag"
}
}
},
"ResultPath": "$.Records[0].DynamoDB",
"OutputPath": "$",
"Next": "Choice State",
"Catch": [
{
"ErrorEquals": [
"States.Runtime"
],
"Next": "DynamoDB Update"
}
]
},
"Choice State": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.Records[0].DynamoDB.Item.etag.S",
"IsPresent": true,
"Next": "s3_url"
}
],
"Default": "DynamoDB Update"
},
"DynamoDB Update": {
"Type": "Task",
"Resource": "arn:aws:states:::dynamodb:putItem",
"Parameters": {
"TableName": "s3_table",
"Item": {
"etag": {
"S.$": "$.Records[0].s3.object.eTag"
},
"filekey": {
"S.$": "$.Records[0].s3.object.key"
}
}
},
"End": true
}
}
}

I am creating events using microsoft graph (using .net sdk) and i found out that 2 events have same id with in a mailbox

Is this a valid scenario or a bug? Both the events are copied below.
{
"#odata.etag": "W/\"xyy/ioMMpU+5PhLPRGcb5AAAHWKktw==\"",
"id": "AAMkADZlNDUzMDYxLTQ2OTEtNDNiOC1hMDNhLTY1ZjAyMTYwZTBkOQBGAAAAAACPfBk217UgTYo6zKN7dzZsBwDHLL_KgwylT7k_Es9EZxvkAAAAAAENAADHLL_KgwylT7k_Es9EZxvkAAAdZ_YbAAA=",
"subject": "TestUtilityRunNow7_51",
"bodyPreview": "",
"body": {
"contentType": "html",
"content": "\r\n\r\n\r\n\r\n \r\n\r\n\r\n"
},
"start": {
"dateTime": "2019-03-08T12:57:15.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2019-03-08T13:02:15.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"locationType": "default",
"uniqueIdType": "unknown",
"address": {},
"coordinates": {}
},
"attendees": [
{
"type": "resource",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "Training Room",
"address": "trainingroom#wmexchangeid.onmicrosoft.com"
}
}
],
"organizer": {
"emailAddress": {
"name": "Ravinder Singh Chahal",
"address": "ravindersingh.chahal#wmexchangeid.onmicrosoft.com"
}
}
}
{
"#odata.etag": "W/\"xyy/ioMMpU+5PhLPRGcb5AAAHWKiVA==\"",
"id": "AAMkADZlNDUzMDYxLTQ2OTEtNDNiOC1hMDNhLTY1ZjAyMTYwZTBkOQBGAAAAAACPfBk217UgTYo6zKN7dzZsBwDHLL_KgwylT7k_Es9EZxvkAAAAAAENAADHLL_KgwylT7k_Es9EZxvkAAAdZ_YBAAA=",
"subject": "TestUtilityRunNow7_25",
"bodyPreview": "",
"body": {
"contentType": "html",
"content": "\r\n\r\n\r\n\r\n \r\n\r\n\r\n"
},
"start": {
"dateTime": "2019-03-08T12:30:59.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2019-03-08T12:35:59.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"locationType": "default",
"uniqueIdType": "unknown",
"address": {},
"coordinates": {}
},
"attendees": [
{
"type": "resource",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "Training Room",
"address": "trainingroom#wmexchangeid.onmicrosoft.com"
}
}
],
"organizer": {
"emailAddress": {
"name": "Ravinder Singh Chahal",
"address": "ravindersingh.chahal#wmexchangeid.onmicrosoft.com"
}
}
}

OpenRefine reconciliation service not working - mutliple vs single queries

I have been using OpenRefine 2.6 Beta 1 w/o problems since its release, and later, with the reconciliation service at:
http://reconcile.freebaseapps.com/reconcile
However, in the past fee days, I have not been able to use it all. If I go to the URL:
http://reconcile.freebaseapps.com/
and type the multiple query:
{
"query": "Ford",
"type": "/people/person",
"properties": [
{
"pid": "/people/person/place_of_birth",
"v": "Detroit"
}
]
}
I obtain:
{
"result": [
{
"id": "/m/0j8pb6y",
"name": "Ford",
"type": [
{
"id": "/people/person",
"name": "Person"
},
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/geography/mountaineer",
"name": "Mountaineer"
}
],
"notable": [],
"score": 1.1546246,
"match": false
},
{
"id": "/m/01vd3gv",
"name": "Ford",
"type": [
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/music/artist",
"name": "Musical Artist"
}
],
"notable": [],
"score": 1.0330245999999998,
"match": false
},
{
"id": "/m/0cmdhzt",
"name": "James Meredith",
"type": [
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/people/person",
"name": "Person"
},
{
"id": "/military/military_person",
"name": "Military Person"
},
{
"id": "/people/deceased_person",
"name": "Deceased Person"
}
],
"notable": [],
"score": 0.0681692,
"match": false
}
],
"duration": 369
}
But if I try a simple query:
{
"query": "Ford"
}
I get:
Status: error Error:undefined
Any insights into what's happening with the reconciliation service? Is there any other service I could use to replace freebaseapps.com?
Thanks
Try this in Queries Parameter at http://reconcile.freebaseapps.com/
{
"q0": {
"query": "Ford"
}
}
For some reason, single queries are not accepted in Query Parameter but in Queries Parameter in the format above. I have not tested this in OpenRefine, so you might have to modify it.
I don't know for certain about the date, but Freebase was announced earlier this year as being shutdown by Jun 30, 2015, for some services. Maybe service is intermittent until full shutdown? Sorry, this answer probably doesn't help much.

Open graph fitness.runs returning no data

I have a bunch of Nike+ run data which i'm assuming (based on the below article) is published to the open graph. It certainly looks that way in my timeline.
https://developers.facebook.com/blog/post/2012/08/29/early-success-stories--fitness-and-open-graph/
Frustratingly while my music.listens request works fine and returns all of my Spotify listens, my request for fitness.runs returns no data. Is this simply because Nike haven't integrated correctly with the Open Graph. Or perhaps I need to request extended permissions in my Auth token?
https://developers.facebook.com/docs/reference/opengraph/action-type/fitness.runs
Any ideas?
As with all actions you need the correct permissions, in this case
user_actions.fitness
So the data returned from /me/fitness.runs for Nike will look like
{
"data": [
{
"id": "10101118696330517",
"from": {
"name": "Philippe Harewood",
"id": "13608786"
},
"start_time": "2013-03-22T23:15:56+0000",
"end_time": "2013-03-22T23:26:36+0000",
"publish_time": "2013-03-24T15:50:00+0000",
"application": {
"name": "Nike",
"namespace": "nikeapp",
"id": "84697719333"
},
"data": {
"course": {
"id": "476811255725972",
"url": "http://nikeplus.nike.com/plus/activity/running/detail/2118587303?external_share_id=CE32E1C4-93D8-48A7-A08F-6D5B4C13EE6A&is_new_meta=true",
"type": "fitness.course",
"title": "1.12 miles"
}
},
"type": "fitness.runs",
"no_feed_story": false,
"likes": {
"count": 0,
"can_like": true,
"user_likes": false
},
"comments": {
"count": 0,
"can_comment": true,
"comment_order": "chronological"
}
},
{
"id": "10101118696155867",
"from": {
"name": "Philippe Harewood",
"id": "13608786"
},
"start_time": "2013-03-19T22:03:32+0000",
"end_time": "2013-03-19T22:18:37+0000",
"publish_time": "2013-03-24T15:49:46+0000",
"application": {
"name": "Nike",
"namespace": "nikeapp",
"id": "84697719333"
},
"data": {
"course": {
"id": "502469216483599",
"url": "http://nikeplus.nike.com/plus/activity/running/detail/2118587302?external_share_id=EBF6BC1D-BDEA-4EE5-B18D-FBC576610F13&is_new_meta=true",
"type": "fitness.course",
"title": "1.49 miles"
}
},
"type": "fitness.runs",
"no_feed_story": false,
"likes": {
"count": 0,
"can_like": true,
"user_likes": false
},
"comments": {
"count": 0,
"can_comment": true,
"comment_order": "chronological"
}
}
],
"paging": {
"next": "https://graph.facebook.com/13608786/fitness.runs?limit=25&offset=25&__after_id=10101118696155867"
}
}

Resources