Database Administrators Asked by lares.dk on January 4, 2022
I need to be able to search for compound words like “menneskerettighedsforkæmperens” (the human rights activist’s) and find the words “menneske” (human), “rettighed” (right) and “forkæmper” (activist).
I have all the words (and hundreds of thousands of other words) listed in MySQL, all in separate rows with additional information about each word (like hyphenation, which is what I need the DB to return), but I need to search a lot of words at the same time, which can be painfully slow.
I’m currently using a MySQL database, but willing to switch it out for something better suiting my needs, maybe some kind of NoSQL or elasticsearch. But I haven’t been able to find any examples of how to accomplish what I’m looking for in any other type of databases. So if anyone can help me out, I would really appreciate it.
I would look for a library that specializes in splitting compound words. Search Java, PHP, Perl, etc. SQL is not likely to be involved.
If you must use a database, then consider this for a piece of the algorithm:
SELECT word FROM words
WHERE word < 'menneskerettighedsforkæmperens'
ORDER BY word DESC
LIMIT 5;
That is likely to return a few compound words that begin with 'menneske' and perhaps 'menneske', itself.
In MySQL, that query will be quite fast (assuming an index on word
). You would need some code in addition to a few SQL calls.
Answered by Rick James on January 4, 2022
1 Asked on October 28, 2021 by gunnar
1 Asked on October 28, 2021 by vivvvi
mysql mysql 5 0 mysql 5 1 performance query performance slow log
0 Asked on October 28, 2021 by jarrette
2 Asked on October 28, 2021
1 Asked on October 28, 2021 by user9516827
1 Asked on October 28, 2021 by rainer-yuan
2 Asked on October 28, 2021 by jshark
execution plan index tuning optimization query performance sql server
2 Asked on October 28, 2021 by rajnikant-sharma
1 Asked on October 28, 2021 by dean-kayton
0 Asked on October 28, 2021 by 2alltra8034
0 Asked on October 28, 2021 by wavrik
1 Asked on October 28, 2021 by pantea
0 Asked on October 27, 2021 by miyuki-narahara
2 Asked on October 27, 2021 by chessbrain
Get help from others!
Recent Questions
Recent Answers
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP