AND as default operator & Highlighting with Boosting -- need clarification on how to do #118

mikeg250 opened this Issue Oct 5, 2011 · 3 comments


None yet
3 participants

mikeg250 commented Oct 5, 2011

Hi Karel,

Your Tire gem is very well documented and seems like a good alternative to Solr/Sunspot. However, I am confused about a two items and wanted to get your advice:

What is the best way to set up a search box to default to AND (instead of OR) for multiple keyword entries (similar to Google)? I was looking for a way to set the default operator like you would in Solr's schema.xml, but can’t seem to find the right instructions for Tire/Elasticsearch. Here is specifically what I’m confused about:

elasticsearch/elasticsearch#1009 indicates that Elasticsearch doesn’t yet support a switch to AND (from OR) as a global setting.

This Pull Request on your github looks like it may work:
but I’m not sure where to actually put the AND operator in the code (probably because I’m having to learn Ruby as my first language so I can set up a working a prototype).

In addition, down the line I would like to use the more advanced Query DSL, but your highly detailed and helpful tire.rb overview seems to indicate that Tire doesn’t yet support the AND filter (not sure yet if this is the same as the AND operator).

Can you suggest the best method for setting up Tire (or Elasticsearch) to default to AND instead of OR?

Also, will Tire allow Highlighting to work with custom_score or boosting? I ask because I saw this open pull request on Elasticsearch elasticsearch/elasticsearch#1315

Thank you,

Mike G


vhyza commented Oct 5, 2011


I think you can't set default operator as global setting in tire. But searching by string should support to change operator from OR to AND. Also AND filter should work. See following gist for examples:

Have a nice day


karmi commented Oct 5, 2011

@mikeg250: Tire allows you to set default operator per query, via the :default_operator option.

The commit seejohnrun/tire@55ed24 is old and was superseded by new changes.

I am not aware if there's a way to set it globally in ElasticSearch, and probably wouldn't like such a global option myself...

(...) seems to indicate that Tire doesn’t yet support the AND filter (...)

Tire does not support "and filter" but does support "boolean queries".

See @vhyza's gist (thanks!!) for a complete overview.

mikeg250 commented Oct 5, 2011

Wow, thanks for the quick responses. I'll take a look at those commits and see what I can figure out.


karmi closed this Oct 9, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment