Phoca Download Search not returning exact phrase results

Phoca Download - download manager
clingc
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 29 Jan 2015, 19:30

Phoca Download Search not returning exact phrase results

Post by clingc »

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!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Search not returning exact phrase results

Post by Jan »

Hi, which version you are using?

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

:idea:

Jan
If you find Phoca extensions useful, please support the project
clingc
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 29 Jan 2015, 19:30

Re: Phoca Download Search not returning exact phrase results

Post by clingc »

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?

:?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Search not returning exact phrase results

Post by Jan »

The difference is:

Code: Select all

$text		= $db->Quote('%'.$db->getEscaped($text, true).'%', false);
and

Code: Select all

$word		= $db->Quote('%'.$db->getEscaped($word, true).'%', false);
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
If you find Phoca extensions useful, please support the project
clingc
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 29 Jan 2015, 19:30

Re: Phoca Download Search not returning exact phrase results

Post by clingc »

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.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Search not returning exact phrase results

Post by Jan »

And if you remove the quotes and set exact phrase in search settings :idea:
If you find Phoca extensions useful, please support the project
Post Reply