Hello everyone,
I recently installed the Phoca Download Search plugin so that the search on my site will also return Phoca documents in the results.
The problem I am having is that if we use an exact phrase search by containing the phrase in double quotes (ie, "some exact phrase"), the result is not returned. Searching for the individual words in the phrase returns the results expected.
Can someone assist me? Is there something that needs to be changed for the Phoca Download Search to have it see the double quotes as an exact search like the joomla search does?
Thank you!
Phoca Download Search not returning exact phrase results
-
- Phoca Newbie
- Posts: 4
- Joined: 29 Jan 2015, 19:30
- Jan
- Phoca Hero
- Posts: 48566
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Download Search not returning exact phrase results
Hi, which version you are using?
To see and edit the SQL query for the search, see:
plugins/search/phocadownload/phocadownload.php

Jan
To see and edit the SQL query for the search, see:
plugins/search/phocadownload/phocadownload.php

Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 4
- Joined: 29 Jan 2015, 19:30
Re: Phoca Download Search not returning exact phrase results
Hello Jan,
I am using version 2.0.1 of the search plugin.
The only change I have made to the plugins/search/phocadownload/phocadownload.php file is to change it to default to file view:
line 273:
$listFiles[$key]->href = JRoute::_(PhocaDownloadHelperRoute::getFileRoute($value->id, $value->catid, $value->alias));
The rest of the code is as it was from install. I see two switch cases for "exact" searches and the query that is there. But I am not sure if it is 1) getting exact as the case and/or 2) needs changes to the actual query?

I am using version 2.0.1 of the search plugin.
The only change I have made to the plugins/search/phocadownload/phocadownload.php file is to change it to default to file view:
line 273:
$listFiles[$key]->href = JRoute::_(PhocaDownloadHelperRoute::getFileRoute($value->id, $value->catid, $value->alias));
The rest of the code is as it was from install. I see two switch cases for "exact" searches and the query that is there. But I am not sure if it is 1) getting exact as the case and/or 2) needs changes to the actual query?

- Jan
- Phoca Hero
- Posts: 48566
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Download Search not returning exact phrase results
The difference is:
and
if you search "abc def"
in 1) case: file which includes "abc def" will be searched
in 2) case: file which include "abc" or "def" will be sarched
Jan
Code: Select all
$text = $db->Quote('%'.$db->getEscaped($text, true).'%', false);
Code: Select all
$word = $db->Quote('%'.$db->getEscaped($word, true).'%', false);
in 1) case: file which includes "abc def" will be searched
in 2) case: file which include "abc" or "def" will be sarched
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 4
- Joined: 29 Jan 2015, 19:30
Re: Phoca Download Search not returning exact phrase results
Jan,
I see that the case 1 you listed is being used when $phrase is "exact" and case 2 is used when $phrase is "all" or "any" or default.
But when I use my site search, if I type in the search:
diagram outlining
- I get 2 document results that have these two words in the description (highlighted separately)
but if I type in the search:
"diagram outlining"
- I get 0 results.
I see that the case 1 you listed is being used when $phrase is "exact" and case 2 is used when $phrase is "all" or "any" or default.
But when I use my site search, if I type in the search:
diagram outlining
- I get 2 document results that have these two words in the description (highlighted separately)
but if I type in the search:
"diagram outlining"
- I get 0 results.
- Jan
- Phoca Hero
- Posts: 48566
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Download Search not returning exact phrase results
And if you remove the quotes and set exact phrase in search settings 

If you find Phoca extensions useful, please support the project