hz-magic-search-bar does not honor isServer property

Bug #1496627 reported by Travis Tripp on 2015-09-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Medium
Travis Tripp

Bug Description

Server side searching and filtering is disrupted by client side smart table filtering. The magic search documentation allows you to set an isServer property for facets. However, ff you set a facet as isServer, smart table filtering will still be done. In the case of wildcards or more advanced searching that is done on the server side which requires server logic, the client side filtering may subsequently wipe out a server response, potentially hiding results, because the client side filtering doesn't understand that the syntax passed to the server will not match content on the client side.

The culprit is that hz-magic-search-bar wraps st-magic-search.

https://github.com/openstack/horizon/blob/master/horizon/static/framework/widgets/magic-search/hz-magic-search-bar.html#L6

st-magic-search is doing the client side filtering here regardless of the isServer property.

https://github.com/openstack/horizon/blob/master/horizon/static/framework/widgets/magic-search/st-magic-search.directive.js#L100

The filterFacets are typically in scope for st-magic-search. If nothing else, it could check the filter facets to see if the isServer property is set on each facet before performing search. Perhaps something like the below:

 if (scope.filterFacets) {
   var isServerFacet = scope.filterFacets.some(function checkIsServer(facet) {
   return facet.name == predString && facet.isServer;
 });

 if (isServerFacet) {
   return;
   }
 }

There also should be a way to disable client side full text filtering and allow that to only come from server side (important for searchlight).

https://github.com/openstack/horizon/blob/master/horizon/static/framework/widgets/magic-search/st-magic-search.directive.js#L70

Possibly, an attribute on hz-magic-search-bar of client-full-text-search="false" could be added and then honored by st-magic-search directive.

description: updated
description: updated

Fix proposed to branch: master
Review: https://review.openstack.org/224896

Changed in horizon:
assignee: nobody → Rajat Vig (rajatv)
status: New → In Progress

Fix proposed to branch: master
Review: https://review.openstack.org/224927

Travis Tripp (travis-tripp) wrote :

This bug is preventing me from using magic search to do server side searches.

Changed in horizon:
milestone: none → liberty-rc1
Rob Cresswell (robcresswell) wrote :

Moving from RC1, as I don't see this as a blocking issue. Feel free to correct if you think I'm wrong on this! Will be on IRC all day.

Changed in horizon:
importance: Undecided → Medium
milestone: liberty-rc1 → next
Changed in horizon:
milestone: next → liberty-rc1
Travis Tripp (travis-tripp) wrote :

Rob, I have a plugin for liberty searchlight I'm working (still undecided whether to push to separate github repo), but this bug actually just caused me to lose 3 days time. I'd like to be able for this to be able to be used with liberty horizon and not carry this bug fix in my patch. Maybe we'll have other ways around, but since we have fixes for it I don't see why to push it. There are two associated bugs on it.

One I just spent 2 hours verifying:

https://review.openstack.org/#/c/224896/3

I'm now looking at the second to reverify:

https://review.openstack.org/#/c/224927/

Reviewed: https://review.openstack.org/224896
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=80ac4fabadd8ac270746fef26fba90c6b368fbd2
Submitter: Jenkins
Branch: master

commit 80ac4fabadd8ac270746fef26fba90c6b368fbd2
Author: Rajat Vig <email address hidden>
Date: Thu Sep 17 13:48:44 2015 -0700

    Skip client side filter if the Facet is server side

    Change-Id: Ie82993e9dacd54b7bbc01d33e4b191f93fc3a4fc
    Partial-Bug: #1496627

David Lyle (david-lyle) on 2015-09-24
Changed in horizon:
milestone: liberty-rc1 → none

Fix proposed to branch: master
Review: https://review.openstack.org/228665

Change abandoned by Rajat Vig (<email address hidden>) on branch: master
Review: https://review.openstack.org/224927
Reason: There's a duplicate at https://review.openstack.org/#/c/228665/

Change abandoned by Rajat Vig (<email address hidden>) on branch: master
Review: https://review.openstack.org/229593
Reason: The parent patch has now absorbed all the changes

Reviewed: https://review.openstack.org/228085
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=fc1220d53c2197a9b00f220dfba3fa305b52350b
Submitter: Jenkins
Branch: master

commit fc1220d53c2197a9b00f220dfba3fa305b52350b
Author: Rajat Vig <email address hidden>
Date: Fri Sep 25 12:58:52 2015 -0700

    Magic Search is firing multiple checkFacets event

    On removeFacet, magic-search is emitting 2 checkFacets
    event instead of just one

    Change-Id: I5e35bb25c56b97294deacab68a543511dd40ad12
    Partial-Bug: #1496627

Changed in horizon:
assignee: Rajat Vig (rajatv) → Travis Tripp (travis-tripp)
Changed in horizon:
assignee: Travis Tripp (travis-tripp) → Rajat Vig (rajatv)
Changed in horizon:
assignee: Rajat Vig (rajatv) → Travis Tripp (travis-tripp)
Changed in horizon:
assignee: Travis Tripp (travis-tripp) → Rajat Vig (rajatv)
Changed in horizon:
assignee: Rajat Vig (rajatv) → Travis Tripp (travis-tripp)

Change abandoned by Rajat Vig (<email address hidden>) on branch: master
Review: https://review.openstack.org/228665

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers