Wait… that query's still not quite right. :conditions is for field queries, and
:with is for attribute filters - but you've got the latter and other options
within :conditions. Try the following instead:
Item.search params[:search],
:with => {:business_id => @businessid, :active => 1},
:star => true,
:field_weights => {:itemname => 20, :description => 10, :catone => 5,
:cattwo => 5, :catthree => 5},
:page => params[:page],
:per_page => 10
--
Pat
On 10/01/2012, at 3:01 PM, maximulus wrote:
> Hi Pat,
>
> I managed to fix the delta part. I left thinking_sphinx.remote_sphinx
> on in my production.rb (thought I had hashed it out). Sorry :-S But as
> a side not I find when I use define_indexes as oppose to define index
> I get an error.
>
> As for fuzzy:
> I just managed to fix that too. It appears for what ever reason, the
> query must be formed this way.
>
> @items = Item.search
> params[:search], :star=>true, :conditions=> {:business_id=>
> @businessid, :active=>1,
> :field_weights => {:itemname => 20, :description =>
> 10, :catone => 5, :cattwo => 5, :catthree => 5}
> }, :page=>params[:page], :per_page=>10
>
> To be honest, I have no idea why. This works on my development
> machine, same Rails version, same sphinx version, same thinking sphinx
> version and same yml. Must be something with passenger/webbrick
> difference. Anyway, thank you so much for your time. I have been
> working on this for almost a week. Great gem.
>
>
>
> On Jan 9, 10:28 pm, "Pat Allan" <[email protected]> wrote:
>> Yeah, the delta indexing output looks fine - also, it's define_indexes, not
>> define_index, to ensure indices are loaded.
>>
>> As for the fuzzy searching on production, can you confirm that the
>> enable_star and min_infix_len settings are set in the generated Sphinx
>> configuration file? And :star should be true, not 1, though I'd be surprised
>> if that changed anything (1 is still true-ish).
>>
>> --
>> Pat
>>
>> On 10/01/2012, at 2:22 PM, maximulus wrote:
>>
>>
>>
>>
>>
>>
>>
>>> I am using script/console production and then
>>
>>> Item.define_index && Item.index_delta; 'lentils'
>>
>>> I get this:
>>
>>> using config file
>>> '/home/webuser/rails_apps/project/current/config/
>>> production.sphinx.conf'...
>>> indexing index 'item_delta'...
>>> collected 0 docs, 0.0 MB
>>> collected 0 attr values
>>> sorted 0.0 Mvalues, nan% done
>>> total 0 docs, 0 bytes
>>> total 0.006 sec, 0 bytes/sec, 0.00 docs/sec
>>> total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
>>> total 4 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
>>> rotating indices: succesfully sent SIGHUP to searchd (pid=3462).
>>> => "lentils"
>>
>>> I have to be honest, I think that is what I should get but I am not
>>> certain.
>>
>>> However, when I do the test for fuzzy, I DO get all the
>>> results I should on the test with
>>> Item.search('pistachio', :star => 1) from console.
>>
>>> Here is my query from the controller
>>
>>> @items = Item.search params[:search], :conditions=>
>>> {:active=>1, :star=>1,
>>> :field_weights => {:itemname => 20, :description => 10}
>>> }, :page=>params[:page], :per_page=>10
>>
>>> Do you see anything here? Is the 'star' not reading as 1 perhaps?
>>
>>> Thanks for all your help. I am running out of ideas.
>>
>>> Ari
>>
>>> On Jan 9, 7:24 pm, "Pat Allan" <[email protected]> wrote:
>>>> Hmm, nothing out of the ordinary there. How are you testing fuzzy
>>>> searching? And deltas?
>>
>>>> --
>>>> Pat
>>
>>>> On 10/01/2012, at 12:41 AM, maximulus wrote:
>>
>>>>> Sure thanks Pat.
>>
>>>>> Just to update, I did a full reinstall of sphinx and thinking sphinx,
>>>>> as I had originally installed sphinx with the yum package manager,
>>>>> which installed sphinx from root and then I manually changed the
>>>>> ownership. I reinstalled from source (using wget) through the web
>>>>> user, which is why searched is now in /usr/local/bin' as oppose to usr/
>>>>> bin in the original question.
>>
>>>>> Was shocked to find I still have the same problem.
>>
>>>>> Here is what is in the sphinx.yml file
>>>>> production:
>>>>> port: 3312
>>>>> bin_path: '/usr/local/bin'
>>>>> address: 127.0.0.1
>>>>> mem_limit: 512M
>>>>> max_children: 300
>>>>> max_matches: 100000
>>>>> seamless_rotate: 1
>>>>> preopen_indexes: 1
>>>>> enable_star: true
>>>>> morphology: stem_en
>>>>> min_infix_len: 3
>>>>> query_log_file: "/home/webuser/rails_apps/project/current/log/
>>>>> searchd.query.log"
>>>>> searchd_log_file: "/home/webuser/rails_apps/project/current/log/
>>>>> searchd.log"
>>>>> pid_file: "/home/webuser/rails_apps/project/shared/pids"
>>>>> searchd_file_path: "/home/webuser/rails_apps/project/current/db/
>>>>> sphinx"
>>
>>>>> On Jan 9, 6:24 am, "Pat Allan" <[email protected]> wrote:
>>>>>> Can you share the contents of your config/sphinx.yml file?
>>
>>>>>> --
>>>>>> Pat
>>
>>>>>> On 08/01/2012, at 11:37 AM, maximulus wrote:
>>
>>>>>>> Hello,
>>
>>>>>>> I am using Rails 2.3.12
>>
>>>>>>> All settings are the same for development and production server except
>>>>>>> the os: Leopard/Centos and WEBBrick/Nginx-Passenger
>>
>>>>>>> I am using thinking-sphinx-0.9.9 gem version 1.3.2
>>
>>>>>>> I am using sphinx 0.9.9 R2117
>>
>>>>>>> Permissions to web user have been granted to all thinking sphinx files
>>>>>>> and searchd.
>>>>>>> I Rake with RAILS_ENV=production in production mode, that is the only
>>>>>>> difference I can find.
>>>>>>> Path is set to where searchd is, in usr/bin.
>>>>>>> I can see no errors in the production.log, or the nginx error log.
>>
>>>>>>> I am in fact using the same database, so when I make a change to say,
>>>>>>> an item name, it works in development but not production. Also fuzzy
>>>>>>> search works only in development. Rake ts:index works fine in both.
>>
>>>>>>> Are there any other tests I can run, or have I overlooked anything?
>>
>>>>>>> Thank you in advance,
>>>>>>> Max
>>
>>>>>>> --
>>>>>>> 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.