If you want any articles that have the word ‘linux’ in their title (it is not
an exact match), then you do not need the asterisk.
So, Article.search :conditions => {:title => ‘linux’} will match articles with
these titles:
* Linux
* Linux Experts
* Linux for Beginners
* Advanced Linux Tips
* Learning Linux
The asterisk is if you want to match parts of words - if there were titles with
linuxes, then searching with linux* would return those articles (but you also
need enable_star set to true and min_infix_len or min_prefix_len set as well):
http://pat.github.io/thinking-sphinx/common_issues.html#wildcards
On 20 Mar 2014, at 11:23 pm, Jeremy Li <[email protected]> wrote:
> should i add asterisk " * " before and after "linux", like this:
>
> Article.search :conditions => {:title => ‘*linux*’}
>
> 在 2014年3月20日星期四UTC+8下午8时18分55秒,Pat Allan写道:
> This should work:
>
> Article.search :conditions => {:title => ‘linux’}
>
> On 20 Mar 2014, at 11:17 pm, Jeremy Li <[email protected]> wrote:
>
>> i want to get all of data contains "linux" in the field :title, i am not
>> sure is below works?
>>> Article.search "linux", :conditions => {:title => ‘*’}
>>
>> 在 2014年3月20日星期四UTC+8下午8时04分36秒,Pat Allan写道:
>> I’m sorry, I don’t understand your question. Can you please elaborate on
>> what you mean by “I just want to search data from a specific field”?
>>
>> On 20 Mar 2014, at 11:02 pm, Jeremy Li <[email protected]> wrote:
>>
>>> but i want to search a specific field without value('something'), i just
>>> want to search data from a specific field.
>>>
>>> 在 2014年3月20日星期四UTC+8下午7时21分44秒,Pat Allan写道:
>>> Hi Jeremy
>>>
>>> To search on a specific field, you can use the :conditions option:
>>>
>>> Article.search :conditions => {:title => ‘something’}
>>>
>>> http://pat.github.io/thinking-sphinx/searching.html#conditions
>>>
>>> Cheers
>>>
>>> —
>>> Pat
>>>
>>> On 20 Mar 2014, at 10:14 pm, Jeremy Li <[email protected]> wrote:
>>>
>>>> I create two index(:title, :content) in a model Article, and if i want to
>>>> search data only in the :title index, how to do that?
>>>>
>>>> --
>>>> 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.
>>>
>>>
>>> --
>>> 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.
>>
>>
>> --
>> 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.
>
>
> --
> 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.
--
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.