Closed siva-wal closed 5 years ago
Hi @siva-wal,
The indexes
method is for fields, which are text data you expect search keywords to match on. For ordering and filters, you need to use attributes, which are defined using the has
method instead:
ThinkingSphinx::Index.define :article_page_detail, with: :active_record do
indexes title, plain_text, html_text
index article.name, as: :article_name
has created_at
end
Also, I've updated the index syntax in the above example - the approach you were using above with symbols is quite old (perhaps from an old blog post somewhere?).
The difference between fields and attributes is discussed here in the documentation - https://freelancing-gods.com/thinking-sphinx/v4/sphinx_basics.html - though I know it's not an obvious distinction for anyone not familiar with Sphinx!
On execution of
giving following error: