0

I know that the stopword file could be changed with the help of the ft_stopword_file variable in MySQL. But I need read these stopwords into an array in PHP. So my questions is,

Is there a way to get the Stop Words resultset by querying a database with an SQL Query ?

hippietrail
  • 15,848
  • 18
  • 99
  • 158
krishna
  • 3,547
  • 5
  • 27
  • 29

2 Answers2

4

The list of stop-words is specified in this file storage/myisam/ft_static.c. So if you want them in a array in PHP, just read the file and convert the contents into the format you need. Apart from this, I dont think there is any other way to query the list from MySQL. Also, please see the stop-words manual

Balanivash
  • 6,709
  • 9
  • 32
  • 48
  • I was not able to find this file in that location. I am using MySQL 5.1 on Windows 7 – krishna Jul 06 '11 at 18:45
  • Just search for the `myisam/ft_static.c` file in the drive where you have installed MySQL. – Balanivash Jul 06 '11 at 18:53
  • I did that already, but wasn't able to find it. Even searched my.ini for ft_stopword_file, didn't find this entry in the file. Then I did show variables like '%ft_stop%'; in the result set against the value it says "built-in". What does that mean ? . I installed this version of MySQL as part of the Zend Server Installation. – krishna Jul 06 '11 at 18:59
  • Hmm.. I'm not exactly sure about windows, but Check this post [how-to-reset-stop-words-in-mysql](http://stackoverflow.com/questions/796688/how-to-reset-stop-words-in-mysql). This might give you some insight into what you can do. – Balanivash Jul 06 '11 at 19:09
2

No, but if you've set the path to the stopword file by setting the ft_stopword_file variable, then you know where that file is and can read it in your PHP script directly.

Dan Grossman
  • 51,866
  • 10
  • 112
  • 101
  • I mentioned the path variable, just to show I did some research on the topic:). I didn't create a new stopword file and I don't intend to at this point. But I was thinking more in the lines of what if I change the version of MySQL in the future(stop words could change aswell in this version). Wouldn't it be cool to seamlessly get it from the database with a query. But seems like it is not possible from your answer. Thanks. – krishna Jul 06 '11 at 18:35
  • Even if the version changes, the file where the stop-words are stored is not going to be changed much, and if any mods is going to be made, it'll be made in the file. So, reading from the file is a good(only) option for your needs – Balanivash Jul 06 '11 at 18:38