# Similarity Search Result

**URL:** <https://community.datagrok.ai/t/similarity-search-result/442>\
**Category:** Features\
**Created:** [November 20, 2020, 8:53pm UTC](https://community.datagrok.ai/t/similarity-search-result/442 "2020-11-20T20:53:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpetrov.datagrok.ai](https://community.datagrok.ai/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@dpetrov.datagrok.ai](https://community.datagrok.ai/u/dpetrov.datagrok.ai)\
**Post date:** [November 20, 2020, 8:53pm UTC](https://community.datagrok.ai/t/similarity-search-result/442/1 "2020-11-20T20:53:26Z")

</div>

For similaritySearch() function, could you please add an additional column to the result data frame filled with the indices corresponding to the original molecules order? That way it would be much easier to map the result molecules with other records in the original data frame.

---

<div class="post-metadata">

**Author:** ![dskatov](https://community.datagrok.ai/user_avatar/community.datagrok.ai/dskatov/32/71_2.png) [@dskatov](https://community.datagrok.ai/u/dskatov)\
**Post date:** [November 22, 2020, 7:08pm UTC](https://community.datagrok.ai/t/similarity-search-result/442/2 "2020-11-22T19:08:09Z")

</div>

Hi Dmitry,  
Thanks for your suggestion! That is definitely possible, we’re planning to add this feature to the next update by Tuesday.

---

<div class="post-metadata">

**Author:** ![nico.pulver.novartis.com](https://community.datagrok.ai/letter_avatar_proxy/v4/letter/n/76d3ee/32.png) [@nico.pulver.novartis.com](https://community.datagrok.ai/u/nico.pulver.novartis.com)\
**Post date:** [November 23, 2020, 7:44am UTC](https://community.datagrok.ai/t/similarity-search-result/442/3 "2020-11-23T07:44:35Z")

</div>

Hi Dan, is that the same function which Olesia is using or is she using one which preserves the original order, as we discussed a while back?

---

<div class="post-metadata">

**Author:** ![dskatov](https://community.datagrok.ai/user_avatar/community.datagrok.ai/dskatov/32/71_2.png) [@dskatov](https://community.datagrok.ai/u/dskatov)\
**Post date:** [November 23, 2020, 8:57am UTC](https://community.datagrok.ai/t/similarity-search-result/442/4 "2020-11-23T08:57:29Z")

</div>

@nico not quite. There are two modes for the similarityScoring function. One is with {sorted: false}, which just produces scores for the input molecules in same order of input. That is the one Olesya is going to use. The {sorted: true} option sorts the output and puts in the scores for them in the DESC order.

What Dmitry suggests is to add to this second use case another column with an index pointing back to the original order. Without this, one has to either call this function twice (with sorted true, and false), or intent this order restoring on its own.

---

<div class="post-metadata">

**Author:** ![nico.pulver.novartis.com](https://community.datagrok.ai/letter_avatar_proxy/v4/letter/n/76d3ee/32.png) [@nico.pulver.novartis.com](https://community.datagrok.ai/u/nico.pulver.novartis.com)\
**Post date:** [November 23, 2020, 12:01pm UTC](https://community.datagrok.ai/t/similarity-search-result/442/5 "2020-11-23T12:01:28Z")

</div>

ok, then she is using the one without affecting the order, as we discussed, thanks.

---

<div class="post-metadata">

**Author:** ![dskatov](https://community.datagrok.ai/user_avatar/community.datagrok.ai/dskatov/32/71_2.png) [@dskatov](https://community.datagrok.ai/u/dskatov)\
**Post date:** [November 23, 2020, 12:41pm UTC](https://community.datagrok.ai/t/similarity-search-result/442/6 "2020-11-23T12:41:29Z")

</div>

@nico.pulver.novartis.com indeed, that’s correct!
