Filtering queries only works for exact matches

Bug #1503345 reported by Chad Roberts
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sahara
Fix Released
High
Trevor McKay

Bug Description

The query filtering that was implemented is only working for exact matches.

Ideally, the filter would add some wildcards around the search given so that it will return results for partial string matches. Partial string matching is far more likely to be useful for and expected by the end users since the rest of openstack's filtering mechanisms seem to do partial string matches.

Tags: filtering
Chad Roberts (croberts)
Changed in sahara:
assignee: nobody → Trevor McKay (tmckay)
Revision history for this message
Chad Roberts (croberts) wrote :

Original bug (part was split out for a fix in horizon): https://bugs.launchpad.net/horizon/+bug/1503235

Revision history for this message
Trevor McKay (tmckay) wrote :

Okay, there is a simple strategy to fix this.

We add '%' characters around search opts for "_list()" operations originating in the REST api. For existing internal calls, we leave everything unchanged. This will give users substring matching behavior for calls through the client (UI and CLI), to match other openstack projects.

I will post an example patch fixing this for cluster_templates

Revision history for this message
Trevor McKay (tmckay) wrote :

note, we also use "like" filters so that the '%' is effective, and add new simple routines from the api later down to the db, eg cluster_templates_get_all_glob(). This helps guarantee nothing existing is broken and add no special flags but chosen the behavior through REST

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to sahara (master)

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

Changed in sahara:
status: Confirmed → In Progress
Trevor McKay (tmckay)
Changed in sahara:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
Trevor McKay (tmckay) wrote :

Changing the strategy on this. Nova is a good example here -- it uses regular expressions for sqlite, mysql or postgres databases, and uses LIKE as a fallback for other databases.

For the Sahara case, we officially support mysql or postgres, We can use regular expressions for those two dbs, and provide only exact matching for anything else.

regular expressions will be enabled for a subset of columns on sahara objects -- things like name, description, etc. Thinks like uuid fields will not support it.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to sahara (master)

Reviewed: https://review.openstack.org/232067
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=cfa193fd340ff53d1b989a0d23d903e9790ef62f
Submitter: Jenkins
Branch: master

commit cfa193fd340ff53d1b989a0d23d903e9790ef62f
Author: Trevor McKay <email address hidden>
Date: Wed Jan 27 14:38:55 2016 -0500

    Add regex matching for cluster_templates_list()

    This change implements regex matching for filters on string
    values passed to cluster_templates_list() in the REST api.
    No existing internal calls that use cluster_templates_get_all()
    are affected.

    Partial-bug: #1503345
    Change-Id: I1a320ff8c01ef5fdc5e66ed35a2b7a6ec9173175

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to sahara (master)

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

Changed in sahara:
milestone: none → mitaka-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to sahara (master)

Reviewed: https://review.openstack.org/275421
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=de518b1b15f034feb13ddf2866baf93e2c8800e5
Submitter: Jenkins
Branch: master

commit de518b1b15f034feb13ddf2866baf93e2c8800e5
Author: Trevor McKay <email address hidden>
Date: Tue Feb 2 16:44:35 2016 -0500

    Add regex matching for clusters_list()

    This change implements regex matching for filters
    on string values passed to clusters_list() in the REST api.
    No existing internal calls that use cluster_get_all()
    are affected.

    Change-Id: Ifac63bef69cdf8c94132bfb5f14b646ae587b9ab
    Partial-bug: #1503345

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/279196
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=7811036c6a945439a056efcb6f3b2629f9465a8f
Submitter: Jenkins
Branch: master

commit 7811036c6a945439a056efcb6f3b2629f9465a8f
Author: Trevor McKay <email address hidden>
Date: Thu Feb 11 12:11:50 2016 -0500

    Add regex matching for job_binary_internal_list()

    This change implements regex matching for filters on string
    values passed to job_binary_internal_list() in the REST api.
    No existing internal calls that use job_binary_internal_get_all()
    are affected.

    Partial-bug: #1503345

    Change-Id: I268c439ab83587375dbff7e125e23f07c9381d83

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/274273
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=85d463df98739cdf0e7efefd734af2fa051d703c
Submitter: Jenkins
Branch: master

commit 85d463df98739cdf0e7efefd734af2fa051d703c
Author: Trevor McKay <email address hidden>
Date: Fri Jan 29 17:11:53 2016 -0500

    Add regex matching for node_group_templates_list()

    This change implements regex matching for filters on string
    values passed to node_group_templates_list() in the REST api.
    No existing internal calls that use node_group_templates_get_all()
    are affected.

    Partial-bug: #1503345
    Change-Id: I8e8465332c58ed657f22b64016c40e041bd3a54e

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/274940
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=d842d600ada126ef134def7a3e39a1afea3d1770
Submitter: Jenkins
Branch: master

commit d842d600ada126ef134def7a3e39a1afea3d1770
Author: Trevor McKay <email address hidden>
Date: Mon Feb 1 18:44:26 2016 -0500

    Add regex matching for data_sources_list()

    This change implements regex matching for filters on string
    values passed to data_sources_list() in the REST api.
    No existing internal calls that use data_sources_get_all()
    are affected.

    Partial-bug: #1503345

    Change-Id: I906ddf6dc27336c39b7ccf298b0e3558ec86178b

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/278640
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=12db2b72e15dfe12daccc1869df99310896f915c
Submitter: Jenkins
Branch: master

commit 12db2b72e15dfe12daccc1869df99310896f915c
Author: Trevor McKay <email address hidden>
Date: Wed Feb 10 16:18:43 2016 -0500

    Add regex matching for job_binary_list()

    This change implements regex matching for filters on string
    values passed to job_binary_list() in the REST api.
    No existing internal calls that use job_binary_get_all()
    are affected.

    Partial-bug: #1503345

    Change-Id: Id34696ca128214ebb555980ca1f9f068dabc1a11

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/278766
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=2f9d4f5a80296ac1298bdf4c9c4cdd6f9233452f
Submitter: Jenkins
Branch: master

commit 2f9d4f5a80296ac1298bdf4c9c4cdd6f9233452f
Author: Trevor McKay <email address hidden>
Date: Wed Feb 10 17:16:09 2016 -0500

    Add regex matching for job_list()

        This change implements regex matching for filters on string
        values passed to job_list() in the REST api.
        No existing internal calls that use job_get_all()
        are affected.

        Partial-bug: #1503345

    Change-Id: Id19eeae194d7e4c97f041e067f1ee8a57a675815

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/279275
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=1312f67ab877fc94dfbbf3ee6829a983d0fdc46f
Submitter: Jenkins
Branch: master

commit 1312f67ab877fc94dfbbf3ee6829a983d0fdc46f
Author: Trevor McKay <email address hidden>
Date: Thu Feb 11 16:39:02 2016 -0500

    Add regex matching for job_executions_list()

    This change implements regex matching for filters on string
    values passed to job_executions_list() in the REST api.
    No existing internal calls that use job_execution_get_all()
    are affected.

    Partial-bug: #1503345

    Change-Id: Id78d4af41da23b093dafc434c6852e893593d605

Trevor McKay (tmckay)
Changed in sahara:
status: In Progress → Fix Committed
Revision history for this message
Vitalii Gridnev (vgridnev) wrote :

We are moving to Fix Released instead of Fix Committed now

Changed in sahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.