Toon posts:

[mysql] Fulltext search

Pagina: 1
Acties:

Verwijderd

Topicstarter
ik heb deze tabel:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CREATE TABLE `forum_postext` (
  `post_id` int(10) NOT NULL default '0',
  `post_text` text,
  PRIMARY KEY  (`post_id`),
  FULLTEXT KEY `post_text` (`post_text`)
) TYPE=MyISAM;

#
# Gegevens worden uitgevoerd voor tabel `forum_postext`
#

INSERT INTO `forum_postext` VALUES (205, 'As more and more people demand high end graphic cards, more companies arise, offering different bundled features and prices. The competition for companies is getting intense; consumers now have multiple companies to choose from when looking for a video card. Today we introduce a relatively new company, a division of PINE, XFX. XFX focuses on the production of both high and low end graphic cards--from the high');
INSERT INTO `forum_postext` VALUES (1, 'sdfsdfda dfa d d a df a d');
INSERT INTO `forum_postext` VALUES (2, 'asdasdfa dasf sd adfad ');
INSERT INTO `forum_postext` VALUES (3, 'fdhfdh');
INSERT INTO `forum_postext` VALUES (4, 'fdhfdh');
INSERT INTO `forum_postext` VALUES (0, 'more');


Nou gebruik ik:
code:
1
SELECT * FROM forum_postext WHERE MATCH (post_text) AGAINST ('more')

Maar ik krijg gewoon geen resultaten. Waarom niet?

  • Pollus
  • Registratie: Juni 2004
  • Laatst online: 05-09-2022
Of "more"is een stopword of de minimale woordlengte staat > 4.
Het probleem is dat dit ontwikkeld is voor grote(re) databases.

lees dit maar even: http://dev.mysql.com/doc/mysql/en/fulltext-search.html

Wat je wellicht beter kan doen, als je db niet te groot is, dat je de records een voor een uitleest met php, bijvoorbeeld met "stristr(string haystack, string needle)"

Of iets dergelijks...

Pollus


  • NMe
  • Registratie: Februari 2004
  • Laatst online: 15-04 22:07

NMe

Quia Ego Sic Dico.

Pollus schreef op vrijdag 28 januari 2005 @ 00:16:
Wat je wellicht beter kan doen, als je db niet te groot is, dat je de records een voor een uitleest met php, bijvoorbeeld met "stristr(string haystack, string needle)"
Dan kun je IMHO net zo goed een SQL query met LIKE erin nemen. Maar ik zie nergens dat de database van topicstarter niet groot is, dus ik zou gewoon in de documentatie duiken en het probleem proberen op te lossen alvorens allerlei vieze dingen te gaan doen omdat het echt niet anders kan. :P

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


Verwijderd

Topicstarter
Helemaal juist, het gaat hier soms om posts van 1000 chars, dus ik wil gewoon dat dit werkt.

Ik ben reeds in de documentatie gedoken, en dit zou gewoon moeten werken, ben dus op zoek naar iemand die weet waarom niet.

  • rickmans
  • Registratie: Juli 2001
  • Niet online

rickmans

twittert

Waarschijnlijk heeft dit te maken dat 'more' beschouwd wordt als een noise wordt of zoals Pollus zegt dat je fulltext groter dan 4 staat afgesteld (hoe dat moet staat heel mooi hier: http://dev.mysql.com/doc/mysql/en/fulltext-fine-tuning.html). Naast dat kan het ook zijn dat more dus een noiseword is. De noise word lijst kan je gelukkig ook nog editten (zie hier: http://dev.mysql.com/doc/...ver-system-variables.html), de kleine quote uit de pagina:
#

ft_stopword_file

The file from which to read the list of stopwords for full-text searches. All the words from the file are used; comments are not honored. By default, a built-in list of stopwords is used (as defined in the myisam/ft_static.c file). Setting this variable to the empty string ('') disables stopword filtering. This variable was added in MySQL 4.0.10.

Note: FULLTEXT indexes must be rebuilt after changing this variable. Use REPAIR TABLE tbl_name QUICK.

Don't mind Rick


Verwijderd

Topicstarter
Et was idd die ft_min_word_len, tenminste, hij staat op 4, dat klinkt alsof het zou moeten werken, maar anders zal het wel dat stopwoord zijn.

Nou wil ik die word lenght op 3 zetten, met
code:
1
SET ft_min_word_len = 3


Maar dan krijg ik "#1193 - Unknown system variable 'ft_min_word_len'"
Terwijl hij wel gewoon bij SHOW VARIABLES staat. Hoe kan ik dit dan aanpassen?
Pagina: 1