Skip to content

Using 'match' instead of 'term' in search queries #77

Description

@Treora

After I just had an issue with a capitalised uri not returning any results from an annotation search (using a non-default mapping), @tilgovi suggested to use 'match' instead of 'term' filters in queries. Would this be an improvement, and would it provide a solution to #73 and #75 as well?

As explained on stackoverflow:

The match query will apply the same standard analyzer to the search term and will therefore match what is stored in the index. The term query does not apply any analyzers to the search term, so will only look for that exact term in the index.

A related question is: What is the desired behaviour of the search? For a URI, userid and such an exact match seems appropriate, while perhaps for the text field fuzzy matching could be acceptable? I suppose that these things could be controlled in the mapping.

For reference, right now the main part of queries is built like this: (in elasticsearch.py)

    for k, v in query.iteritems():
        q['filtered']['filter']['and'].append({'term': {k: v}})

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions