Fix Query Creator

Change-Id: I55e48f3f73b36c9afe6647091829935d792d9c1d
diff --git a/dev/js/spec/queryCreatorSpec.js b/dev/js/spec/queryCreatorSpec.js
index c0953ba..09189bc 100644
--- a/dev/js/spec/queryCreatorSpec.js
+++ b/dev/js/spec/queryCreatorSpec.js
@@ -681,5 +681,31 @@
       expect(cell.classList.contains("chosen")).toBeFalsy();
       expect(qc.toString()).toEqual("[orth=Baum]");
     });
+
+    it('should add fragment to QueryBar', function () {
+      var matchTable = matchTableCuttedFactory();
+      var qc = qcClass.create(matchTable);
+      expect(qc.toString()).toEqual("");
+
+      var cell = matchTable.querySelector("thead > tr > th:nth-child(3)");
+      expect(cell.classList.contains("chosen")).toBeFalsy();
+      cell.click();
+      expect(cell.classList.contains("chosen")).toBeTruthy();
+      expect(qc.toString()).toEqual("[orth=Baum]");
+
+      // May break
+      qc._ql = document.createElement('select');
+      let opt = qc._ql.appendChild(document.createElement('option'));
+      opt.value='cosmas 2';
+      let opt2 = qc._ql.appendChild(document.createElement('option'));
+      opt2.value='poliqarp';
+
+      qc._q = document.createElement('input');
+      
+      qc._element.click();
+
+      expect(qc._ql.selectedIndex).toEqual(1);
+      expect(qc._q.value).toEqual("[orth=Baum]");
+    });
   });
 });
diff --git a/dev/js/src/match/querycreator.js b/dev/js/src/match/querycreator.js
index f3c533f..99b0bc1 100644
--- a/dev/js/src/match/querycreator.js
+++ b/dev/js/src/match/querycreator.js
@@ -408,7 +408,10 @@
       };
 
       // Set query language field
-      const ql = this._ql.options.find(e => e.value == 'poliqarp');
+      const ql = Array.from(
+        this._ql.options
+      ).find(e => e.value == 'poliqarp');
+
       if (ql)
         ql.selected = true;