Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Recently I've been using Sphinx extensively, and since the death of UltraSphinx, I started using Pat's great plugin (Thanks Pat, I'll buy you a coffee in Melbourne soon!)</p> <p>I see a possible solution based on your original idea, but you need to make changes to the data at "index time" not "run time". </p> <p><strong>Try this:</strong></p> <ol> <li><p>Modify your Sphinx SQL query to replace "Blue" with "Blue Blue Blue Blue", "Recent" with "Recent Recent Recent" and "Fun" with "Fun Fun". This will magnify any occurrences of your <em>special</em> keywords.</p> <p><em>e.g. SELECT REPLACE(my_text_col,"blue","blue blue blue") as my_text_col ...</em></p> <p>You probably want to do them all at once, so just nest the replace calls.</p> <p><em>e.g. SELECT REPLACE(REPLACE(my_text_col,"fun","fun fun"),"blue","blue blue blue") as my_text_col ...</em></p></li> <li><p>Next, change your ranking mode to SPH_RANK_WORDCOUNT. This way maximum relevancy is given to the frequency of the keywords.</p></li> <li><p>(Optional) Imagine you have a list of keywords related to your <em>special keywords</em>. For example <strong>"pale blue" relates to "blue"</strong> and <strong>"pleasant" relates to "fun"</strong>. At run time, rewrite the query text to look for the target word instead. You can store these words easily in a hash, and then loop through it to make the replacements.</p></li> </ol> <pre><code># Add trigger words as the key, # and the related special keyword as the value trigger_words = {} trigger_words['pale blue'] = 'blue' trigger_words['pleasant'] = 'fun' # Now loop through each query term and see if it should be replaced new_query = "" query.split.each do |word| word = trigger_words[word] if trigger_words.has_key?(word) new_query = new_query + ' ' word end </code></pre> <p>Now you have quasi-keyword-clustering too. Sphinx is really a fantastic technology, enjoy!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload