Search

1 view
Skip to first unread message

urdabum

unread,
Feb 17, 2010, 2:28:47 AM2/17/10
to Skyline CMS
I see that in the demo video of Skyline in Action, there is a Search
on the top right. How do i get that or is there a plugin if it?

-Michael

Flurin Egger

unread,
Feb 17, 2010, 4:30:10 AM2/17/10
to skyli...@googlegroups.com
Hi Michael,

The search box in the demo video is connected to a SOLR server for
indexing and searching. In the current version of Skyline, the search
has been removed but will return soon as a plugin. Luis can tell you
more about that.

Cheers,
Flurin

urdabum

unread,
Feb 25, 2010, 4:57:20 AM2/25/10
to Skyline CMS
I know you guys are busy, i just want to know what is the ETA on the
search plugin?

Luis Doubrava

unread,
Feb 25, 2010, 5:41:50 AM2/25/10
to skyli...@googlegroups.com
Hi Michael,

At the moment there isn't an ETA.
What I can do is explain a bit of what we did and maybe it can help
you on your way.

You'll need the following gems:
gem "curb"
gem "mwmitchell-rsolr"
gem "mwmitchell-rsolr-ext"

Then you'll need to download Solr and configure it to index what you
need.
This can be a bit tricky but it comes down to defining the fields that
you want indexed in schema.xml
We used the following fields

<field name="id" type="string" indexed="true" stored="true"
required="true" />
<field name="title" type="text" indexed="true" stored="true"/>
<field name="titleSort" type="string" indexed="true" stored="false"/>
<field name="cat" type="text_ws" indexed="true" stored="true"
multiValued="true" omitNorms="true" termVectors="true" />
<field name="body" type="text" indexed="true" stored="true"/>
<field name="url" type="text" indexed="false" stored="true"/>
<field name="documentdate" type="date" indexed="true"
stored="true" />
<field name="text" type="text" indexed="true" stored="true"
multiValued="true"/>
<field name="timestamp" type="date" indexed="true" stored="true"
default="NOW" multiValued="false"/>
<field name="spell" type="textSpell" indexed="true" stored="true"
multiValued="true"/>
<field name="titleSearch" type="textSpell" indexed="true"
stored="true" multiValued="false"/>
<field name="doctype" type="string" indexed="true" stored="true"
multiValued="true"/>

Then you'll need to configure solrconfig.xml to make it possible to
index uploaded documents like pdf, doc, etc...
This is the part that has changed quite a bit and I suggest you reed
up on the new Solr docs for this.

After you've configured solr your can turn on the indexing in
skyline_configuration:
config.solr_indexing = true

When you publish a page or upload a file it will automatically send
it's data to solr.

To extract the data from solr you'll have to send a request (the rsolr
gem makes it easy for you)

solr = RSolr.connect
response = solr.select({:q => params[:value], :extendedResults =>
true, :suggestionCount=>20, :facet=>true , "facet.field" => "spell",
"facet.prefix"=>params[:value]})

Or a bit more complex:

solr_params = RSolr::Ext.map_params(
:q => q,
:fq => fq,
:hl => true,
"hl.fl" => "text",
"spellcheck.q" => params[:q],
:spellcheck => true,
"spellcheck.build" => true,
:facet => "on",
"facet.field" => "{!ex=cat}cat",
:page => paginate_page,
:per_page => 10
)

raw_response = solr.spellCheckCompRH(solr_params)
response = RSolr::Ext.wrap_response(raw_response)

Solr returns a json object with lots of extra data, so once you've got
it you'll need to extract the bits and pieces you need from it.

In our implementation we used the pages controller and a setting to
send the request to solr and display the results.
The action on the search form goes to the search page in the settings
and in the controller we check if the requested page is the search
page. If that is the case we send the request to solr and build our
own results object and render the page.

I'm sorry I can't be of any more help but Solr has changed quite a bit
since we implemented it. If you decide to go down the road of setting
it up and making it work with Skyline let me know. I'm happy to help
where I can.

Good luck,
Luis

Reply all
Reply to author
Forward
0 new messages