Turn search criteria quoteing off.

jrmint

Joined: 2005-08-20
Posts: 94
Posted: Wed, 2005-11-23 13:06

I am trying to come up with a solution for full text / Boolean searchs.

I am having trouble finding the exact file that automatically quotes the search words. I believe it is the Smarty_Compiler.class.php. But not sure.

Thanks for any input you can give.

David

Gallery version = 2.0.1+ core 1.0.9
PHP version = 4.3.4 apache2handler
Webserver = Apache/2.0.49 (Linux/SuSE)
Database = mysql 4.0.18
Toolkits = ArchiveUpload, Exif, NetPBM, SquareThumb, Thumbnail, Gd
Operating system = Linux JE1 2.6.5-7.201-bigsmp #1 SMP Thu Aug 25 06:20:45 UTC 2005 i686
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Fri, 2005-11-25 12:15

David---- By 'automatically quotes the search words' do you mean the way that that word is highlighted within the bulk of the suggested results (ie similar to the results of a search on Google)?
----best wishes, Robert

 
jrmint

Joined: 2005-08-20
Posts: 94
Posted: Fri, 2005-11-25 13:21

The type of quoteing I am looking at is when you type a word or words in the search box and press search the word or words are being marked with '' and then the search begins. i.e.

I want to do a BOOLEAN search for "SantaFe Sking" but only for the year 1999. the text is marked 'SantaFe Sking 1999' and then the search returns the hits.

The Caption reads somthing like this
SantaFe New Mexico has had a steller year for Sking. 1999 has proven to be one of the best snow falls the mountain has seen in decades. The locals are very happy with SantaFe sking.

What I would like to do is not have any words quoted but be able to do single quotes or double quotes myself.

This is for FullText or Boolean searching purposes.

I have made a change to the GalleryCoreSearch.class file that is alwoing me to by pass the phase searching. Bellow is what I have done to this file so far.

I changed

if (isset($options[$key])) {
$whereList[] = "$column LIKE ?";
$whereData[] = '%' . $criteria . '%';
$selectMap[$column] = $columnNumber++;;
$selectList[] = $column;

to the following

if (isset($options[$key])) {
$whereList[] = "MATCH($column) AGAINST ( '($criteria)' IN BOOLEAN MODE)";
$selectMap[$column] = $columnNumber++;;
$selectList[] = $column;

With this change I now get hits on all words SantaFe and Sking and 1999. Each word is being searched separately With no highlighting. I think it is not highlighting becouse the words are still being quoted during the search process.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-11-25 14:11

you know that you have to prepend a + sign for each word when you want only matches that match all the words, right?

http://dev.mysql.com/doc/refman/4.1/en/fulltext-boolean.html

@quotes:
we get the searchCriteria string without quotes.
when you type: hello friend you get the exact same as criteria in G2
if you type: "hello friend", you get "hello friend" in G2

and that's exactly what you get in your search interface implementation, e.g. in GalleryCoreSearch.class function search()

a search request goes to modules/search/SearchScan.inc handleRequest and from there to your search interface implementation.

 
jrmint

Joined: 2005-08-20
Posts: 94
Posted: Fri, 2005-11-25 15:26

I tryed to use the + but come up with errors.

$whereList[] = "MATCH($column) AGAINST ( '+($criteria) +($criteria)' IN BOOLEAN MODE)";

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-11-25 15:31

first you need to split criteria into words, since you want to prepend + for each word, right?
input $searchCriteria = "hello friend";
goal: "+hello +friend"

if the input already has quotes, you need first to extract the groups of words and then add the +

 
jrmint

Joined: 2005-08-20
Posts: 94
Posted: Fri, 2005-11-25 15:54

I understand. I can use the + in my search box. That works.
But I can't do double quotes +word

"Santafe ski" +1999

The more words I use the less hits I should have is what I am going for.

I have tryed
\"Santafe ski\" +1999
also

 
jrmint

Joined: 2005-08-20
Posts: 94
Posted: Fri, 2005-11-25 16:09

Also
The hightlighting isn't working using the +

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-11-25 16:22

well, experiment in phpmyadmin independent of G2.
i have never used fulltext search. you should first check in phpmyadmin / mysql shell whether the query you intend to use will work. so check how to define "Santafe ski" as a single search term...

 
jrmint

Joined: 2005-08-20
Posts: 94
Posted: Fri, 2005-11-25 16:51

Thanks for you help valiant.

Any idea why the highlight isn't working?

I was thinking that it might be the \\1

I tryed \\1 \\2

That didn't work.