Motivation
:
In general, you need a exposed filter, which e.g. has a "contains" operator an operates like a search, but on several fields at the same time, not just one. So e.g. look in the user->name and user->email field to match this filter, or esp. with CCK implementations, it can become very useful, if implemented generically.
Proposal: Phase 1
:
- new global filter: Compounded
- you can select 2 fields which are concatenated using a space
- importantthe direct field-alias is used by the query, not what the filter-handler is returning in render. This will need documentation and a hint for the end-user
- the sql backend, concats every field selected in the SQL query, giving it a alias..which can then be used for the filter
Proposal: Phase 2
:
- You can select any number of fields
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | 1421382-port.patch | 3.81 KB | eugenmayer |
| #19 | 1421382-port.patch | 3.81 KB | dawehner |
| #16 | move_ensure_table_to_query-1421382-16.patch | 1.05 KB | derhasi |
| #13 | move_ensure_table_to_query-1421382-13.patch | 986 bytes | steffenr |
| #10 | 1421382-final.patch | 6.31 KB | dawehner |
Comments
Comment #1
eugenmayer commentedComment #2
eugenmayer commentedwe should rather not use CONCAT_WS, as its not ansi-sql. As suggested, we should use
Comment #3
dawehnerThe patch was developed against 7.x-3.x, there is nothing which can be changed here.
A backport should be actually much less code.
Comment #4
dawehnerThis time with proper seperation of the spaces.
Comment #5
dawehnerHere is a version with a multi-select as ui.
Comment #6
eugenmayer commentedKam glad to Test Run the d6 verslum when its available. Tanks for the work!
Comment #7
steffenrThanks for providing the patch - unfortunatly it causes in SQL error while using Field-API Fields. If you look in the SQL-Query the table names are missing for the fields. In my case i'm using domain_access - but this should not crash the query - non-filtered output is ok.
SteffenR
Comment #8
dawehnerHey that's not an already existing bug :)
Here is a small improvement to the patch, which simply requires to add the table to the query all the time.
Comment #9
steffenr@dereine - thx for rerolling the patch - i tried it on my view and it worked like charme. It would be great if we could bring it into views core..
SteffenR
Comment #10
dawehnerThanks for the testing!
Committed with some small improvements, see patch to 7.x-3.x
Now the patch can be backported to 6.x-3.x
Comment #11
eugenmayer commentedhow can i test it for d6 to help you out?
Comment #12
derhasi commentedSorry, Daniel, I have to reopen this issue for D7 again, as there is a problem with relationships, due to the
$field->ensure_my_table();part inpre_query(). It breaks the relationships, as$this->_pre_query();is called before$this->_build('relationship');in view::build().One thought to fix this, could be moving ensure_my_table() to query(). I'll test this with SteffenR's help.
Comment #13
steffenrLike derhasi said, we retested the whole thing by putting ensure_my_table directly into the query() - function.
In my testings it worked fine - i hope it won't break any other "views - query - building - stuff" ..
Attached you find a patch that should apply to the latest views DEV ..
Comment #14
derhasi commentedI tested it on the view that created the problem, and I've to say, it works with the additional patch of #13 (plus #10).
Comment #15
dawehnerYou asked for a review here is one. It would be cool to still have this comment
Comment #16
derhasi commenteddereine, ok, there's the comment ;)
Comment #17
dawehnerThanks! Now let's backport it. For other patches it might be helpful to create new issues, so it's less confusing.
Comment #18
eugenmayer commentedSo its D6 time? Can i assist somehow?
Comment #19
dawehnerOkay here is a patch for the port.
Comment #20
eugenmayer commentedwill test it - awesome Daniel!
Comment #21
tommyk commentedI've only tested it on one view in D6, but it worked. Excellent functionality.
Comment #22
IWasBornToWin commentedAm I understanding I might be able to type data into one filter but include other fields to be searched upon? I'd really enjoy this. If so, is there a patch or module for Views 7.3?
Comment #23
eugenmayer commentedWell we ran into issues with one field, 5 fields worked out. What is specic to this field?
- its CCK multiple textfield
- the field configuration is configured to return the first field only
- those are telefon numbers ( as string)
The reason is, the field missed the alias in the concat, we debugged it down: http://pastie.org/6051975 on line 52
As you see, the field-table alias is broken, even the . is there.
Iam pretty suprised though that the field is missing in the FIELD part of the select statement. the field is shown, its neither exclude (well that would not even matter). Here is a screenshot of the field configuration: http://screencast.com/t/XILZ2ZxQD
Daniel, if you have time, just ping me, iam glad to help debugging
Comment #24
eugenmayer commentedupdating status
Comment #25
dawehner"Awesome"
Comment #26
eugenmayer commentedActually, awesomesouce!
I rerolled the patch, so be aware!
Comment #27
dawehnerThis line should really check for both table alias and field alias.
Comment #28
eugenmayer commentedcould you reroll? Not sure which location you mean - ill test it
Comment #29
dawehnerI mean exactly that line. It should be more like
if (!empty($field->table_alias) && !empty($field->field_alias)) {Comment #30
mustanggb commented