0

On a successful search will one be able to access the sphinx indexed data instead of hitting the database.

Thinking Sphinx provides the a method to search and retrieve only the document ids through ThinkingSphinx.search_by_ids. Does it provide an API to retrieve only indexed data without hitting the database?

Phoenix
  • 192
  • 1
  • 8

1 Answers1

1

Not exactly all the indexed fields but you can take advantages of sql_attr_string

From the docs :

"String attributes can store arbitrary strings attached to every document. There's a fixed size limit of 4 MB per value.

Note that attributes declared using sql_attr_string will not be full-text indexed; you can use sql_field_string directive for that."

Hope this will help !


@Phoenix:

You can't use indexer as an alternative to database because original contents of the fields are not stored in the Sphinx index.

From the docs:

"Note that the original contents of the fields are not stored in the Sphinx index. The text that you send to Sphinx gets processed, and a full-text index (a special data structure that enables quick searches for a keyword) gets built from that text. But the original text contents are then simply discarded. Sphinx assumes that you store those contents elsewhere anyway."

You can refer doc for more details:

metalfight - user868766
  • 2,722
  • 1
  • 16
  • 20
  • If i've understand sql_attr_strings correctly,then it doesn't get indexed and its primary purpose is to provide a mechanism to refine the search results. But i'm interested in accessing the index itself. Since indexed data is the one search against, my question is why not use it instead of the data in the db. – Phoenix Oct 31 '12 at 11:05
  • @Phoenix : because the text is not stored as it is. – aditirex Oct 31 '12 at 12:20
  • @Phoenix I have added the details. – metalfight - user868766 Oct 31 '12 at 12:46