Django MySQL full text search

后端 未结 6 1635
终归单人心
终归单人心 2020-12-05 05:20

I need to implement full text search for my Django application, running MySQL as backend.

Let\'s say I\'ve got a model as follows:

class MyItem(model         


        
6条回答
  •  自闭症患者
    2020-12-05 05:42

    You can use full text search in django

    MyItem.objects.filter(title__search="some search text")
    

    One thing is - you can't define a fulltext index from a Django model, you need to do in directly in a database (using PHPMyAdmin or SQL query)

    See Django documentation for field lookup called search

提交回复
热议问题