I am using Sphinx 0.9.8.1-release (r1533).
I did not have a sphinx.yml file, but I do now with these contents:
development:
enable_star: 1
min_prefix_len: 2
I have this index defined in my model demographic.rb:
define_index do
# fields
indexes [first_name,middle_name,last_name], :as => :name
indexes last_name
# attributes
has created_at
end
In my development.sphinx.conf file, it generates this block for
demographic:
source demographic_0_core
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = PASSWORD REDACTED
sql_db = main_development
sql_sock = /tmp/mysql.sock
sql_query_pre = SET NAMES utf8
sql_query_pre =
sql_query = SELECT `demographics`.`id` * 3 + 0 AS `id` , CAST
(CONCAT_WS(' ', `demographics`.`first_name`,
`demographics`.`middle_name`, `demographics`.`last_name`) AS CHAR) AS
`name`, CAST(`demographics`.`last_name` AS CHAR) AS `last_name`,
UNIX_TIMESTAMP(`demographics`.`created_at`) AS `created_at`,
`demographics`.`id` AS `sphinx_internal_id`, 2146015749 AS
`class_crc`, '2146015749' AS `subclass_crcs`, 0 AS `sphinx_deleted`
FROM demographics WHERE `demographics`.`id` >= $start AND
`demographics`.`id` <= $end GROUP BY `demographics`.`id` ORDER BY
NULL
sql_query_range = SELECT MIN(`id`), MAX(`id`) FROM `demographics`
sql_query_info = SELECT * FROM `demographics` WHERE `id` = (($id -
0) / 3)
sql_attr_timestamp = created_at
sql_attr_uint = sphinx_internal_id
sql_attr_uint = class_crc
sql_attr_multi = uint subclass_crcs from field
sql_attr_uint = sphinx_deleted
}
index demographic_core
{
source = demographic_0_core
path = /main/db/sphinx/development/demographic_core
min_prefix_len = 2
charset_type = utf-8
enable_star = 1
morphology = stem_en
}
index demographic
{
type = distributed
local = demographic_core
}
Executing the rake index task gives this:
indexing index 'demographic_core'...
collected 50 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.0 Mhits, 96.8% done
total 50 docs, 855 bytes
total 0.010 sec, 85500.00 bytes/sec, 5000.00 docs/sec
distributed index 'demographic' can not be directly indexed; skipping.
Loading up the console, I try this query:
Loading development environment (Rails 2.2.0)
>> Demographic.search("P*")
=> []
In the log, I see this:
Sphinx: P*
Sphinx Result: []
And this one:
>> Demographic.search(:conditions => {:last_name => "P*"})
=> []
In the log, I see this:
Sphinx: @last_name P*
Sphinx Result: []
However, this SQL query "SELECT `last_name` FROM `demographics` WHERE
`last_name` LIKE 'P%'" returns three results
PATTERSON
PUENTE
PENKA
Thanks.
On Jan 7, 9:30 am, Pat Allan <[email protected]> wrote:
> Also, what's the contents of your sphinx.yml file?
>
> --
> Pat
>
> On 07/01/2009, at 9:29 PM, Pat Allan wrote:
>
>
>
> > Hi Patrick
>
> > Have you updated Sphinx to 0.9.9? Or are you just using the latest
> > Thinking Sphinx?
>
> > Cheers
>
> > --
> > Pat
>
> > On 07/01/2009, at 8:59 PM, Patrick wrote:
>
> >> Is there anything different in the new version of Sphinx or Thinking
> >> Sphinx that would cause issues with wildcard searches? We’re using an
> >> older version of the plugin on one site and it does wildcard searches
> >> perfectly fine (i.e. searching for “P” returns “Patrick”, “Parker”,
> >> etc.) but when the latest version is installed on a brand new MacBook
> >> Pro, it returns no results.
>
> >> I've built the index with the star related config values set to no
> >> avail.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---