It looks like terms for search with Views2 filter always OR'ed and there is no built functionality to change it?
Example: we have nodes:
wild west
wild wild
west west
With core Search module on query "wild west" the result will be only:
wild west
With views search terms on the same query the result will be:
wild west
wild wild
west west
ie results = "wild OR west" query if using core search
Operators "AND", "OR" are accepted as search terms by Views2 filter, not as operators.
Live demo: http://demo.waysys.ru
how to change Views2 filter to use AND instead of OR?
(i really don't mind hacking core)
PS Why i'm using Views search filter instead of core search? I'm going to display search results in table with custom fields, only nodes of one type, sort by fields...
PPS Sorry for my english :)
Comments
Comment #1
fumbling CreditAttribution: fumbling commentedBy the way, are you using the "Search: search terms" filter? I really like the older filter-by-keyword "search filter" that Views lets you apply (e.g. go to filters, choose Node: Title and then click the "expose" button) but I noticed it can't search on whole words only (e.g. a search on "art" will pull up node titles with "heart" and "cart"). Any idea how to get it to search on whole words? The "Search: search terms" option is something new I'm just now learning. That's really odd that they don't use the same logic as core search as you point out.
Comment #2
fumbling CreditAttribution: fumbling commentedI've decided to use the "Search: search terms" filter and am having the same issue as you, I need to switch to OR rather than AND. Were you successful in doing that?
Comment #3
gulliverrr CreditAttribution: gulliverrr commentedI have managed to use javascript inside views to manipulate the url parts to AND the various taxonomy terms
i.e.: example.com/wild/west
will only display wild west
and example.com/west
will display wild west and west
My problem is not finished yet as Im trying to have dynamic filtering as you click through the taxonomy terms.
Example again:
Imagine I have this simple structure:
Cars
-SUV
--Red SUV
--Blue SUV
-City Car
--Red City Car
--Blue City Car
Motobikes
...
From the beginning I want to be able to choose by color OR by vehicle (Car/Motobike) OR by vehicle type OR price range etc.
Once I select, say, Red, I want to see again the remaining filters (vehicle, vehicle type, price range) which upon selection will AND my selection with the selection(s) so far. Note I dont need to follow the path I have described above and I should be able to navigate to the same results no matter how I choose my filters.
Everybody points to use Views but after a loooot of experimenting I still cannot do it without the hacky "solution" of javascript which I dont like.
Any ideas?
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedWith the most current Views search terms filte,r it is the same as core. If you type term AND term the terms will be anded. If you type term term the terms will be ored. If you type 'term term term' phrase matching will be used.
Comment #5
teerex CreditAttribution: teerex commentedmerlinofchaos thanks,
Updated Views to 6.x-2.3
Works fine.
Comment #6
teerex CreditAttribution: teerex commentedgulliverrr
"From the beginning I want to be able to choose by color OR by vehicle (Car/Motobike) OR by vehicle type OR price range etc."
that will be the first one in chain
maybe write custom block for view filter?
Working custom block with filter parameters in view.
With some customizations i think you can get what you want exactly.
User writes search query and selects Categories with checkboxes. Current search query is saved.
P.S. maybe not secure and fast, it's only a draft