Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to extract unmatched keywords, thinking sphinx
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
senthil kumar  
View profile  
 More options May 4 2012, 7:32 am
From: senthil kumar <senthilkumar....@gmail.com>
Date: Fri, 4 May 2012 04:32:14 -0700 (PDT)
Local: Fri, May 4 2012 7:32 am
Subject: How to extract unmatched keywords, thinking sphinx
Im using thinking sphinx in my rails 3 app.

I have used sphinx indexing on 2 tables in my products catalog app.
namely,

"titles" and "features"

For every search_key, I will check the titles table first and if no
results found,
I will goto features table. If a title match is found I will stop and
i will not goto features table.

Example: search keyword is "head and dust  hachette book publishing",

Here, "heat and dust" has an exact match in titles so im not going to
the features table.

Question:

How to find the unmatched_keys for a search in sphinx..?

I want to find out the unmatched words in the search key i.e.
"hachette book publishing" in "head and dust  hachette book
publishing"..

If I get that, I will check if @unmatched_title_keys is nil?.. if
not.. I will goto features table and perform a feature search for
@unmatched_title_keys.

Please advice if this approach for searching 2 tables is good or I
should alter my search approach and tell me how to retrieve
unmatched_keys from a sphinx search query...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
senthil kumar  
View profile  
 More options May 7 2012, 2:54 am
From: senthil kumar <senthilkumar....@gmail.com>
Date: Sun, 6 May 2012 23:54:05 -0700 (PDT)
Local: Mon, May 7 2012 2:54 am
Subject: Re: How to extract unmatched keywords, thinking sphinx
No reply yet????

On May 4, 4:32 pm, senthil kumar <senthilkumar....@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pat Allan  
View profile  
 More options May 7 2012, 9:21 pm
From: "Pat Allan" <p...@freelancing-gods.com>
Date: Mon, 07 May 2012 21:21:39 -0400
Local: Mon, May 7 2012 9:21 pm
Subject: Re: [ts] How to extract unmatched keywords, thinking sphinx
Hi Senthil

Have a look at the raw Sphinx results for your query, that may provide the information you're after. You can access it like so:

  Model.search('query').results

That will have information on which terms matched a certain number of documents.

--
Pat

On 04/05/2012, at 9:32 PM, senthil kumar wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
senthil kumar  
View profile  
 More options May 8 2012, 10:02 am
From: senthil kumar <senthilkumar....@gmail.com>
Date: Tue, 8 May 2012 07:02:10 -0700 (PDT)
Local: Tues, May 8 2012 10:02 am
Subject: Re: How to extract unmatched keywords, thinking sphinx
Hi Pat,

Thanks for your reply. This is what I have done.

word_count is the number of words in a document excluding stopwords
generated by a mysql function.

with_filter = "*, IF( @weight >=  word_count,1,0) AS filter"

 sphinx_result = ProductsFilterCollections.search('"heat and dust
hachette book publishing"/1', :match_mode => :extended, :rank_mode
=> :wordcount, :sphinx_select => with_filter, :with => {'filter' =>
1})

 sphinx_result.results value is
{:matches=>[{:doc=>139, :weight=>2, :index=>0, :attributes=>{"sphinx_internal_id"=>46,
"sphinx_deleted"=>0, "class_crc"=>2200458759,
"sphinx_internal_class"=>"ProductsFilterCollections",
"sub_category_id"=>1, "word_count"=>2, "filter"=>1}},
{:doc=>232, :weight=>2, :index=>1, :attributes=>{"sphinx_internal_id"=>77,
"sphinx_deleted"=>0, "class_crc"=>2200458759,
"sphinx_internal_class"=>"ProductsFilterCollections",
"sub_category_id"=>1, "word_count"=>2,
"filter"=>1}}], :fields=>["filter_key"], :attributes=>{"sphinx_internal_id"=>1,
"sphinx_deleted"=>1, "class_crc"=>1, "sphinx_internal_class"=>7,
"sub_category_id"=>1, "word_count"=>1,
"filter"=>1}, :attribute_names=>["sphinx_internal_id",
"sphinx_deleted", "class_crc", "sphinx_internal_class",
"sub_category_id", "word_count",
"filter"], :words=>{"heat"=>{:docs=>2, :hits=>2},
"dust"=>{:docs=>2, :hits=>2},
"hachette"=>{:docs=>0, :hits=>0}}, :status=>0, :total=>2, :total_found=>2, :time=>0.001}

 @unmatched_keywords = [ ]

 sphinx_result.results[:words].keys.each do |i|
    if sphinx_result.results[:words][i][:hits] == 0
      @unmatched_keywords << i
    end
 end

Now the value of @unmatched_keywords is ["hachette", "book",
"publishing"].

I get what I want.

Kindly validate.

Thanks,
Senthil.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pat Allan  
View profile  
 More options May 8 2012, 12:00 pm
From: Pat Allan <p...@freelancing-gods.com>
Date: Wed, 9 May 2012 02:00:19 +1000
Local: Tues, May 8 2012 12:00 pm
Subject: Re: Re: [ts] How to extract unmatched keywords, thinking sphinx
That's what I was thinking too, good to see you've got it figured out.

Cheers

--
Pat

On 09/05/2012, at 12:02 AM, senthil kumar wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
senthil kumar  
View profile  
 More options May 8 2012, 1:05 pm
From: senthil kumar <senthilkumar....@gmail.com>
Date: Tue, 8 May 2012 10:05:22 -0700 (PDT)
Local: Tues, May 8 2012 1:05 pm
Subject: Re: How to extract unmatched keywords, thinking sphinx
Thanks man. Good to get approved by you.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »