Hi David

If you want to query across two indexes, just do a standard search:

  Library.search 'New York'

The :index option will filter on a specific index (multiple ones can be defined 
in a string, comma-separated).

However, you cannot direct part of a query at a specific index (ie: New York on 
your core index, Ne on the prefixed one), all at once. The two queries you've 
specified below should work, though, if you're doing them separately. The only 
catch is that you may need enable_star set to true and then for the second, use 
stars/wildcards:

  Library.search 'Ne*', :index => 'prefixed_library'

I've not done any thorough testing on whether wildcards are needed to force the 
prefix/infix matching. Hopefully it's not required, but I've vague memories of 
it not working for some people.

Hope this is helpful.

-- 
Pat

On 31/12/2009, at 3:35 PM, David Aronchick wrote:

> Ok, so far got past the original blocking issue - but now the issue
> seems to be specifying the indexing to use ... based on these two
> definitions, how do I execute:
> 
> Library.search('New York')
> Library.search('Ne', :index => 'prefixed_libray')
> 
> ?
> 
> On Dec 30, 4:54 pm, Pat Allan <[email protected]> wrote:
>> Hi David
>> 
>> The multiple index support isn't really documented at all... but what you'll 
>> need to do is give any additional indexes an explicit name, to avoid 
>> collisions:
>> 
>>   define_index do
>>     # default
>>   end
>> 
>>   define_index 'prefixed_library' do
>>     # additional
>>   end
>> 
>> Hopefully this gets it working.
>> 
>> --
>> Pat
>> 
>> On 31/12/2009, at 6:38 AM, David Aronchick wrote:
>> 
>>> Ok, i've upgraded, and now I've added the two index names (index_name
>>> 'prefix index') to the define_index statements... here's the response:
>> 
>>> ERROR: section 'library_core_0' (type='source') already exists [...]
>> 
>>> On Dec 29, 4:24 pm, Pat Allan <[email protected]> wrote:
>>>> Hi David
>> 
>>>> If there's no ts:version task, then I think you're using a really old 
>>>> version of TS. It's definitely worth trying to upgrade, see if that helps 
>>>> matters.
>> 
>>>> --
>>>> Pat
>> 
>>>> On 30/12/2009, at 5:14 AM, David Aronchick wrote:
>> 
>>>>> Hi--
>> 
>>>>> In truth, I'm not sure - the gemspec says 0.9.9, but rake ts:version
>>>>> fails (Don't know how to build task 'thinking_sphinx:version').
>> 
>>>>> The rest of my define index is very standard:
>> 
>>>>> define_index do
>>>>>   #indexed fields, fields to be added to the full text index
>>>>>   indexes :name, :sortable => true
>>>>>   indexes aliases(:alias), :as => :aliases
>> 
>>>>>   #attributes (fields to be sorted by, or grouped by)
>>>>>   has [field names], :as => [aliases] x 20
>> 
>>>>>   set_property :min_prefix_len => 1
>> 
>>>>>   #used to determine if the index has been rebuilt recently
>>>>>   has "UNIX_TIMESTAMP()", :as => :index_time
>>>>> end
>> 
>>>>> On Dec 28, 8:38 pm, Pat Allan <[email protected]> wrote:
>>>>>> Hi David
>> 
>>>>>> What version of TS are you currently using? 1.3.6 was when multiple 
>>>>>> index support was added, but I'd recommend using the latest (1.3.14). 
>>>>>> Also, what's the full contents of your define_index block?
>> 
>>>>>> --
>>>>>> Pat
>> 
>>>>>> On 29/12/2009, at 3:18 PM, David Aronchick wrote:
>> 
>>>>>>> I've been trying to get Thinking Sphinx for Ruby to handle prefixes
>>>>>>> and/or star, and every time i generate a new configuration file, it
>>>>>>> seems to ignore it.
>> 
>>>>>>> Here's the line I added:
>> 
>>>>>>> define_index do
>>>>>>>   [... Stuff ...]
>>>>>>>   set_property :min_prefix_len => 1
>>>>>>> end
>> 
>>>>>>> And then I run:
>> 
>>>>>>> rake ts:config
>>>>>>> rake ts:in
>>>>>>> rake ts:run
>> 
>>>>>>> And nothing new. I keep checking the config file, and it never changes
>>>>>>> due to this. I even manually go in and change the file, and then in is
>>>>>>> replaced with a file without anything relating to min_prefix. Any
>>>>>>> thoughts?
>> 
>>>>>>> -----
>> 
>>>>>>> As an aside, what version of thinking sphinx now allows multiple
>>>>>>> indexes against a single table? I'd like to have one index with
>>>>>>> min_prefix_len on, and one without.
>> 
>>>>>>> --
>> 
>>>>>>> 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.
> 
> 

--

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