Azure search relevance - azure

Need help, I have an azure index called customer and have two fields in it customers & contacts, I have applied boost function for both the fields with boost 100 & 90, the problem is when I search any text it returns customer related relevance first and then contacts relevance.
Eg: If I search for "Johnson"
It will return all the customer details with Johnson first and then contact details even if the contact name matches "Johnson"
List of records displayed.
Record 1: This is customer
Johnson & tyson
Segment: Enterprise | Vertical: Healthcare | Country: US
Record 2: This is contact however it is associated with customer "Johnson and tyson"
Michael Walton
Customer:Johnson and tyson | Segment: Enterprise | Vertical: Pharmaceutical
Record 3: This is contact however it is associated with customer "Johnson and tyson"
Henri Vliegen
Customer:Johnson and tyson | Segment: Ent | Vertical: Pharmaceutical
Record 4: This is contact it is associated with customer "WST"
Henri Johnson
Customer:WST | Segment: Enterprise | Vertical: Pharmaceutical
So in this way records are displayed its most probably on scoring however I want the relevance name
to be displayed first like record 4 is contact and it should have been in place of record 2 since Johnson is the last name

I believe that it's because you're boosting with the same values, so it's like this:
if(Customer.Contains("Johnson") || (Contact.Contais("Johnson"))
{
//display
}
//PS: this statement is just to clarify that Contact and Customer name have the same importance.
Try to boost with different values, and I believe it will work. (100 for Customer and 90 for Details).
UPDATE
It seems that you are indexing first and last name separately. If you have a field "fullname" and boost through it, probably you'll get the expected result. Another option is create a scoring profile using those fields:
https://azure.microsoft.com/en-us/documentation/articles/search-get-started-scoring-profiles/

I read the question several times. While the question mentions that you have one index, the records displayed imply that you actually have two search indexes. Is this correct? I've been working on a training course for Azure Search, which discusses indexes and scoring in-depth.
At this time, Azure Search does not support cross-index queries. For that reason, if my understanding of your problem is correct, you'd have to run two queries: The first on the Customer index and the second on the Contacts index. Part of the reason that Azure Search is able to execute searches so quickly is because its a flattened out data structure, which allows for fast look-ups and queries. However, you're scenario implies something relational.
Am I misunderstanding your question?

Related

Kentico: How to work with content rating through API?

I have gone through the code and webparts but couldn't figure out how rating works.
All I know is the rating control provided.
I want to show rating history through an API.
I also need to allow users to rate using API.
I can get rating value of a document with the query:
select DocumentRatings, DocumentRatingValue from CMS_Document WHERE [DocumentNodeID] = 123
But how to see rating history?
How rating is calculated internally?
Which are the other tables involved?
In Kentico, there are two different types of content ratings, both count towards the document's content rating:
Ratings without message
increments the rating value and count directly in the Document table.
Ratings with message (uses Message Board functionality)
adds a message with rating to [Board_Message] table, grouped together by a board representing the page stored in [Board_Board]
also increments the rating value and count directly in the Document table.
If you're wanting to have full rating history, and be able to expose it via an API, you're probably best looking at using Message Board functionality. To do this, you can check the API documentation here or investigate how Kentico's Message Board webparts work, try checking:
CMS\CMSModules\MessageBoards\Controls\MessageBoard.ascx.cs
CMS\CMSModules\MessageBoards\Controls\Messages\MessageEdit.ascx.cs (btnOk_Click event)

Azure Search suggestions based on multiple terms

I have an online grocery store, products have such attributes:
product name (Pepsi, 7UP)
container (1 bottle, 1 can)
variant name (diet, max)
I want my Azure Search solution to suggest users required product regardless of search terms order (diet Pepsi, 1 can Pepsi, Pepsi 1 can), but with no luck.
I wonder, if the only way to do this is to compute a "keywords cloud" which will contain all possible permutations and use this "keywords cloud" field as a suggester field? Example of such "keywords cloud" field value: "Pepsi diet 1 can diet Pepsi 1 can Pepsi".
Azure Search search solution somehow does the trick, but I can't use it because it doesn't support typeahead (AFAIK).
Any insight will be appreciated.
Suggestions are built for cases where you want to progressively discover a short phrase. In your case it looks like what you want is to search for any word across the documents, in any order. For that you could simply issue a search request instead of a suggest request in each keystroke. That will execute a keyword search, which seems like it's what you're looking for.
If you want the last word to be treated as partial input, you could do the following trick assuming you target languages that separate words with whitespace: take the input text, split out the last word (i.e. go backwards from the end of the string until you find a non-character/number symbol) and then produce a string of the form "original-minus-last (last|last*)". For example, if the input is "Can Pepsi Di", you'd produce "Can Pepsi (Di|Di*)".

Sphinx "reverse" search

We have a website where users put up ads for stuff they want to sell, with parameters such as price, location, title and description. These can then be searched for using sphinx and allowing users to specify min- and maxprice, a location with a searchradius (using google maps) etc. Users can choose to save these searches and get emails when new ads appear that fit their search. Herein lies the problem: We want to perform a reverse search every time an ad is posted. With the price, location, title and description as parameters we want to search through all the saved "searches" and get the ones that would have found the ad. The min- and maxprice should just be performed in a query i suppose, and some Quorom syntax to get all ads with at least 2 or mby just 1 occurance in the title/description. Our problem lies mostly in the geo-search. How do we find all searches where the "search-circles" would include our newly posted location without performing a search for every saved search?
That is the main-question, any comment on our suggested solution to the other problems is also very welcome. Thank you in advance / Jenny
The standard 'geo-search' support on sphinx should work just as well on a Prospective Index, as a normal retrospective search.
Having built a sphinx 'index' of all the saved searches...
And you run a query using the 'ad' as the search query:- rather than the 'filter' using a fixed radius, you just use the radius from the attribute (ie the radius stored on the particular query) - if using the API cant use setFilterRange directly, need to use setSelect, to make a new virtual attribute.
$cl->setSelect("*,IF(#geodist<radius,1,0) as myfilter");
$cl->setFilter('myfilter',array(1));
(and yes, the min/maxprice can just be done with normal filters too - just inverting the logic to that you would use in a retrospective search)
... the complication is in the 'full-text' query, if the saved search is anything more than a single keyword, but you appear to have already figured out that part.

FourSquare venue search using categories

I am seeing some weird behaviors when I use the search API from FourSquare. The site I am building lists all the nightclub spots (www.nationalvip.com)
When I search using 5 categories:
// 4bf58dd8d48988d121941735 - lounge
// 4bf58dd8d48988d11f941735 - nightclub
// 4bf58dd8d48988d1e7931735 - jazz club
// 4bf58dd8d48988d1e9931735 - rock club
// 4bf58dd8d48988d1d8941735 - gay clubs
Some of the nightclubs that are in category: 4bf58dd8d48988d1d8941735 do no show up.
So query like this:
/v2/venues/search?categoryId=4bf58dd8d48988d121941735,4bf58dd8d48988d11f941735,4bf58dd8d48988d1d8941735,4bf58dd8d48988d1e9931735,4bf58dd8d48988d1e7931735&ll=47.6097,-122.3331&radius=10000&intent=browse&v=20120801
Omits this venue:
https://foursquare.com/v/last-supper-club/40b13b00f964a520a7f61ee3
When I just use that category on it's own they do.
...?categoryId=4bf58dd8d48988d1d8941735&ll=47.6097,-122.3331&radius=10000&intent=browse&v=20120801
I have tried re-arranging the categories. I'd really like to avoid having to call the API many times with various categories.
Has anyone else seen this happen?
Your problem is with the location. The ll param you provided is for a location in San Francisco, but the venue you expect to appear is located in Seattle.
you can increase limit upto 100
I have done that and radius upto 100000meters(100km)

SSAS Dynamic Dimension Security based on another dimension attribute

In my project I have to apply security based on a dimension attribute.
I think the best way to explain my scenario is with an example, if you need more info please request me and I'll love to told you if it will help me find a solution.
I have some main dimension, the dimcustomer, dimseller, fact, data and geographic.
The fact table are related with dimseller ids, the dimcustomer is related to the dimseller based on one dimseller specific attribute(CNPJ)(another dimensions that i didnt described are related the same way).
So my goal is to apply a role security based on the dimseller CNPJ, so then when the user related with that seller trys to browse data he will be allowed to view only the data that are related to his seller CNPJ.
Table example:
DIM Seller: DIM Customer FactTable
id name cnpj id name dimseller.cnpj dimseller.id dimcustomerid measure
1 ME 1234 1 guest1 1234 1 1 50,00
2 you 5678 2 guest2 5678 2 2 100,00
So if i login as ME i will be able to se that i have the customer guest1 with one sold product that was sold by 50 bucks.
Got my point?
What is the best way of doing it?
For now I'm considering the following guide: Claim Authentication with dynamic dimension security, but at that way I should define it attribute by attribute.
Is there a way that i can define this security need? I can easy filter the data using sql statements, but i have no ideia how i can apply this kind of security in the ssas.
Thank you guys anyway!
To apply security within a dimension, you need to use roles. For each roles, you can then specify which element in the cubes/dimensions that are available to that role. So, what you got to do is to create a role by CNPJ that will be able to view only their CNPJ.

Resources