How to get field name
Recently i have implemented django-sphinx search on my website. It is working fine of each separate model. But now my client requirement has changed. To implement that functionality i need field name to whom search is made.
suppose my query is: "select id, name,description from table1" and search keyword is matched with value in field "name". So i need to return that field also. Is it possible to get field name or any method provided by django-sphinx which return field na开发者_开发问答me.
Please help me...
As far as I know, this isn't possible. You might look at the contents of _sphinx though.
Well from django-sphinx it might not be possible. But there is a solution -
- Make different indexes, each index specifying the field that you need to search.
- In your django-sphinx models while searching do this -
search1 = SphinxSearch(index='index1')
search2 = SphinxSearch(index='index2')
...
After getting all the search results, you aggregate them & you have the info of from where they have come.
精彩评论