Sunspot Solr Autocomplete not working Ruby on Rails 3.2.3

I need help with Autocomplete in Solr's search bar. Am using this https://github.com/xponrails/sunspot_autocomplete

Follow the instructions and does not work.

I am stuck in my search bar - how do I add it while preserving the [: search] parameters

Someone else had the same problem, but he deleted his code that made it work.

* Do I need to do this only with jquery-ui autocomplete? Or there was something with the need to install the plugin in a certain way - I'm not sure if I installed it correctly.

Thanks =)

+5
source share
2 answers

, .

  • sunspot (https://github.com/sunspot/sunspot/blob/master/README.md)
  • , gem ( git gem 'sunspot_autocomplete', ">= 0.0.3", :git => 'git://github.com/xponrails/sunspot_autocomplete.git', )
  • .
  • sunspot solr schema.xml (   <schema name="sunspot" version="1.0"> <types> *here* </types> </fields> *and here* <fields> </schema>)
  • solr schema.xml
  • , ! xml ( , )
  • searchable do; ...; end ( , :using=>:[text field name])
  • searchable block
  • javascript application.js( js gem )
  • application.css( , js ).
  • ( )
  • autocomplete_text_field ( .html_safe, )

!

, -

, -

<%= autocomplete_text_field("uniq", "field", "http://localhost:8982/solr/", "uniq_field") %> - autocomplete :uniq_field, :using => :field solr (http://localhost:8982/solr/)

, -,

!

0

, . .

1. , <% = text_field_with_auto_complete 'item', 'name'% >

2: auto_complete_for_item_name.

setp 3: , @items.

4: @items. render: inline = > "<% = auto_complete_result @items, 'name', 'med_item'% > "

5: content_tag ( "ul", items.uniq.join)

.

, , .

,

Viji Kumar.M

0

All Articles