Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
mikeg250 opened this Issue · 3 comments

3 participants

@mikeg250

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:

elastic/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:
seejohnrun@55ed240
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 elastic/elasticsearch#1315

Thank you,

Mike G

@vhyza
Collaborator

Hello,

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: https://gist.github.com/1263816

Have a nice day

@karmi
Owner

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

The commit seejohnrun@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

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

Thanks,

@karmi karmi closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.