I'm using facets to get partition search results into ranges.
The search returns a list item and each item has a score. In the list the items are ordered by score from high to low. Some items may also have equal score.
I use facets to get the top 10, then the next 100.
My idea is to use the range facet. The problem is that I never know the maxim scor. Each time it is different. But since search results are returned in order by score I can probably use the range facet without caring ab the range:
//top 10 best matches with score: [0-infinity) but since they items are ordered I think it will return top 10 items
FacetBuilders.rangeFacet("top10Matches").field("score").addUnboundedTo(0).size(10)
This is simple enough. Now I'm not sure how to get the next chunk which is wherever the previous facet left off and have a size of 100. I could probably check the score of the last item in the results the first facet returned and use that as my top range, but if there are items with that exact score they will be skipped.
Is there a way to do what I need with facets?
There is a setFrom(Int) method that I can use. No facets needed.
val queryString = client.get.prepareSearch()
.setQuery(QueryBuilders.matchQuery(NODE_PATH_TO_SEARCH, query))
.setFrom(currentPageNumber*MAX_DISPLAYABLE_RESULTS)
.setSize(MAX_DISPLAYABLE_RESULTS)
queryString.execute().actionGet()
Related
We are using Algolia to display a list of results based on the users search criteria. We need to know the confidence level of results so that we can filter out results below a certain level.
Ex.
If there are 100 records, we only want to display the records with a confidence level above 90%. This can either be 5 records, or 50 records. It's not determined by the index value / position in the returned list. Its based on the score
Adding the getRankingInfo field returns the following for a query with matches, we limited the results to 5:
{"nbTypos":0,"firstMatchedWord":0,"proximityDistance":6,"userScore":4216,"geoDistance":0,"geoPrecision":1,"nbExactWords":4,"words":5,"filters":0}
{"nbTypos":0,"firstMatchedWord":0,"proximityDistance":6,"userScore":4210,"geoDistance":0,"geoPrecision":1,"nbExactWords":4,"words":5,"filters":0}
{"nbTypos":0,"firstMatchedWord":0,"proximityDistance":8,"userScore":7801,"geoDistance":0,"geoPrecision":1,"nbExactWords":4,"words":5,"filters":0}
{"nbTypos":0,"firstMatchedWord":0,"proximityDistance":8,"userScore":4215,"geoDistance":0,"geoPrecision":1,"nbExactWords":4,"words":5,"filters":0}
{"nbTypos":0,"firstMatchedWord":0,"proximityDistance":8,"userScore":4214,"geoDistance":0,"geoPrecision":1,"nbExactWords":4,"words":5,"filters":0}
Does anyone have a suggestion on how to use the information below to get to a "confidence" level?
I am trying to use a calculated measure as a way to filter my data, but it's looking more difficult than expected. Let me explain through an example.
I have data of the following type, with two dimensions - one is a unique ID, the other a category - and four measures.
Initial table
My first step is to rank each element by its score, where the ranking is evaluated within the same category. I therefore create a new measure:
=aggr(rank(sum(Score1)), Category, UniqueID)
I do this for all three scores, resulting in three new calculated measures. My final calculated measure is the average of the three rankings. Below the example, the calculated measure of interest is the one in bold. Note that in my real world calculation I directly evaluate 'New Measure', without creating the intermediate columns 'RankingScore'.
Data with newly calculated measure
Note that this measure is tricky, as it changes according to previous selections. Say, for instance, that I select only entries with 'Amount' > 1000. The relative rankings will change and therefore also 'New Measure'.
In my actual App I need to filter my entries by 'New Measure', after I've done some previous selections on fields like 'Amount'. If it simply were a field, I would normally have created a filter pane, our used the qsVariable extension to have a slide range, to select only rows with 'New Measure' above a set threshold. Unfortunately it seems I cannot do that with my calculated measure.
How would you approach the problem? I was wondering, for example, if it were possible to 'convert' my new measure to an actual field, after all previous selections have been done, but perhaps this is nonsense.
Thank you in advance, and apologies for the long post!
If I'm understanding correctly, I believe this solution should work:
Create a variable for your slider: new_measure_slider.
Create a New Sheet Object -> Slider/Calendar Object.
Configure your slider to control your new new_measure_slider variable.
Create a calculated dimension in your chart substituting your 'New Measure' formula (the one you stated was an average of the three ranks). It should be a conditional like this:
=if(aggr([your average formula here], Category, UniqueID) >= new_measure_slider, [Category], null()).
Basically, compare your formula to the new_measure_slider variable. If true, use the Category (or UniqueID, whichever you need) as the dimension, if false, null().
Check the 'Suppress When Value is Null' checkbox on your new dimension. This is key. This is what will actually filter your chart.
In the chart properties, Presentation tab, click on your new calculated dimension and hit 'Hide Column'. We don't need to see this because we are using it only as a filter.
You can tell QV to ignore your filtering in the field Amount by adding "Amount=" to your set analysis.
I dont know how your average calculation looks like but maybe:
(aggr(rank(sum({<Amount=>} Score1)), Category, UniqueID) +
aggr(rank(sum({<Amount=>} Score2)), Category, UniqueID) +
aggr(rank(sum({<Amount=>} Score3)), Category, UniqueID)) / 3
I've got some data that I'd like to display both the averages and the count for.
For instance, there are 50 People taking a survey. Their names are saved in a Dimension "Raters". They are taste testing several products. These products are saved in a Dimension "Products"
They answer 4 questions. Taste, Texture, Appearance, Uniqueness, all saved in Dimension "Question"
The actual ratings are saved in "Ratings". This is a measure.
I can very easily make a table with Raters on the Rows, Question on the Columns, AVG(Ratings) in the text.
This shows me the average score for each question the rater answered.
It looks like this:
Rater-----Taste-----Texture-----Appearance-----Uniqueness
Joe---------2.2---------4.3--------------3.7-----------------2.4
Bob--------3.0----------1.2-------------3.4-----------------4.4
Sally-------4.5----------3.3-------------4.5-----------------3.2
Jessica---5.0----------3.0-------------2.0-----------------1.0
So far, so good.
Jessica's results look suspiciously integerish. When I look at the background data, I see that she only answered for 1 product.
I'd like to be able to add a column to the right of uniqueness which is the count of all product responses for that person.
I've played with this quite a bit, and I'm not sure that it is possible. Maybe with LOD?
I'd also like to filter the table, so that only "tough" raters are shown. Criteria for this is: Their average response for at least two criteria should be below 3.0. That would include Joe and Jessica.
When I try to do counts based on averages, I run into the "cannot aggregate an aggregate rule".
Is there a way around this? It would be trivial to do in excel with another column, a countif, and a filter.
Thanks,
Chris
Part 1:
You should be able to create a calculated field(Analysis->Calculated Field) and name it something like "Number of Records". In the query box just set it to 1 and select "Okay".
This new field will be selectable in the measures. Drag it into your table in the columns area and it should add a count next to your averages.
Part2:
In your measure values box you should be able to right click you measures. This will bring up a list of options including "Filter". Select this option.
On the SUM(Number of Records) set it to "At Least" = 2. Then right click on the AVG(Ratings) measure and set it to "At Most" = 3
Put Products on the Rows shelf.
Then right click on that Products field on the Rows shelf and change ITT from a dimension to a measure. Be sure to choose Count Distinct for the aggregation.
Finally, right click on the field again and change it from continuous to discrete.
This shows how many different products each person reviewed, no matter how many characteristics they rated. If you want the number of ratings, use count instead of count distinct. Or just Sum(number of records), again set to discrete
I just noticed something about Sphinx Search. If I choose a particular order, like relevance for example, it seems like if I have a number of items from 1 to 10, for some reason, the relevant returns that come back are still in a numbered order. i.e. The records will be in the 1-5 range instead of in the 6-10 range. Is there something I am missing or don't understand?
So, the only way I can get new results to show is to do a sort by ID DESC, but the problem there is I am only getting from the newest ID down and there isn't really any sort on relevance at that point.
Is there some kind of default sort on the back end that can be adjusted?
I am using Tableau 8.2.
I would like to sort, but am having difficulty trying to get to my end result.
I have an item number: the item numbers are repeated multiple times.
I have a criteria1 field, and a criteria2 field.
I would like to experiment sorting on all the criteria1 fields, then all the criteria2 fields.
For my rows, I have "item number", "criteria1", "criteria2", along with other data.
When I click above the "criteria1" in the list of rows, I get a "sort" function.
The sort function has sever different combinations:
The first is "sort order", there are clicks for "ascending" and "descending".
Next is "sort by", there are clicks for "data source order", "alphabetic" and "field". The "field" has a combobox for different field names.
The last group is for "manual". This shows all values, but not in true sort order.
I have tried using many different combinations for the sort, but cannot get it to work the way I would like. I would like a sort across all the items, descending.
How can I get the sort to sort descending across all the items, first by "criteria1"? Then, how can I sort by "criteria2"?
I don't quite understand what problem you're facing. Let me explain how sorting works in Tableau, and you tell me what's happening in case it's not helpful.
Each dimension has a Sort property (you can right-click a dimension, Default Properties and Sort. You can choose to sort ascending or descending, on alphabetic, numeric or data source order. Or even manually sort (top items come first, bottom items come last, use Up and Down button to shuffle)
When you drag those dimensions to the worksheet, Tableau will automatically use that Sort Property. More over, it will follow a hierarchy, the first dimension (in Row or Column) will be sorted first, then the second dimension will be sorted inside each bucket of the first dimension. SO, if you have a field with [A,B,C,D] and a second field with [1,2,3,4], one possible outcome could be (using descending order, first the letters than the numbers):
D 3
2
1
C 3
2
B 4
3
1
A 4
3
In that example, what exactly would you be trying to achieve?