Kentico 12 Azure Search - kentico

I'm trying to implement Azure Search on Kentico 12. Following the article below.
https://docs.kentico.com/k12/configuring-kentico/setting-up-search-on-your-website/using-azure-search/integrating-azure-search-into-pages
However, I have multiple indexes defined on the smart search not just a single index code name that I can hard code and also cannot aford to hard code index fields. Is there any tutorial out there that I can follow?

It sounds as if you're referring to building an Azure Search web part, is this correct. If so, make a property in your web part which allows you to select the code name from a list in the database. Secondly, regarding field names, you should be using generic field names like DocumentName, NodeAliaspath, etc. Although if you have very specific search results that need to be displayed, simply put in a switch statement to get the field names based on a class name.

Related

How do you construct an Azure Search query to return a wildcard search based solely on a specific field?

If I may have missed this in some other area of SO please redirect me but I don't think this is a duped question.
I am using Azure Search with an index field called Title which is searchable and filterable using a Standard Lucerne Analyzer.
When using the built-in explorer, if I want to return all Job Titles that are explicitly named Full Stack Developer I can achieve it this way:
$filter=Title eq 'Full Stack Developer'&$count=true
But if I want to retrieve all the Job Titles using a wildcard to return all records having Full Stack in the name this way:
$filter=Title eq 'Full Stack*'&$count=true
The first 20 or so records returned are spot on, but after that point I get a mix of records that have absolutely nothing in common with the Title I specified in the query. My initial assumption was that perhaps Azure was including my specified Title performing an inclusive keyword search on the text as well.
Though I found a few instances where that hypothesis seemed to prove out, so many more of the records returned invalidated that altogether.
Maybe I don't understand fully the mechanics under the hood of Azure Search and so though my query appears to be valid; my expectation of the result is way off.
So how should my query look to perform a wildcard resulting to guarantee the words specified in the search to be included in the Titles returned, if this should be possible? And what would be the correct syntax to condition the return to accommodate for OR operators to be inclusive?
Azure Cognitive Search allows you to perform wildcard searches limited to specific fields only. To do so, you will need to specify the name of the fields in which you want to perform the search in searchFields parameter.
Your search URL in this case would be something like:
https://accountname.search.windows.net/indexes/indexname/docs?api-version=2020-06-30&searchFields=Title&search=Full Stack*
From the link here:

Smart search results behaviour of compound index of multiple page types

Can someone confirm the behaviour of the Smart search results webpart when using a Smart search filter on a particular field, documentation here, when the index, and the expected results, are compound of multiple page types?
In my scenario I have 2 page types, one is always a child of the other, my hypothetical scenario would be a Folder and File types as an example.
I've configured the index with Pages type and Standard analyzer to include all Folder and File types under the path /MyOS/% on the tree.
The search page, includes the Smart search results webpart and a Smart search filter, a checkbox for the File's field FileIsHidden.
What I'm trying to ascertain is the possibility for the results to include all folders that have a hidden field, as well as the files?
Client has a v8.2 license and now has a requirement similar to this scenario.
Thanks so much for any help in advance.
Firstly what i would do is download the latest version of LUKE, it's a lucene inspector that allows you to run queries, inspect the data, etc.
https://code.google.com/archive/p/luke/downloads
Your search indexes are in the App_Data/Modules/SmartSearch/[SearchName], now i am not sure if LUKE can query 2 indexes as the same time, however you can run hte same query against both and see if it's filtering out results one way or another.
If you are trying to query where a field must be a value, and the other page type does not have the field, it probably is filtered out. What you need to do is use the lucene syntax to say "(classname = 'cms.file' and fileonlyproperty = '' OR classname <> 'cms.file')" so to say.
You'll have to test, but say the class name is cms.file and cms.folder, and the property is FileIsHidden, i think the syntax would be:
+((FieldIsHidden:(true) and classname:('cms.file')) OR (NOT classname:('cms.file'))
But you'll have to test that.

How to use the content search web part to filter on a custom user profile property

We added the department number from AD to sharepoint. This property is multi valued in AD, and its multivalue in sharepoint.
My user profile screenshot:
http://screencast.com/t/e9xaZMyJJ2
Then in the CSWP, I want to filter by this value, please check here:
http://screencast.com/t/rlP95vrYRB3E
If I check the TEST, its using a GUID instead of the 613 code
http://screencast.com/t/ASltLUsIP
I am totally clueless.!! any idea?
Mapped property screenshot here:
http://screencast.com/t/gLXs2ZIR
In your user profile the department number is stored as a 'term' using a managed metadata field.
It's important to know that a 'term' can be translated or you can even define synonyms.
When using managed metadata in search, search will use the id (=a guid) of the term instead of the actual text ('613').
Since it ignores the text (and uses the id of the term), this makes it possible for search to find your term in any language or synonyms.
In your case translation of '613' is not really applicable but imagine that your department was a text instead of a number.
When searching on the term 'HR', search could return all the items with 'HR' but also the ones with 'personeelsdienst' (HR in Dutch).

Extending Orchard Search and Indexing

We need to provide search options for users to find content based on specific field values.
We're developing a Training Course module for a client but the standard search looks for the text in any indexed field. We want to allow users to find courses based on searches against specific fields (i.e. Course Type, Location, Price, Date).
We've extended the search to check against specific fields but can't work out how to get the URL parameters passed by the Search form as a GET.
Where does Orchard put URL parameters?
Also, are we missing something, is there a way that Orchard already supports this that we haven't realized?
I would suggest you to copy part of the Search module, more specifically the Controller and the View and then modify it to suit your specific needs. I see you are actually modifying the original module, but this might be a problem on the long term, for instance if we start updating the module you might either lose you changes or have to reapply them to the code base. In the end you will target a MySiteName.Search module. And you can also add custom routes, custom settings.
On a side note the Search API is really powerful and you can even use it to do faceted search, or search on inherited taxonomy terms, tags, full text, ranges, ... Having your own controller code will let you use all of these features easily.

Exception while executing CAML query sharepoint 2007

Name of the column in document library is :
Column name => Keywords (Sub-Processes, Methodology, Servicing Model, etc)
Column Type=> Multiple lines of text
We are using the above column name in the caml query as below
query.Query = "<Where><Eq><FieldRef Name='Keywords(Sub-Processes,Methodology,Servicing Model, etc)'/><Value Type='Text'>Merchant Services,Merchant Set Up</Value></Eq></Where>";
but when we run the code we get the exception:
Microsoft.SharePoint.SPException: One or more field types are not
installed properly. Go to the list settings page to delete these
fields.
Is this exception because of special characters used in the column name if yes then how can I correct it.
We can't change the column name because it is requirement.
Internal names and display names are quite different from each other. They can be the same in some cases but not all. There is generally an escape sequence in between two words with a space.
It is often a good practice to retrieve the internal name at runtime rather than hardcoding it.
Here's how to do it:
var internalName=list.Fields.GetFieldByInternalName(column.ColumnName).Title;
I can tell you for sure (given the special characters) that that's not the internal name of the field. It might be the display name, but it's not the internal name.
The error is because there is no field with an internal name of what you have provided.
Personally, when I want to find the internal name of a field I go to the list settings for the list and edit the column. When doing so there will be a query parameter with 'field=' followed by the internal name. There are other places that it can be found, and other sharepoint tools (SharePoint Manager was mentioned by another poster) that can be used to get such information.
I used "Keywords_x0020_x002f_x0020_Folksnomy" and it worked for me.
I fetched all the columns of the Document library and bind it to the GridView,in GridView I found this name.
Display Column name => Keywords (Sub-Processes, Methodology, Servicing Model, etc)
Wrong one is =>
Keywords_x0020_(Sub-Processes,_x0020_Methodology,_x0020_Servicing_x0020_Model,_x0020_etc)
Newly found correct name is => Keywords_x0020_x002f_x0020_Folksnomy

Resources