Sunspot Searchable :as, :using, :multiple - sunspot-solr

Does anyone know the documentation URL for the :as, :using, and :multiple symbols in Sunspot's searchable block? I found it before, now I cannot find it anymore.

I cannot find anything with the symbol :as. I found :using and :multiple at: https://github.com/sunspot/sunspot/wiki/Setting-up-classes-for-search-and-indexing
Edit:
Found some info on the :as at https://github.com/sunspot/sunspot/blob/master/sunspot/lib/sunspot/field.rb

Related

Spaces in wikimedia templates

I'm working on a MediaWiki-generated Wiki, and want to build a template that would link me to a French Wikipedia article. I have this :
[http://fr.wikipedia.org/wiki/{{{1|}}} {{#if:{{{2|}}}|{{{2|}}}|{{{1|}}}}}]
Logic being :
{{Wpfr|article name|alternate name (if needed)}}
Thing is, if the article name has spaces in it, it breaks, keeping the first word as {{{1}}} and putting the rest in {{{2}}}.
I'd like to find a way to be able to use spaces in {{{1}}} without breaking the links. That way :
{{Wpfr|Greg Weisman}}
would automatically link to the article on Greg Weisman and display "Greg Weisman".
I've tried using :
[http://fr.wikipedia.org/wiki/{{{art|}}} {{#if:{{{2|}}}|{{{2|}}}|{{{art|}}}}}]
{{Wpfr|art=article name}}
(even replacing the 2s by 1s) to no avail.
The Wiki admin part hasn't been updated in a while so the Interwiki table can't be updated and I can't use the "replace" function either.
I'm new to Wikicoding, so I'm sorry if the answer is very simple.
Thanks !
Edit : the MediaWiki version is 1.13.5
Mediawiki has a magic word for handeling encoding of url:
{{urlencode:data|style}}
{{urlencode:Greg Weisman|PATH}} will return:
Greg%20Weisman
Change your template with:
[http://fr.wikipedia.org/wiki/{{urlencode:{{{1|}}}|PATH}} {{#if:{{{2|}}}|{{{2|}}}|{{{1|}}}}}]

Cannot change colorscheme in leiningen ultra plugin settings

I discovered leiningen ultra plugin, which provides a colorized REPL amongst other things: https://github.com/venantius/ultra
However, the colors, especially the "blue" for function symbols are not very readable in my terminal with the black background.
I'd like to change the colors but wasn't able to do this following the documentation.
I added following configuration to myprofiles.clj right under the :user key, but nothing has changed
:ultra {:repl {:color-scheme {:function-symbol [:red]
:class-delimiter [:red]}}}
Any ideas what I'm doing wrong?
Has anyone been successful in setting custom color scheme?
Following configuration in ~/lein/profiles.clj works for me:
{:user {:plugins [[venantius/ultra "0.5.1"]]
:ultra {:repl {:color-scheme {:delimiter [:blue]
:symbol [:green]
:keyword [:bold :yellow]}}}}}
To answer my own question:
It seems that it's not possible to provide custom colorscheme to modify output of source.
https://github.com/venantius/glow is used to colorize the output of source and the terminal-default colorscheme is hardcoded in ultra plugin: https://github.com/venantius/ultra/blob/7ccac0749220028cda4c3c1ab4d4d45503cce0cc/src/ultra/repl.clj#L21

Posting to Page Via Facebook API - Mentioning (linking) friends and Pages

I'm using the facebook open graph api to post to a facebook fan page. More info on the method can be found in the answer here.
When one manually posts on facebook they can use # to link a particular person e.g. #Michael Jackson. This auto populates a link to that persons page and shows up on their timeline. The # itself dissapears once the post has been made, leaving only the hyperlinked text i.e. Michael Jackson.
Programatically compiling a post via the api, including the #, results in the text being posted in plain text. i.e. #Michael Jackson shows as #Michael Jackson.
How can I escape, or otherwise parse the anchor through the api so that Facebook recognises it as a link to another user/page?
Edit: I found this reference which describes these links as Actions, specifically in this case a 'Mentioning friends' action. It goes on to explain the syntax of #[USERID] or #[USERNAME] which is promising. But if I compile this encoded it posts the plain encoded text e.g. %40%5BUSERID%5D, when left un-encoded the post fails.
I've found that starting your message with a mention tag (i.e. #[12345678:User Name] ) throws a CurlException error.
To fix this I changed:
'message' => '#[1234567890:User Name]';
To
'message' => ' #[1234567890:User Name]';
Simply adding a space before the mention seems to fix that problem.

Clojure: Enlive has selector doesn't return anything

I'm trying to get images inside links from enlive document. The following works:
(html/select nodes [:a :img])
But this way I only get the image nodes, I want the links too!
So the next step was
(html/select nodes [:a (html/has [:img])])
But for some reason this returns just an empty list. I tried to browse the documentation and read the source code and it seems this should return links with img tags as child but maybe I missed something (or this is a bug)
Okay, figured it out. This needs second set of brackets. Why? I tried to read the documentation but I'm not sure (something about and rules). Anyway, here is the answer.
(html/select nodes [[:a (html/has [:img])]])

Mercury Editor with rails4

i'm wondering how to use mercury gem with rails4.
i tried to follow guide http://asciicasts.com/episodes/296-mercury-editor
if i load page within editor ( /editor/pages/1) i see error in javascript console:
Uncaught TypeError: Cannot read property 'konqueror' of undefined
and mercury-region isn't visible at page at all
Gemfile:
gem 'mercury-rails', github: 'jejacks0n/mercury'
app/views/pages/show.html.erb:
<div id="page_body" class="mercury-region" data-type="editable">
<%= raw(#page.body) %>
</div>
after some delay i get javascript alert with message:
Mercury.PageEditor failed to load: Region type is malformed, no data-type provided, or "Full" is unknown for the "page_body" region.
Please try refreshing.
mercury is utilising jquery.browser this method is deprecated in the most recent update.
If you include gem 'jquery-migrate-rails' in your gemfile that you should work favourably until mercury updates it's code to the latest jquery or at least 1.9
You'll need to add
//= require jquery-migrate-min
to your application.js after jquery is loaded.
I just had the same issue. I describe it better in my own question here, but basically the issue comes from a deprecated jquery method calling 'konqueror'. I don't think it had anything to do with your app being in rails 4 btw. I'm in gem 'rails', '3.2.13'
I'd up-vote the question but apparently I need more reputation. hint, hint :)
I had a similar issue with this because of turbolinks. I just disabled its JS in applications.js:
//= require turbolinks
~to:
// require turbolinks
-until I figure out how to get them to play nicely together. At least for the Mercury pages, have to poke them somehow.
I have some issues too, it does seem to be an issue with Turbolinks. I was able to get by it by removing the line:
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
from my application.html.erb file, not sure if this will cause issues down the road