Hi Surya
I'm pretty certain Sphinx doesn't support regular expression matching - and I
don't know any way to make exact matches take priority over partial matches
(you're not the first to ask for this).
So, in short: I'm not much help, sorry.
--
Pat
On 22/06/2010, at 12:43 AM, surya wrote:
> Hi all
> I am a RoR developer, and I need your help to solve a issue in
> Thinking Sphinx.
>
> I have following indexes in method define_index in product table.
> indexes [la, tl], :as => :main_title
> indexes "CONCAT_WS(' ',REPLACE(la,'-',' '),REPLACE(tl,'-','
> '),REPLACE(st,'-',' '))", :as => :whole_title
> indexes isbn13, cns2, cns3, bic2sc1, bic2sc2, bic2sc3, bic2sc4,
> bic2sc5, bic2st1, rare_pubpd#bic2st1 and rare_pubpd required for rare
> books
> indexes cns1, :as => :cns1, :sortable => :true
> indexes product_category.slug, :as => :product_category_slug
>
>
> now say I have few records in table as described here:
> id la , tl
> 1) "", "Johann Heinrich Voss Uber Des Virgilischen Landgedichts Ton
> Und Auslegung (1791)"
> 2) "", "Johann Heinrich Voss Uber Des Virgilischen Landgedichts Ton
> Und Auslegung (1791)"
> 3) "", "Briefwechsel Zwischen Heinrich Voss Und Jean Paul"
> 4) "", "Briefwechsel Zwischen Heinrich Voss Und Jean Paul"
> 5) "", "Voss"
> 6) "", "Talking Football : the 1997 Club 10 Afl Diaries of Wayne
> Carey, Glen Jakovich, Tony Lockett, Michael Voss and Gavin Wanganeen"
>
>
> And I do query in console
>>> Product.search('@main_title ^voss$', :match_mode => :extended2).first
> or
>>> Product.search('@(main_title,whole_title) ^voss$', :match_mode =>
>>> :extended2).first
> or
>>> Product.search('@main_title ^voss$', :match_mode => :extended2).first
> or
>>> Product.search('@(main_title,whole_title) ^voss$|voss', :match_mode =>
>>> :extended2).first
>
> nothing is getting me the 5th record as a output. Infact ^voss$ should
> match only one record but I get multiple records as output.
>
>
> What I want is : Exact matched record should come first followed by
> other records, which are not exactly matching title, but have the word
> 'voss' somewhere in the title (i.e either in main_title or
> whole_title).
>
> Thanks in advance.
>
> Surya.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/thinking-sphinx?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.