Fastest way to select a Single Document From Azure Search - azure-cognitive-search

Is there any preferred (fastest) way to select a SINGLE document from Azure Search Or does one have to issue a query using its ID etc.
Many thanks

If you're using the REST API: https://learn.microsoft.com/rest/api/searchservice/lookup-document
If you're using the.NET SDK: searchIndexClient.Documents.Get("Put your document ID here")

Related

Azure Search Design Question: Omit result if User has seen this result

I'm trying to design a solution where I don't have to use the SQL Server Database to answer a question: Show me Azure Index search results where the user has never seen this search result.
I can keep track of user document "views" in my SQL database, but how do I extend this functionality to Azure Search Index queries?
I mean I could do a $filter where document id is not in (1,2,3,etc), or I could filter the Index results before the user ever sees them from the server.
I'm just wondering if there's a more clever way to do this?
Thanks for your help!
Best way to achieve this is the first option you mentioned, once the first query comes on that user session, you can save which document ids were returned and then create a filter to exclude those ids for subsequent queries on the same session.

How can we get name of email templates using API?

How can we get name of email templates using API? Can anyone please guide?
Which API. Come on, put bit more effort in your question
You just need to run queries? Email templates are metadata, can be queried in EmailTemplate table.
SELECT Id, DeveloperName,FolderName,Name,NamespacePrefix FROM EmailTemplate
If you're using Metadata API (retrieving config, deploying classes etc) you need to explicitly list them in the package.xml. If you don't know the names - you can query like above or use listMetadata call. Example if you're using Ant migration tool: https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/forcemigrationtool_listmetadata.htm (it'll work per folder)

Microsoft Graph AD Users or people API to search all users?

I'm trying to build functionality into my app for 'admins' to assign users from their AD group to certain groups that are further assigned to app-specific roles. Basically a simple management component.
Adding the user with the oid to a group is easy, the problem I'm facing is finding the actual user.
Currently, the only option I'm seeing is making multiple api requests to v1.0/users (999 items max) and grouping them all in memory and then provide a simple search function to narrow it down.
I have also used the v1.0/me/people endpoint to search for users but this does not reveal all users from the AD group, just relevant users they deal with, so not too useful.
Is there any other api endpoint I could tap into to do a search ONLY on members of the same active directory?
Using the startsWith filter on multiple properties is probably the closest we can get to user search in MS Graph at the moment:
https://graph.microsoft.com/v1.0/users?$filter=startswith(displayName,'sarah') or startswith(givenName,'sarah') or startswith(surname,'sarah') or startswith(mail,'sarah') or startswith(userPrincipalName,'sarah')
Ended up switching to the old AD Graph API and implementing a query on the endpoint as follows:
https://graph.windows.net/{ tenant ID }/users?api-version=1.6&$select=mail,displayName,objectId,givenName,surname&$filter=startswith(givenName,'SEARCH TERM') or startswith(surname,'SEARCH TERM')
If a function receives 1 single param, it will search for that parameter in both givenName and surname but you could configure this to search accross any other supported fields.
You could also completely ditch the $select= completely to get the whole data. I didn't want the clutter though and those keys are enough for me.
Instead of going with startswith You may get better experience using search keyword:
https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http#example-6-use-search-to-get-users-with-display-names-that-contain-the-letters-wa-including-a-count-of-returned-objects

Azure search: use a single index on multiple data sources

I have multiple Azure tables across multiple Azure storage that have the exact same format. Is it possible to configure several data sources in Azure-search to use a unique Index so that a search on this Index would return the results aggregated from all data sources (Azure tables)?
So far, each time I configure a new 'Data Sources' and the corresponding index, I must create a new index (with a new index name). Attempting to reuse an existing index name results in an error stating "Another index with this name already exists"
Thank you for any help or pointer you might provide.
Yes, it's possible, but we don't currently support it in the Azure Portal.
When you go through the "import data" flow in the portal, it'll create a data source, indexer and index for you.
If you want more sources for that index, you need to create new data sources and indexers, with the new indexers pointing at the existing index. Unfortunately this is not currently supported from the portal. You can do it using the .NET SDK (if you're using .NET), directly using the REST API from your app, or using any tool that can make HTTP requests such as PowerShell, curl or Fiddler.
The documentation that describes the indexer-related REST APIs is here:
https://msdn.microsoft.com/en-us/library/azure/dn946891.aspx

Is it possible to filter SolR results using Active Directory?

We use Solr to index an search through docs in our file system.
Currently, all users can access to all the docs. We'd like to change that, so that users can only access to some documents, according to their membership of a group in the Active Directory.
I've found that we can setup Apache to perform NTLM authentication, but I can't find anything about filtering results according to this authentication.
So, my question is : if we set up AD with groups like "SOLR_ACCESS_ALL", "SOLR_ACCESS_GROUP_1", "SOLR_ACCESS_GROUP_2","SOLR_ACCESS_GROUP_3", etc... can we set up SolR to filter results according to those memberships? We would also need to be able to give multiple access to some users (for example SOLR_ACCESS_GROUP_1 and SOLR_ACCESS_GROUP_3).
Thanks in advance for your help.
Solr does not integrate with Active Directory out of the box. However, a different Apache project ManifoldCF integrates with Solr and - I believe - Active Directory among many other enterprise connections.
See, for example, an article describing how to put these together.

Resources