documentcloud/visualsearch — pull request #105 by DracoBlue (2013-05-26 16:49:38+00:00)
Title: Remove the remainder based on the optional label value.

If a facet-value is given, the autocompletion failed to calculate the remainder based on the label, since the label is what the user sees while typing.

Testcase, change:

facetMatches : function(callback) {
callback([
'account', 'filter', 'access', 'title',
{ label: 'city', category: 'location' },
{ label: 'address', category: 'location' },
{ label: 'country', category: 'location' },
{ label: 'state', category: 'location' },
]);
}

to

facetMatches : function(callback) {
callback([
'account', 'filter', 'access', 'title',
{ label: 'city', category: 'location' },
{ label: 'address', category: 'location' },
{ label: 'country', category: 'location' },
{ label: 'state', "value":"loc.state", category: 'location' },
]);
}

and type "sta" (the state-facet should be autocompleted) and press enter.

Expected behaviour: Search query should be "loc.state:"
Result: Search query is: "text: sta loc.state:"