Thanks for your help we gonna implement this.

On Jun 8, 5:32 pm, Pat Allan <[email protected]> wrote:
> Well, I'd recommend having the same attributes defined in both indexes, and 
> it doesn't hurt to have the same fields too (and it sounds like that's how 
> you'll approach things anyway). There's no way to inherit from other indexes 
> yet, though...
>
> All you need to do is just have multiple define_index blocks in your model, 
> and give them explicit names (well, the first one doesn't need it, but 
> wouldn't hurt).
>
>   define_index 'articles_insensitive' do
>     # fields, attributes
>
>     set_property :charset_table => "0..9, A..Z->a..z, _, a..z, 
> U+410..U+42F->U+430..U+44F, U+430..U+44F"
>   end
>
>   define_index 'articles_sensitive' do
>     # fields, attributes
>
>     set_property :charset_table => "0..9, A..Z, _, a..z, 
> U+410..U+42F->U+430..U+44F, U+430..U+44F"
>   end
>
> The one trick to keep in mind is that TS will append _core to the end of 
> these index definitions (and create *_delta indexes as well, if you're using 
> deltas). So, searching becomes:
>   ThinkingSphinx.search 'foo', :indexes => ['articles_insensitive_core']
>
> Not entirely sure if Article.search will work as well, but definitely worth a 
> shot :)
>
> --
> Pat
>
> On 08/06/2010, at 11:37 PM, Marcel Overdijk wrote:
>
>
>
> > Great to hear multiple indexes are fully supported.
>
> > Do you if there is an example somewhere on the internet?
>
> > Is it also possible to define the charset_table per index?
>
> > The case insensitive index will need something like A-Z->a-z but the
> > case insensitive not.
>
> > On Jun 8, 1:32 pm, Pat Allan <[email protected]> wrote:
> >> Multiple indexes are supported, just not documented. You need to give all 
> >> indexes (except for the first) an explicit name:
>
> >>   define_index "foo" do
> >>     # ...
> >>   end
>
> >> And sorry, I misunderstood - for *searching* on case 
> >> sensitive/insensitive, multiple indexes is definitely the approach you'll 
> >> need to follow.
>
> >> --
> >> Pat
>
> >> On 08/06/2010, at 8:32 PM, Marcel Overdijk wrote:
>
> >>> Hi Pat,
>
> >>> I was thinking about using multiple indexes. 1 case insensitive (all
> >>> lower case chars) and 1 for case sensitive.
>
> >>> But I don't the status about defining multiple indexes in TS (it's not
> >>> in the docs at least).
> >>> And would it be possible then to define the charset_table per index?
>
> >>> I'm also not sure if the sort option works in our case. Let me
> >>> explain....
>
> >>> What we currently do is based on a defined sphinx query (q) check if
> >>> that query is valid for the given article.
> >>> We use this to autotag our article database.
>
> >>>  def matches?(q, article)
> >>>    return false if keywords.blank?
> >>>    results = Article.search(q, :with => { :article_id =>
> >>> article.id }, :match_mode => :extended)
> >>>    results.length > 0
> >>>  end
>
> >>> Now the problem is sometimes we want to explicitly search case
> >>> sensitive and sometimes case insensitive.
>
> >>> On Jun 7, 2:16 pm, Pat Allan <[email protected]> wrote:
> >>>> Hi Marcel
>
> >>>> In that kind of situation, :sortable on a field isn't going to do the 
> >>>> trick. What you'll need to do is create two attributes using SQL 
> >>>> snippets, something like the following:
>
> >>>>   has 'LOWER(table.column)', :as => :column_ci, :type => :string
> >>>>   has column, :as => :column_cs, :type => string
>
> >>>> And then sort by either :column_ci (case-insensitive) or :column_cs 
> >>>> (case-sensitive).
>
> >>>> Let us know how you go :)
>
> >>>> --
> >>>> Pat
>
> >>>> On 07/06/2010, at 10:01 PM, Marcel Overdijk wrote:
>
> >>>>> Hi Matt,
>
> >>>>> I have the same use case.
>
> >>>>> I want to be able to search both case sensitive and case insensitive
> >>>>> based on checkbox entered by the user.
> >>>>> Did you find any solution for this?
>
> >>>>> Regards,
> >>>>> Marcel
>
> >>>>> On May 15, 7:47 pm, Matt Margolis <[email protected]> wrote:
> >>>>>> I have a search form where I want to allow the user to choose between
> >>>>>> casesensitiveand case insensitive searching over several fields on a
> >>>>>> model.  Is there a clean way to achieve this flexibility with Sphinx/
> >>>>>> ThinkingSpinx?  I am new to Sphinx but it is my understanding that
> >>>>>> indexing is lowercased by default?
>
> >>>>>> Thank you,
> >>>>>> Matt Margolis
>
> >>>>>> --
> >>>>>> 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 
> >>>>>> athttp://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 
> >>>>> athttp://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 
> >>> athttp://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 
> > athttp://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.

Reply via email to