It it possible to highlight only matched part? For example return
ThinkingSphinx.search('pow').first.excerpts.last_name #=> "<span
class=\"match\">Pow</span>"
So NOT to match a whole word.
понедельник, 15 октября 2012 г., 15:10:07 UTC+4 пользователь Pat Allan
написал:
>
> You can change the excerpts highlight tags using something like this:
>
> Model.search 'foo',
> :excerpt_options => {:before_match => '<em>', :after_match => '</em>'}
>
> Just make those empty strings if you don't want any highlighting of
> matches at all.
>
> --
> Pat
>
> On 13/10/2012, at 10:28 AM, Taiwo wrote:
>
> > were u able to remove the span tags that show up when using excertps??
> >
> > Thanks
> >
> > taiwo
> >
> > On Wednesday, July 6, 2011 3:30:46 PM UTC-4, Sjors wrote:
> > Hi Pat,
> >
> > I wasn't using wildcards, because I want it to return partial matches
> > without the user typing "*" (especially with autocomplete). So I only
> > set:
> > :min_infix_len => 1
> >
> > After adding
> > :enable_star => 1
> > all search results have excerpts, so that's good.
> >
> > As a workaround, I can simply add "*" to all search queries in the
> > controller so the user doesn't have to type "*".
> >
> > Thanks,
> >
> > Sjors
> >
> > On 1 jul, 21:14, Pat Allan <[email protected]> wrote:
> > > Hi Sjors
> > >
> > > This is now possible in Sphinx - and should be fine with Thinking
> Sphinx provided you're using wildcards in your query. For example:
> > >
> > > ThinkingSphinx.search('pow*').first.last_name #=> "Power"
> > > ThinkingSphinx.search('pow*').first.excerpts.last_name #=> "<span
> class=\"match\">Power</span>"
> > >
> > > How are you using it where it's not working?
> > >
> > > --
> > > Pat
> > >
> > > On 01/07/2011, at 8:09 AM, Sjors wrote:
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > > I was wondering if this problem is still around or if I'm doing
> > > > something wrong. In 2009 Pat wrote [0] that you can't get excerpts
> on
> > > > partial matches, that this was due to a "bug" in Sphinx itself and
> > > > that this might get fixed in the near future.
> > >
> > > > I'm using the latest version of Sphinx from SVN and thinking-sphinx
> > > > 2.0.5. I can get excerpts on full word matches, but not on partial
> > > > word matches.
> > >
> > > > Cheers,
> > >
> > > > Sjors
> > >
> > > > [0]
> > > >
> http://groups.google.com/group/thinking-sphinx/browse_thread/thread/b...
> > >
> > > > --
> > > > 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 view this discussion on the web visit
> https://groups.google.com/d/msg/thinking-sphinx/-/ypImiQ5023wJ.
> > To post to this group, send email to
> > [email protected]<javascript:>
> .
> > To unsubscribe from this group, send email to
> [email protected] <javascript:>.
> > 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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.