I am unclear on how to remove duplicates using the dupDetector parameter in Bloodhound.
I am using v. 0.11.1
Pulling the dataset from a database with records like this:
building_name room department
Rooney 123 English
Rooney 456 Chemistry
Rooney 987 Chemistry
Meyer 65 Dog Walking
Flatiron 498 Weaving
My Bloodhound call:
var buildingName = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name', 'room', 'department'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: buildingJson,
dupDetector: function(remoteMatch, localMatch) {
return remoteMatch.building_name === localMatch.building_name;
}
});
The functionality I am looking for is the ability to search Rooney, 456, or English and the result set only show a single building_name, since that building name is the same for all three results. Currently, it is returning all three records in the list.
Is that possible?
All info I could find about dupDetector was comparing a remote and prefetch. I'm only using a single data source, it just has multiple records with the same name.