Im using azure search. I have my id field set as retrievable yet its not getting returned in my search results. Do you guys know why? I only see: document object -> key value, in the search result of an individual document. (Im using the .net SDK)
I want this ID to do a document lookup and serve the real document to the consumer.
public static DocumentSearchResult GetSearchResult(ISearchIndexClient indexClient, string searchTerm)
{
SearchParameters parameters;
DocumentSearchResult results;
parameters =
new SearchParameters()
{
Select = new[] { "content" }
};
results = indexClient.Documents.Search(searchTerm, parameters);
return results;
}
I found out that i could put ID in searchparameters to retrieve it. This feels unnatural though..
I found out that i could put ID in searchparameters to retrieve it.
parameters =
new SearchParameters()
{
Select = new[] { "content", "id" }
};
As a side note: to serve the document to the caller you need to add the metadata_storage_path to the index (and to the searchparameters to retrieve it as a searchresult)!
https://learn.microsoft.com/en-us/azure/search/search-howto-indexing-azure-blob-storage
Related
I am using a reference field, which contains users nickname, to make a connection between my main collection and 'public data' collection created as default by Wix. I created this reference field to populate a repeater from the two 'main' and 'public data' collections. Is it possible to automatically fill a reference field without using code? If not, then how can use 'beforeInsert' hook to fill the 'the reference' field using code.
I tried to do so in the backend by this code, but it doesn't work.
import { currentMember } from 'wix-members-backend';
export function Collection1_beforeInsert(item, context) {
currentMember.getMember()
.then((member) => {
const id = member._id;
const fullName = `${member.contactDetails.firstName} ${member.contactDetails.lastName}`;
const nickname = member.profile.nickname
console.log(nickname)
item.referenceField= "nickname"
// return member;
})
.catch((error) => {
console.error(error);
});
return item;
}
First off, I'm assuming you're using a regular reference field and not a multi reference field.
Second, it's important to understand how reference fields work before continuing. The reference field holds the ID of the item it is referencing. So when you say the reference field contains a user's nickname, that can't be true. It can contain the ID of the item in PrivateMembersData collection with the nickname you want.
Third, as just mentioned, the nickname field does not exist in the PublicData collection. It is part of the PrivateMembersData collection.
So, if you want to connect your collection to another with the nickname field, you need to set your reference field to reference the PrivateMembersData collection and then store the proper ID in that field.
(Side point: In your code you are putting the same string, "nickname", in every reference field value. You probably meant to use nickname without the quotes. You're also not using promises correctly.)
You can try this code. It should get you closer to what you're looking for.
import { currentMember } from 'wix-members-backend';
export async function Collection1_beforeInsert(item, context) {
const member = await currentMember.getMember();
item.referenceField = member._id;
return item;
}
I am storing metadata with my documents and folders in SharePoint. This metadata includes an itemid which is a unique identifier from the system it came from. Is there a way to retrieve the item from SharePoint using Graph API by specifying the itemid in the metadata?
This query works for properties that Microsoft provides like name:
https://graph.microsoft.com/v1.0/sites/{siteid}/drive/root/children?$filter=name eq 'Z'
But if I try it with the custom property then I simply get an empty result:
https://graph.microsoft.com/v1.0/sites/{siteid}/drive/root/children?$filter=itemid eq 'Z'
Is there a way to query documents and folders with custom properties like this?
Here is the code used to update the field on the document in SharePoint using Graph API:
public FieldValueSet UpdateListItem(string siteId, string driveId, string fileItemId, Dictionary<string, object> additionalData)
{
var updateFileTagsRequest = graphClient.Sites[siteId].Drives[driveId].Items[fileItemId].ListItem.Fields.Request();
var fieldValueSet = new FieldValueSet { AdditionalData = additionalData };
var result = updateFileTagsRequest.UpdateAsync(fieldValueSet).Result;
return result;
}
The dictionary values being passed to the UpdateListItem method are strings and look like this: "ItemId", "A unique value"
I have the following table structure that mixes legacy fields with an updated schema:
Coaster
Id (Int)
ParkId (Int)
Park
Id (int)
UniqueId (Guid)
So, the Coaster and Park tables are linked using the Park.Id field. The UniqueId field is not currently used in the old schema. We are migrating to a clean DB using AutoMapper, and this new schema looks like this:
Coaster
Id (Int)
ParkId (Guid)
Park
Id (Guid)
The problem I am having is doing this using AutoMapper. I've been experimenting with this code:
private ModelMapper()
{
Mapper.Initialize(x =>
{
x.AddProfile<ConvertersMappingProfile>();
});
}
// This is the part that I'm trying to work out
public ConvertersMappingProfile()
{
CreateMap<Park, NewSchema.Park>()
.ForMember(dst => dst.Id, map => map.MapFrom(src => src.ParkId));
}
In the new schema, the Park table's Id matches the old schema's UniqueId.
My question is: Because in the old schema there is no direct link to the UniqueId value of the Park table, how to do I get that value to map to the new schema using the Coaster.ParkId field to Park.Id field mapping?
I used a custom resolve to fix the problem. So I created my resolver, which pulls up a list of the items in the database (which is typically pretty small) to get all the values from the table I need, and retrieves the value. (Pre-refactored code):
public class ParkResolver : IValueResolver<Original.Park, New.Park, string> {
public string Resolve(Original.Park source, New.Park dest, string destMember, ResolutionContext context) {
List<Original.Park> list = new List<Original.Park>();
using (IDbConnection con = new SQLiteConnection(#"Data Source=C:\Users\Me\Documents\Parks.sql;")) {
con.Open();
list = con.Query<Original.Park>($"SELECT * FROM Parks WHERE Id = {source.ParkId}").ToList();
con.Close();
}
return list.FirstOrDefault().UniqueId;
}
}
And I call my custom resolver for the tables I am mapping:
CreateMap<Original.Park, New.Park>()
.ForMember(dst => dst.ParkId, map => map.MapFrom(new ParkResolver()));
Hopefully that will help someone else.
I have been working with the google cloud library, and I can successfully save data in DataStore, specifically from my particle electron device (Used their tutorial here https://docs.particle.io/tutorials/integrations/google-cloud-platform/)
The problem I am now having is retrieving the data again.
I am using this code, but it is not returning anything
function getData(){
var data = [];
const query = datastore.createQuery('ParticleEvent').order('created');
datastore.runQuery(query).then(results => {
const event = results[0];
console.log(results);
event.forEach(data => data.push(data.data));
});
console.log(data)
}
But each time it is returning empty specifically returning this :
[ [], { moreResults: 'NO_MORE_RESULTS', endCursor: 'CgA=' } ]
, and I can't figure out why because I have multiple entities saved in this Datastore.
Thanks
In the tutorial.js from the repo mentioned in the tutorial I see the ParticleEvent entities are created using this data:
var obj = {
gc_pub_sub_id: message.id,
device_id: message.attributes.device_id,
event: message.attributes.event,
data: message.data,
published_at: message.attributes.published_at
}
This means the entities don't have a created property. I suspect that ordering the query by such property name is the reason for which the query doesn't return results. From Datastore Queries (emphasis mine):
The results include all entities that have at least one value for
every property named in the filters and sort orders, and whose
property values meet all the specified filter criteria.
I'd try ordering the query by published_at instead, that appears to be the property with a meaning closest to created.
I was getting TaskID for Case Activities (Screen ID - SP203010) using Acumatica Web API. Now after upgrading it to version 6.0, I am not getting that. I have also tried different properties available but seems nothing is getting me that TaskID.
I am storing these activities into my database pulling from Acumatica Partner Portal and to avoid duplicate activities being imported, I was comparing it with TaskID.
Below is the code snippet I am using to get TaskID
SP203010WS.Screen context = new SP203010WS.Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.AllowAutoRedirect = true;
context.EnableDecompression = true;
context.Timeout = 1000000;
context.Url = "https://sso.acumatica.com/Soap/SP203010.asmx";
PartnerPortalCreds loginCreds = GetCreds();
string username = loginCreds.PARTPRTUSE;
string password = loginCreds.PARTPRTPAS;
SP203010WS.LoginResult result = context.Login(username, password);
SP203010WS.Content content = context.GetSchema();
context.Clear();
string[][] export = context.Export
(
new SP203010WS.Command[]
{
new SP203010WS.Value
{
Value = currentAcumaticaCaseNo,
LinkedCommand = content.Case.CaseID
},
content.Activities.Type,
content.Activities.Summary,
new SP203010WS.Field { FieldName="Body", ObjectName="Activities"},
content.Activities.StartDate,
content.Activities.CreatedBy,
new SP203010WS.Field { FieldName="TaskID", ObjectName="Activities"},
},
null,
0, true, true
);
Let me know whether it has been moved or deprecated in newer version. What shall I be using instead of TaskID or where can I find that TaskID.
In Acumatica 6.0 table EPActivity was splitted on CRActivity, SMEmail and PMTimeActivity. Original table was renamed to Obsolete_EPActivity.
Now NoteID is the key field on all tables. SMEmail and PMTimeActivity contains RefNoteID field - foreign key from CRActivity.
You may find value pair TaskID and NoteID in table - Obsolete_EPActivity
#Krunal, as Ken mentioned, after upgrade to 6.0 value pair TaskID and NoteID is only available in the Obsolete_EPActivity table. One should use Obsolete_EPActivity table to replace obsolete TaskID integer values with actual NoteID GUIDs.
There is no way to access Obsolete_EPActivity table through Web Services. After upgrade to 6.0, Acumatica inserts new Activities only in the CRActivity table.
To avoid duplicate activities, you have to store actual NoteID GUIDs in your database instead of obsolete TaskID integer values and compare GUIDs while importing records.
For previously imported activities you will also have to replace TaskID values with actual NoteID GUIDs. Searching for CRActivity record based on CaseID, Subject and CreatedDateTime field values stored in your DB, you should find appropriate record and use its NoteID to replace legacy TaskID value.