Is it possible to use the sphinx query language to actively search for
"@owner_name" that is the empty string? I could not find anything like
this in the sphinx docs.

The goal for my current project is to have a single search box and
allow the end user to specify all their searches in a single string,
much the same way as you search your gmail account ("in:inbox
has:attachment subject: blue fishes"). Possibly the best solution is
the one above as the user can search "owned_by: nobody".

One concern is that I am using "users.first_name" and
"users.last_name", users is the table I am joining to for both owner
and creator, this seems fragile as my sql_query in my sphinx config
has this:

LEFT OUTER JOIN `users` ON `users`.id = `tickets`.owner_id   LEFT
OUTER JOIN `users` creators_tickets ON `creators_tickets`.id =
`tickets`.creator_id

I the alias only happens for the second reference to the users
table...

I noticed the other sphinx rails plugin has a built in parser to
convert the "Google style" searches to sphinx style searches, does
anyone else think this will be a good addition to TS?

On Sep 8, 3:26 pm, Pat Allan <[email protected]> wrote:
> Nope, for fields that's as good as it gets, unfortunately. NULLs  
> become empty strings by default.
>
> --
> Pat
>
> On 08/09/2009, at 4:11 PM, Greg wrote:
>
>
>
> > One way to get what I want:
>
> > define_index do
> >  indexes title
> >   ...
> >  indexes "IF(ISNULL(owner_id),'nobody',concat_ws(' ',
> > users.first_name, users.last_name))", :as => :owner_or_nil
> > end
>
> > But this seems very nasty, is there a more elegant approach?
>
> > On Sep 8, 12:18 pm, Greg <[email protected]> wrote:
> >> Is it possible to search for all fields that have a null value?
>
> >> eg:
>
> >> define_index do
> >>     indexes title
> >>     ...
> >>     indexes [owner(:first_name), owner(:last_name)], :as
> >> => :owner_name
>
> >>     set_property :delta => true
> >>   end
>
> >> I can search like "@owner_name John Doe" and get all items owned by
> >> John Doe, but I also need to have a search that returns all unowned
> >> items, eg "@owner_name nil" is this possible?
>
> >> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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