Comments on: Sphinx Client API for Ruby https://kpumuk.info In my blog I'll try to describe about interesting technologies, my discovery in IT and some useful things about programming. Tue, 08 Sep 2015 00:51:11 +0000 hourly 1 https://wordpress.org/?v=5.2.4 By: Indexing with Sphinx Search :Prabode Weebadde https://kpumuk.info/projects/ror-plugins/sphinx/comment-page-1/#comment-284459 Thu, 05 Nov 2009 19:24:38 +0000 http://kpumuk.info/projects/ror-plugins/sphinx/#comment-284459 […] ruby/rails plugin rather than trying to reinvent the wheel. I found two plugins; acts_as_sphinx and Sphinx Client API for Ruby (SCAFR). They are both very similar except acts_as_sphinx has act methods to load models from the […]

]]>
By: Xavi https://kpumuk.info/projects/ror-plugins/sphinx/comment-page-1/#comment-271469 Mon, 16 Feb 2009 08:35:16 +0000 http://kpumuk.info/projects/ror-plugins/sphinx/#comment-271469 I’ve tried to download the 0.4 version of the client API as seen in http://kpumuk.info/ror-plugins/sphinx-client-api-0-3-1-and-0-4-0-r909-for-sphinx-0-9-8-r909-released/, where says “go to project page” (here). Always downloads 0.3.1 version. Can you please guide me to the latest version, please?

]]>
By: Ochronus onLine » Handling a huge amount of fulltext searches part 2 - the internals https://kpumuk.info/projects/ror-plugins/sphinx/comment-page-1/#comment-230601 Fri, 15 Aug 2008 07:48:36 +0000 http://kpumuk.info/projects/ror-plugins/sphinx/#comment-230601 […] and stuff: a good ruby sphinx api – try this. You’ll also need a decent memcache api in ruby – go for the creators’ recommendation, […]

]]>
By: Handling a huge amount of fulltext searches | ochronus onLine https://kpumuk.info/projects/ror-plugins/sphinx/comment-page-1/#comment-219127 Thu, 03 Jul 2008 19:14:27 +0000 http://kpumuk.info/projects/ror-plugins/sphinx/#comment-219127 […] your users’ searches, sphinx and memcache. Spice and stuff: a good ruby sphinx api – try this. You’ll also need a decent memcache api in ruby – go for the creators’ recommendation, […]

]]>
By: COTOHA https://kpumuk.info/projects/ror-plugins/sphinx/comment-page-1/#comment-212467 Mon, 09 Jun 2008 18:36:50 +0000 http://kpumuk.info/projects/ror-plugins/sphinx/#comment-212467 забавый баг на стыке CodeColorer’а и Google Reader’а:

текст внутри колореровского контейнера “тянется” под следующие посты в ридере… с чего бы это?

]]>
By: Leonid S. Pavlov https://kpumuk.info/projects/ror-plugins/sphinx/comment-page-1/#comment-212059 Sat, 07 Jun 2008 11:52:27 +0000 http://kpumuk.info/projects/ror-plugins/sphinx/#comment-212059 Hi!

This is my port of BuildKeywords Sphinx function from sphinxapi.php. Maybe you find it interesting and include it in future versions of your plugin.

—-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# = sphinx_ex.rb - extend Sphinx Client API by Dmytro Shteflyuk
#
# Author::    Leonid S. Pavlov <mailto:leonid.pavlov at gmail dot com>.
# Copyright:: Copyright (c) 2008 Leonid S. Pavlov
# License::   Distributes under the same terms as Ruby


module Sphinx
  class Client

    SEARCHD_COMMAND_KEYWORDS = 3
    VER_COMMAND_KEYWORDS = 0x100
   
    # Keywords generation
    #
    # Connect to searchd server, and generate keyword list for a given query.
    #
    # * <tt>query</tt> is query string
    # * <tt>index</tt> is index name (or names) to query
    # * <tt>hits</tt> is the bool flag for counting words hits in indexed documents
    #
    # Returns an array of words on success.
    # Returns false on failure.
    #
    # Usage example:
    #    sphinx.BuildKeywords('test1', '*', true)
    #
    def BuildKeywords(query, index, hits)
      assert { query.instance_of? String }
      assert { index.instance_of? String }
      assert { hits.instance_of?(TrueClass) || hits.instance_of?(FalseClass) }

      sock = self.Connect

      # build request
      request = Request.new         # v.1.0 req  
      request.put_string query      # req query
      request.put_string index      # req index
      request.put_int hits ? 1 : 0  # req hits

      # send query, get response
      len = request.to_s.length
      request = [SEARCHD_COMMAND_KEYWORDS, VER_COMMAND_KEYWORDS, len].pack('nnN') + request.to_s     # add header
      sock.send(request, 0)    
      response = GetResponse(sock, VER_COMMAND_KEYWORDS)

      # parse response
      pos = 0
      res = []
      rlen = response.length
      nwords = response[pos, 4].unpack('N*').first
      pos += 4

      for i in 0...nwords do
        len = response[pos, 4].unpack('N*').first; pos += 4
        tokenized = response[pos, len]
        pos += len;

        len = response[pos, 4].unpack('N*').first; pos += 4
        normalized = response[pos, len]
        pos += len;

        res << { 'tokenized' => tokenized, 'normalized' => normalized }

        if (hits)
          ndocs, nhits = response[pos, 8].unpack('N*N*')
          pos += 8
          res[i].merge!('docs' => ndocs, 'hits' => nhits)
        end

        if pos > rlen
          @error = 'incomplete reply'
          raise SphinxResponseError, @error
        end
      end

      return res
    end

  end
end
]]>
By: Prabode https://kpumuk.info/projects/ror-plugins/sphinx/comment-page-1/#comment-205819 Tue, 20 May 2008 03:33:10 +0000 http://kpumuk.info/projects/ror-plugins/sphinx/#comment-205819 Wanted to let you know I used your API with some refactoring in my project. Pls see my post for more information at http://www.weebadde.com/?p=8. I am happy contribute the refactored code.

]]>
By: Weebadde, Chandana Prabode » Blog Archive » Indexing with Sphinx https://kpumuk.info/projects/ror-plugins/sphinx/comment-page-1/#comment-205816 Tue, 20 May 2008 03:30:52 +0000 http://kpumuk.info/projects/ror-plugins/sphinx/#comment-205816 […] ruby/rails plugin rather than trying to reinvent the wheel. I found two plugins; acts_as_sphinx and Sphinx Client API for Ruby (SCAFR). They are both very similar except acts_as_sphinx has act methods to load models from the […]

]]>
By: Sphinx Client API 0.3.1 and 0.4.0 r909 for Sphinx 0.9.8 r909 released || Dmytro Shteflyuk’s Home https://kpumuk.info/projects/ror-plugins/sphinx/comment-page-1/#comment-129281 Sun, 09 Dec 2007 18:33:15 +0000 http://kpumuk.info/projects/ror-plugins/sphinx/#comment-129281 […] I have a good news: Sphinx Client API has been updated and now it supports all brand new features of the unstable Sphinx 0.9.8 development snapshot. What does it mean for you as a developer? What features you will get if you would decide to switch to the new version? I will describe most valuable improvements of the Sphinx in this article, and will show how to use them with new Sphinx Client API 0.4.0 r909. […]

]]>
By: Morning Brew #61 https://kpumuk.info/projects/ror-plugins/sphinx/comment-page-1/#comment-86460 Tue, 14 Aug 2007 15:27:56 +0000 http://kpumuk.info/projects/ror-plugins/sphinx/#comment-86460 […] – Rails wrapper for Ruby API for Sphinx, a full-text search […]

]]>