etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.2k stars 130 forks source link

Which field the result comes from? #241

Closed lucasradix closed 4 years ago

lucasradix commented 6 years ago

I have a model with three textFields: title, description and sideText. One of the objects of this model is filled as: title = 'Hello' description = 'Hello everybody' sideText = 'Welcome'

When I search for 'Hello', my result array has only one object with the 'content' attribute containing 'Hello Hello Everybody' (concatenation of title + description'). How can I get which model fields 'Hello' was found? That is, is there an array attribute, or something like this, in the result object containing 'title' and 'description'?

Thank you.

etianen commented 6 years ago

You cannot get which fields the match was found in. The searchable text is concatenated by watson and put in a large full text index for efficient search. This means that the informatino you're after is lost.

On 1 March 2018 at 20:26, lucasradix notifications@github.com wrote:

I have a model with three textFields: title, description and sideText. One of the objects of this model is filled as: title = 'Hello' description = 'Hello everybody' sideText = 'Welcome'

When I search for 'Hello', my result array has only one object with the 'content' attribute containing 'Hello Hello Everybody' (concatenation of title + description'). How can I get which model fields 'Hello' was found? That is, is there an array attribute, or something like this, in the result object containing 'title' and 'description'?

Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/241, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCCvvkcsx9s7kyNrZbrJCQG3JzN2mks5taFlmgaJpZM4SY8J1 .