Closed Bug 1257382 Opened 10 years ago Closed 9 years ago

Support some kind of regex-like matches on text fields in Super Search

Categories

(Socorro :: General, task, P2)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: kairo, Assigned: adrian)

Details

Attachments

(1 file)

In queries I have running in my PostgreSQL-based reports, I have this gem, see http://hg.mozilla.org/users/kairo_kairo.at/crash-report-tools/file/tip/get-categorycounts.php#l94 : # The signature starts with a non-symbolized file@0xFOOBAR piece (potentially after a @0x0 frame). 'filter' => "split_part(regexp_replace(signatures.signature, '^@0x0 \| ', ''), ' | ', 1) LIKE '%_@0x%'", (This 'filter' is later appended to the SQL query with an AND in the WHERE clause) This could potentially be rewritten to something like this in (perl-style) regex terms: /^(@0x0 \| )?[^@\|]+@0x/ I don't see how I could get something like this to work with the current Super Search API but it would be really great if we could do something like this in regex-style with the Super Search API. I had some other special cases every now and then where regex searches on some text fields would have been interesting.
Adrian, any chance something like that is doable?
Flags: needinfo?(adrian)
I'm confident it is doable, elasticsearch supports regex of course. However we'll have to use their syntax, which is documented here: https://www.elastic.co/guide/en/elasticsearch/reference/1.4/query-dsl-regexp-query.html#regexp-syntax My solution will be to add a new "regex" operator to string fields (those that have starts with and all) that will accept Elasticsearch's regex syntax.
Assignee: nobody → adrian
Flags: needinfo?(adrian)
Priority: -- → P2
(In reply to Adrian Gaudebert [:adrian] from comment #2) > My solution will be to add a new "regex" operator to string fields (those > that have starts with and all) that will accept Elasticsearch's regex syntax. That sounds great, will be helpful for cases like I have there (and which I can't replicate in any other form right now).
Commit pushed to master at https://github.com/mozilla/socorro https://github.com/mozilla/socorro/commit/8907f1dc9893e4d88b02537ddb165965dffbdb2f Fixes bug 1257382 - Added a regex operator for strings in Super Search. (#3296) * Fixes bug 1257382 - Added a regex operator for strings in Super Search. * added documentation and fixed param not being recognized * Added a new helper to make query strings from dicts.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: