#!/usr/bin/ruby
require './mnogo.so'
#require 'mnogo'

mnogo = Mnogo.new('mysql://root:@localhost/mnogosearch/?dbmode=single','single')
# print "Ver: ",mnogo.version,"\n"

#mnogo.set_param(Mnogo::UDM_PARAM_PAGE_SIZE,"10")
# mnogo.add_search_limit(Mnogo::UDM_LIMIT_TAG,'"AA"')
mnogo.set_param(Mnogo::UDM_PARAM_CHARSET, "koi8-r")
#mnogo.set_param(Mnogo::UDM_PARAM_LOCAL_CHARSET, "koi8-r")
mnogo.set_param(Mnogo::UDM_PARAM_BROWSER_CHARSET, "koi8-r")
#mnogo.set_param(Mnogo::UDM_PARAM_SEARCH_MODE, Mnogo::UDM_MODE_ANY)
#mnogo.set_param(Mnogo::UDM_PARAM_WORD_MATCH, Mnogo::UDM_MATCH_WORD)
#mnogo.set_param(Mnogo::UDM_PARAM_QSTRING, "q=info")

#mnogo.set_param(Mnogo::UDM_PARAM_HLBEG,'<font color="000088"><b>')
#mnogo.set_param(Mnogo::UDM_PARAM_HLEND,'</b></font>')

# mnogo.set_param(Mnogo::UDM_PARAM_QUERY, "info&ru")

res = mnogo.find("привод")
# print mnogo.make_excerpt(res,0),"\n"
res.each {|x| print x.title,"\n" }
#print res.getparam(Mnogo::UDM_PARAM_WORDINFO),"\n"

# res.eachp(Mnogo::UDM_FIELD_TITLE) {|x| print x,"\n"}
# res.each {|x| print x.title,"\n"}
# print res.xml.gsub(/&/, '&amp;').gsub("\2",'<font color="000088"><b>').gsub("\3",'</b></font>')
# mnogo.cat.list.each { |x| print 'A:',x.link,x.name,"\n" }
