Sitecore and Azure Search: support for Edm.ComplexType - sitecore

I am using Sitecore 9.3, and I would like to add the structured computed field to the Azure Search index.
I discovered that the most "complex" cloud type supported by Sitecore is the Collection of simple-type values, for example, Collection(Edm.String).
Is there any existing way to extend Sitecore Search capabilities (third-party library or just reconfiguration?) and start supporting Edm.ComplexType to allow me to add structured data like below to get them searched by the sub-field (for example, someList/any(list: list/id eq '1')), faceted by the sub-field, etc.
{
"someList": [
{"id":"1", "name": "One"},
{"id":"2", "name": "Two"}
]
}
I can add Collection(Edm.ComplexType) to the index, and the Azure Search works fine. However, I am searching for an easy way to fill the index from Sitecore.
Thank you in advance.

Related

How to use > and < operators in SharePoint search API?

I am using SharePoint Search API and referring link SharePoint Search REST API overview. I want to use property operators. Please refer 'Property operators that are supported in property restrictions' section in link Keyword Query Language (KQL) syntax reference
I am forming query as http://server/_api/search/query?querytext='AmountCurrency > 10.50'&selectproperties='Title,Author'
Similarly http://server/_api/search/query?querytext='AmountNumber < 20.50'&selectproperties='Title,Author'
In above queries AmountCurrency and AmountNumber are managed properties for Currency column and Number column respectively. But search api not returing any row. For me : and = operators are working fine. How to use greater than and less than operators in search API?
Make sure the field name you are using is defined in the Managed Properties in the Search Schema.
Or you can build the query using SharePoint Search Query Tool.
Got it. It is due to the managed property type. Following are the available types when we create managed properties.
Text
Integer
Decimal
Date and Time
Yes/No
Double precision float
Binary
When managed property gets created automatically for site columns, the default type is Text. While creating managed property manually only Search Service Application administrator can choose any type. All other users can choose either Text or Yes/No.
I am not SSA Administrator. So I have used default unused managed properties. Please refer https://technet.microsoft.com/en-us/library/jj219667.aspx#Anchor_8. Used RefinableDecimal00 and RefinableDecimal01 and mapped appropriate crawled property to them. Now everything is working fine

Azure Cosmos DB - Gremlin latitude longitude format conversion issues

I am trying to convert airport GeoCoordinate data i.e. [IATA Code, latitude, longitude] to Gremlin Vertex in an Azure Cosmos DB Graph API project.
Vertex conversion is mainly done through an Asp.Net Core 2.0 console application using CSVReader to stream and convert data from a airport.dat (csv) file.
This process involves converting over 6,000 lines...
So for example, in original airport.dat source file, the Montreal Pierre Elliott Trudeau International Airport would be listed using a similar model as below:
1,"Montreal / Pierre Elliott Trudeau International Airport","Montreal","Canada","YUL","CYUL",45.4706001282,-73.7407989502,118,-5,"A","America/Toronto","airport","OurAirports"
Then if I define a Gremlin Vertex creation query in my cod as followed:
var gremlinQuery = $"g.addV('airport').property('id', \"{code}\").property('latitude', {lat}).property('longitude', {lng})";
then when the console application is launched, the Vertex conversion process would be generated successfully in exact similar fashion:
1 g.addV('airport').property('id', "YUL").property('latitude', 45.4706001282).property('longitude', -73.7407989502)
Note that in the case of Montreal Airport (which is located in N.A not in the Far East...), the longitude is properly formatted with minus (-) prefix, though this seems to be lost underway when doing a query on Azure Portal.
{
"id": "YUL",
"label": "airport",
"type": "vertex",
"properties": {
"latitude": [
{
"id": "13a30a4f-42cc-4413-b201-11efe7fa4dbb",
"value": 45.4706001282
}
],
"longitude": [
{
"id": "74554911-07e5-4766-935a-571eedc21ca3",
"value": 73.7407989502 <---- //Should be displayed as -73.7407989502
}
]
}
This is a bit awkward. If anyone has encountered a similar issue and was able to fix it, then I'm fully open to suggestion.
Thanks
According to your description, I just executed Gremlin query on my side and I could retrieve the inserted Vertex as follows:
Then, I just queried on Azure Portal and retrieved the record as follows:
Per my understanding, you need to check the execution of your code and verify the response of your query to narrow down this issue.
Thank you for your suggestion, though problem has now been solved in my case.
What was previously suggested as a working answer scenario [and voted 1...] has long been settled in case of .Net 4.5.2 [& .Net 4.6.1] version used in combination with Microsoft.Azure.Graph 0.2.4 -preview. The issue of my question didn't really concern that and may have been a bit more subtle... Perhaps I should have put a bit more emphasis on the fact that the issue was mainly related to Microsoft.Azure.Graph 0.3.1 -preview used in Core 2.0 + dotnet CLI scenario.
According to following Graph - Multiple issues with parsing of numeric constants in the graph gremlin query #438 comments on Github,
https://github.com/Azure/azure-documentdb-dotnet/issues/438
there are indeed some fair reasons to believe that the issue was a bug with Microsoft.Azure.Graph 0.3.1 -preview. I chose to use Gremlin.Net approach instead and managed to get the proper result I expected.

Bigcommerce - Custom Product templates in Stencil

I've noticed that there isn't a Template dropdown for each Product in Stencil's backoffice.
Previously we could select different templates per Product. ( ex: "_customProductTemplate.html"
Does anyone know/use a method to create dynamic, product based, template selections?
Thanks,
Aaron
To create custom templates for product you need to place the file(e.g _customProductTemplate.html) in template/pages/custom/product directory.
To test it locally, you need to assign the custom template to the url in .stencil file. For example,
"customLayouts": {
"products": {"_customProductTemplate.html":"/{custom-product-url}/"},
"pages": {},
"brands": {},
"categories": {}
}
Currently, this feature is in beta and so you cannot assign the custom template to the desired product in bigcommerce server. However you can do so by requesting bigcommerce customer service to enable this feature for your site and by accepting their condition for beta not supporting many features.
~This is not something currently available in Stencil. It is slated on the roadmap.~
You can now make these changes. You can see more details for the step by step instructions listed here: https://stencil.bigcommerce.com/docs/authoring-custom-templates

Sitecore Lucene.net search with " Item name" only and sort it by hits

Hi how can we search an items name (http://screencast.com/t/vRAUNgQN) using Lucene.net in Sitecore and sort the search by the hits.
This shouldn't really be a question as there are lots of resources out there for this. This is my goto place for search:
http://www.sitecore.net/learn/blogs/technical-blogs/sitecore-7-development-team.aspx
I'll give you the benefit of the doubt though and get you started.
If you are using Sitecore 7 and above you can use the Linq style search.
using (var context = new ContentSearchManager.GetIndex("indexname").CreateSearchContext())
{
IQueryable<SearchResultItem> query =context.GetQueryable<SearchResultItem> ().Where(p=> p["name"].Equals("John"));
}
You can then call
SearchResults<SearchResultItem> results = query.GetResults();
This will have a hits collection
foreach (var hit in results.Hits)
{
hit.Document.Id;
var relevance = hit.Score;
........
Each hit will have a Score property which determines relevance (see above) - you should be able to sort by this. By default I think it sorts by relvance anyway. You can change the relvency by using the Boost function in the query.
For Sitecore 6.6
I'm a big fan of advanced database crawler module - it provides a nice wrapper for the search logic that sits on top of the standard search api.
http://sitecoresupport.blogspot.co.uk/2013/05/advanced-database-crawler-sitecore.html
Bear in mind though if you upgrade to 7 there are compatibility issues with this module.
Or you can use the standard Sitecore search api
https://sdn.sitecore.net/upload/sdn5/articles%202/administration/lucene%20search/lcd/lucene_search_engine-a4.pdf
I'm sure you'll figure the rest out

Solr Query Syntax

I just got started looking at using Solr as my search web service. I don't know whether Solr supports these query types:
Startswith
Exact Match
Contain
Doesn't Contain
In the range
Could anyone guide me how to implement those features in Solr?
Cheers,
Samnang
Solr is capable of all those things but to adequately explain how to do each of time an answer would become a mini-manual for Solr.
I'd suggest you read the actual manual and tutorials linked from the Solr homepage.
In short though:
Startswith can be implemented using Lucene wildcards.
Exact matches will only be found if a field is not tokanized. I.e. the entire field is viewed as a single token.
Contain is the default search format. I.e. a search for "John" will find any document's whose search field contains the value "John". Prefixing with - (e.g. "-John" will only find documents that do not contain John).
Ranges (be they date or integer) are possible and quite powerful, example date:[* TO NOW] would find any document whose date is not in the future.