views:

27

answers:

2

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 name.

Please help me...

A: 

As far as I know, this isn't possible. You might look at the contents of _sphinx though.

mlissner
+1  A: 

Well from django-sphinx it might not be possible. But there is a solution -

  1. Make different indexes, each index specifying the field that you need to search.
  2. 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.

MovieYoda