What to do when Drupal views module doesn't output what you want? When a user search for a word the view should output its translation and any other vocabs that might be similar to it ( using Taxonomy terms ). 

This works as the following:

The similar vocabs are actually another view that I pass ( Taxonomy ids ) to its URL as a contextual filter and it outputs all words that has the same Taxonomy term or terms. This view a lone by it self works fine when you pass Taxonomy terms manually. It doesn't produce any duplicates since I handled that by choosing 'Query settings: DISTINCT' and using aggregation.

However when I combine it with the other view and pass the Taxonomy terms using the Views UI it produce duplicates. 

What should I do? Is there a way to write the view code manually or something like that?
Is there a way to write the view code manually or something like that?


You could easily setup a menu route and controller (or page callback in D7) to serve the same purpose. The controller would execute the query (provided by you) and return the results / page output as a renderable array.

However, there are many variables in between, so it would be hard to provide all the code. 

Here is a walkthrough for D7 to starting to code your own route and callback: https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu/7.x

Here is one for D8:
https://www.drupal.org/docs/8/api/routing-system/introductory-drupal-8-routes-and-controllers-example

It would be a good opportunity to learn how to extend Drupal and 'take control' when you don't get the result you want with Views, or, just to have more control in general.