On 6/1/06, ferret user <[EMAIL PROTECTED]> wrote:
> i just want search a substring
> like : search 'te' in 'ddte fssfsf'
> but i cannot find a better way~
> thanks
If you just want to have the ability to search for different
substrings like this then WildQuery is your best option for now. Are
you on Windows? If you are then it'll be a lot faster when I finally
get the extension compiled for Windows. If you are already using the C
extension then the speed you see will probably be the best you can
get. If you are running this query a lot you have a couple of options.
For shorter strings such as titles and names you could right a custom
Analyzer which will break up a term like this;
fastest search -> (fastest astest stest test est) (search earch arch rch)
where the brackets represent one term position. Now you can do test*
instead of *test* or ear* instead of *ear*. In the example I stopped
at strings of length 3 but you can keep going if you want to search
for *t*.
This will make the index considerable larger so if you are searching
really large strings then you should probably read up about Suffix
Arrays.
Cheers,
Dave
PS: look at lib/ferret/analysis/analyzers.rb to see how to implement a
custom analyzer.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk