PDA

View Full Version : apostrophe


witness
02-23-2004, 05:44 AM
Salut, j'ai quelques interrogations face aux apostrophes dans phpDig. Comment fonctionnent-t-ils?

Par exemple, j'ai une phrase qui dit "Un peu d'histoire",
Si je recherche "histoire", phpDig ne me retourne aucun résultat, mais si je cherche "d'histoire", j'ai un résultat.

Je sais qu'en anglais, les apostrophes ne sont pas vraiment un problème, mais en français dieu sait qu'il y en a beaucoup!

J'apprécie vraiment toute votre aide.

Merci.

Charter
02-23-2004, 10:13 AM
Hi. For the phrase "Un peu d'histoire" PhpDig version 1.8.0 treats d'histoire as one word so it finds a result. However, when searching on histoire, and assuming the page text does not contain histoire but does contain d'histoire, PhpDig will not return a result. This is because the apostrophe is allowed and LIKE "keyword%" is used in the search query so histoire does not match d'histoire.

witness
02-23-2004, 10:41 AM
Thanks Charter.

Is there any way that I can change this?
Like maybe put LIKE "%keyword%"? Because apostrophes in french are pretty current so I can't have important words not come out because of them.

I'd appreciate any help.

Thanks.

Charter
02-23-2004, 11:59 AM
Hi. You could try the %keyword% approach in the search_function.php file by editing the $like_start, $like_end, and/or $like_operator variables, but %keyword% queries can be slow. You could also try removing the escaped apostophe from the $text variable in the phpdigEpureText function of the phpdig_functions.php file and from the $what_query_chars variable in the phpdigSearch function of the search_function.php file, and then do a reindex. If you do the latter, then you may need to edit the exact phrase portion so that phrases with an apostrophe are found. If your database tables are not large, perhaps the former method would be sufficient if not too slow.

witness
02-23-2004, 12:07 PM
I'm trying it right now!

witness
02-23-2004, 12:37 PM
Sorry i've tried (both files), but it doesn't seem to work.

What do you mean by "edit the exact phrase portion"?

[Also, is there any reason why, even though I select ANY in the form, phpDig takes the query string and searches for it at the beginning?

i.e. if i am searching "rative" and i know that the word "figurative" exists, why does it not find any results??]

Thanks

Charter
02-23-2004, 02:34 PM
>> Sorry i've tried (both files), but it doesn't seem to work.

Hi. Did you reindex after removing the escaped slash in those two places? Try indexing a demo page after making the changes and see what turns up in the seach results for words with/without the apostrophe.

>> What do you mean by "edit the exact phrase portion"?

The exact phrase code in PhpDig version 1.8.0 may need to be edited to work with any apostrophe related changes in the code.

>> Also, is there any reason why, even though I select ANY in the form, phpDig takes...

If you are using PhpDig 1.8.0, the language pack needs to be edited to reflect "and operator - exact phrase - or operator" instead of what you see onscreen. PhpDig 1.6.5 allows for "any" but PhpDig 1.8.0 uses LIKE "keyword%" queries, as LIKE "%keyword%" queries can be slow.

The Changelog (http://www.phpdig.net/info/changelog.txt) has a list of differences/updates between versions. Maybe try editing the search_function.php file to have LIKE "%keyword%" queries and check the search times.

witness
02-24-2004, 04:08 AM
I've re-tried the 2file-solution and am happy to report that everything seems to be working well.

Thank you very much Charter! Your help and quickness in response are greatly appreciated!