CDRH / api

Codenamed "Apium": An API to access all public Center for Digital Research in the Humanities resources
https://cdrhdev1.unl.edu/api_frontend
MIT License
3 stars 1 forks source link

Mix exact search with stemming #99

Open techgique opened 4 years ago

techgique commented 4 years ago

This is the droid we're looking for: https://www.elastic.co/guide/en/elasticsearch/reference/6.8/mixing-exact-search-with-stemming.html

jduss4 commented 4 years ago

Agreed. Another alternative would be to have a dynamic text field type that has the exact searching so that collections could use as many or as few as they wanted, vs in this case where it would be tied to a text field defined in the schema. That would also mean that we wouldn't need to alter the API itself to pick out the text.exact field terminology / send a request for it, I believe?

jduss4 commented 4 years ago

@techgique I think you were right about ES being able to tell automatically, that's awesome!

Fortunately, the query_string and simple_query_string queries have a feature that solves this exact problem: quote_field_suffix. This tells Elasticsearch that the words that appear in between quotes are to be redirected to a different field, see below:

I think we would only need to change the API queries being sent to make it work!