# Synonym matching under the hood

**URL:** <https://discuss.elastic.co/t/synonym-matching-under-the-hood/126217>\
**Category:** Elasticsearch\
**Created:** [March 30, 2018, 10:54am UTC](https://discuss.elastic.co/t/synonym-matching-under-the-hood/126217 "2018-03-30T10:54:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![imranazad](https://avatars.discourse-cdn.com/v4/letter/i/c2a13f/32.png) [@imranazad](https://discuss.elastic.co/u/imranazad)\
**Post date:** [March 30, 2018, 10:54am UTC](https://discuss.elastic.co/t/synonym-matching-under-the-hood/126217/1 "2018-03-30T10:54:24Z")

</div>

I'm trying to get a better understanding of how the terms from the query are matched against synonyms. I've been adding breakpoints to this file: [https://github.com/apache/lucene-solr/blob/master/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymFilter.java#L398](https://github.com/apache/lucene-solr/blob/master/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymFilter.java#L398)

When running the SynonymsAnalysisTests however I can't seem to workout where the matches are happening. Can someone point me in the right direction?

Also this line: [https://github.com/apache/lucene-solr/blob/master/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymFilter.java#L404](https://github.com/apache/lucene-solr/blob/master/lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymFilter.java#L404)

Just returns some bytes which aren't the synonyms. What does matchOutput represent in bytes?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 27, 2018, 10:54am UTC](https://discuss.elastic.co/t/synonym-matching-under-the-hood/126217/2 "2018-04-27T10:54:27Z")

</div>

Closed on April 27, 2018, 10:54am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
