joemfb / ml-search-ng

angular module for MarkLogic search applications
https://joemfb.github.io/ml-search-ng/
9 stars 10 forks source link

Should mlSearch.suggest include qtext? #107

Open grtjn opened 8 years ago

grtjn commented 8 years ago

A co-worker was playing with typeahead in slush, and noticed that if you search for eyeColor:blue first (and actually apply that), and then continue typing with for instance OR eyeColor:b, you only get a suggestion for blue, and not for brown or any other value.

We applied the following line as a workaround (around line 1185), but maybe this should be permanent, or a toggle/option? We do have an options argument, right?

// HACK to suppress having earlier typed constraints influence suggestions..
combined.search.qtext = '';
grtjn commented 8 years ago

Suppressing qtext by default in this particular case of typeahead suggest, might be more intuitive actually..

joemfb commented 8 years ago

I wonder if this should be a search:suggest() RFE ...

Also, there's a cursor-position parameter that lets you limit how much of the text to match: http://docs.marklogic.com/REST/GET/v1/suggest.

Do you picture overriding this consistently for an application, as a toggle, or an a per-call basis?

grtjn commented 8 years ago

Cursor position just influences which part to replace or expand. It does not constraint value suggestions.

Those are constrained by the qtext and structured query in the combined query post body. And the qtext is effectively from the previous time you submitted a search. But if you are extending or replacing the search string, then that would be confusing.

So i'm actually thinking the default should be to suppress qtext.. but a toggle somewhere might be wise too..