Search code examples
indexingsphinx

Sphinx Search: get list of words from index by source column


I have a table(let's call it my_table) with two text fields: title and description. Also I have an index(my_index) that uses next source-query:

SELECT * FROM my_table;

When I need to get all words and frequencies from my_index I use something like:

$indexer my_index --buildstops word_freq.txt 1000 --buildfreqs

But now, I need to get words that are presented only in column title(and their frequencies only from title column). What is the best solution to do this?

Edit: It will be perfect, if solution won't build new indexes on disk space.


Solution

  • Create a new "index", that only includes the title column. No need to ever build an physical index with it, can just use it with --buildstops :)

    Index inheritence, allows its creation with very compact bit in the config file

    source my_index_title : my_index {
       sql_query = SELECT id,title from my_table
    }
    index my_index_title : my_index {
       source = my_index_title
       path = /tmp/my_index_title
    }