responsible for making full text searching on items
config provide only searchableFields
18913
function(items, config) {

  config = config || {};
  config.searchableFields = config.searchableFields || [];
  this.items = items;
  // creating index
  this.idx = lunr(function () {
    // currently schema hardcoded
    this.field('name', { boost: 10 });

    var self = this;
    _.forEach(config.searchableFields, function(field) {
      self.field(field);
    });
    this.ref('id');
  })
  //var items2 = _.clone(items)
  var i = 1;
  _.map(items, (doc) => {

    if (!doc.id) {
      doc.id = i;
      ++i;
    }
    this.idx.add(doc)
  })

  this.store = _.mapKeys(items, (doc) => {
    return doc.id;
  })
}
495444
function instantSearch() {

    const q = $("#searchbox").val();
    if (q === '')
        return;

    const matcher = "/matcher?beginsWith=" + q;
    const request = host + matcher;

    console.debug(request);

    $.getJSON(request, '', {})
        .done(data => {

            $("#searchbox").autocomplete({
                source: data,
                select: (event) => {
                    event.stopPropagation();
                    $("#search").trigger("click");
                }
            });
        })
        .fail((d, textStatus, error) => {

            const err = d.status + " " + error + " -> message: " + d.responseText;
            bootstrapAlert.error(err);
            console.error(`Search request failed: \n ${err}`);
        });
}
469751
public function getSelectableFields() {

		// Instantiate some default selectable fields, just in case the search engine does not provide any.

		$selectable = array(
			'LastEdited' => _t('EXTENSIBLE_SEARCH.LAST_EDITED', 'Last Edited'),
			'ID' => _t('EXTENSIBLE_SEARCH.CREATED', 'Created'),
			'ClassName' => _t('EXTENSIBLE_SEARCH.TYPE', 'Type')
		);

		// Determine the search engine that has been selected.

		if(($this->SearchEngine !== 'Full-Text') && ClassInfo::exists($this->SearchEngine)) {

			// Determine the search engine specific selectable fields.

			$fields = singleton($this->SearchEngine)->getSelectableFields($this) ?: array();
			return $fields + $selectable;
		}
		else if(($this->SearchEngine === 'Full-Text') && is_array($classes = Config::inst()->get(FulltextSearchable::class, 'searchable_classes')) && (count($classes) > 0)) {

			// Determine the full-text specific selectable fields.

			$selectable = array(
				'Relevance' => _t('EXTENSIBLE_SEARCH.RELEVANCE', 'Relevance')
			) + $selectable;
			foreach($classes as $class) {
				$fields = DataObject::getSchema()->databaseFields($class);

				// Determine the most appropriate fields, primarily for sorting.

				if(isset($fields['Title'])) {
					$selectable['Title'] = _t('EXTENSIBLE_SEARCH.TITLE', 'Title');
				}
				if(isset($fields['MenuTitle'])) {
					$selectable['MenuTitle'] = _t('EXTENSIBLE_SEARCH.NAVIGATION_TITLE', 'Navigation Title');
				}
				if(isset($fields['Sort'])) {
					$selectable['Sort'] = _t('EXTENSIBLE_SEARCH.DISPLAY_ORDER', 'Display Order');
				}

				// This is specific to file searching.

				if(isset($fields['Name'])) {
					$selectable['Name'] = _t('EXTENSIBLE_SEARCH.FILE_NAME', 'File Name');
				}
			}
		}

		// Allow extension customisation, so custom fields may be selectable.

		$this->extend('updateExtensibleSearchPageSelectableFields', $selectable);
		return $selectable;
	}
646287
function handleSearchText(searchText, previousSearchText) {
      self.index = -1;
      // do nothing on init
      if (searchText === previousSearchText) return;
      else if (self.selectedItem && self.displayProperty1) {
        setLoading(false);
        if (self.selectedItem[self.displayProperty1] !== searchText) {
          self.selectedItem = null;
          self.hidden = shouldHide();
          if (self.itemList && self.itemListCopy) {
            self.itemList = angular.copy(self.itemListCopy);
          }
        }
      }
      else if (self.remoteMethod) {
        fetchResults(searchText);
      }
      else if (self.itemList) {
        self.itemList = $filter('filter')(self.itemListCopy, searchText);
      }
    }
822131
public function getSearchableFieldsString()
    {
        if (!empty($this->searchableFieldsString)) {
            return $this->searchableFieldsString;
        }

        $searchableFieldsMeta = $this->getSearchableFieldsMeta();
        if (empty($searchableFieldsMeta)) {
            return false;
        }

        $this->searchableFieldsString = array_map(function (PropertyContract $property) {
            return $property->getField();
        }, $searchableFieldsMeta);

        return $this->searchableFieldsString;
    }
1267051
function() {
			var settings = this.settings;
			var sort = settings.sortField;
			if (typeof sort === 'string') {
				sort = [{field: sort}];
			}
	
			return {
				fields      : settings.searchField,
				conjunction : settings.searchConjunction,
				sort        : sort
			};
		}
1192710
protected void addSimpleSearchSetting(CmsXmlContentDefinition contentDef, String name, String value)
    throws CmsXmlException {

        if ("false".equalsIgnoreCase(value)) {
            addSearchSetting(contentDef, name, Boolean.FALSE);
        } else if ("true".equalsIgnoreCase(value)) {
            addSearchSetting(contentDef, name, Boolean.TRUE);
        } else {
            StringTemplate template = m_searchTemplateGroup.getInstanceOf(value);
            if ((template != null) && (template.getFormalArgument("name") != null)) {
                template.setAttribute("name", CmsEncoder.escapeXml(name));
                String xml = template.toString();
                try {
                    Document doc = DocumentHelper.parseText(xml);
                    initSearchSettings(doc.getRootElement(), contentDef);
                } catch (DocumentException e) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
        }
    }
371925
def filterItems(self,
                    terms,
                    autoExpand=True,
                    caseSensitive=False):
        
        # create a dictionary of options
        if type(terms) != dict:
            terms = {'*': nativestring(terms)}
        
        # create a dictionary of options
        if type(terms) != dict:
            terms = {'*': nativestring(terms)}
        
        # validate the "all search"
        if '*' in terms and type(terms['*']) != list:
            sterms = nativestring(terms['*'])
            
            if not sterms.strip():
                terms.pop('*')
            else:
                dtype_matches = COLUMN_FILTER_EXPR.findall(sterms)
                
                # generate the filter for each data type
                for match, dtype, values in dtype_matches:
                    sterms = sterms.replace(match, '')
                    terms.setdefault(dtype, [])
                    terms[dtype] += values.split(',')
                
                keywords = sterms.replace(',', '').split()
                while '' in keywords:
                    keywords.remove('')
                
                terms['*'] = keywords
        
        # filter out any columns that are not being searched
        filtered_columns = self.filteredColumns()
        filter_terms = {}
        for column, keywords in terms.items():
            index = self.column(column)
            if column != '*' and not index in filtered_columns:
                continue
            
            if not caseSensitive:
                keywords = [nativestring(keyword).lower() for keyword in keywords]
            else:
                keywords = map(str, keywords)
            
            filter_terms[index] = keywords
        
        self.__filterItems(filter_terms, autoExpand, caseSensitive, 0)
1020180
def filter_fields(self, fields=[], exclude=[], include_all_if_empty=True):
        
        if not include_all_if_empty and not fields:
            return []
        ret = []
        for f in self.visible_fields():
            if fields and f.name not in fields:
                continue
            if exclude and f.name in exclude:
                continue
            ret.append(f)
        return ret
484689
@Override
    public void _search(String fieldName, String searchTerms) {
        _search(fieldName, searchTerms, SearchOperator.OR);
    }
206696
function () {
        var searchField = this.config.searchField;
        return searchField &&
          Object.keys(searchField).every(function (key) {
            return searchField[key] === false;
          });
      }
643334
private void searchAndAddToResults(EntityMetadata m, String persistenceUnit, ConsistencyLevel consistencyLevel,
            String columnFamilyName, List<SearchResult> searchResults, IndexExpression expression, boolean isRowKeyQuery)
    {
        SearchResult searchResult = new SearchResult();

        byte[] superColumnName = expression.getValue();
        String superColumnNameStr = null;
        String rowKey = null;
        try
        {
            rowKey = ByteBufferUtil.string(ByteBuffer.wrap(expression.getColumn_name()),
                    Charset.forName(Constants.CHARSET_UTF8));
            superColumnNameStr = new String(expression.getValue(), Charset.forName(Constants.CHARSET_UTF8));
        }
        catch (CharacterCodingException e)
        {
            log.error("Error while retrieving records {}, Caused by:", e);
            throw new PersistenceException(e);
        }
        Object pk = PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), superColumnName);
        IndexOperator condition = expression.getOp();

        if (log.isInfoEnabled())
        {
            log.info("RowKey: {} ; Super column Name: {} on condition.", rowKey, superColumnNameStr, condition);
        }

        // TODO: Second check unnecessary but unavoidable as filter clause
        // property is incorrectly passed as column name

        // Search based on Primary key
        if (isRowKeyQuery
                && (rowKey.equals(m.getIdAttribute().getName()) || rowKey.equals(((DefaultSingularAttribute) m
                        .getIdAttribute()).getJPAColumnName())))
        {
            if (searchResults.isEmpty())
            {
                searchResult.setPrimaryKey(pk);
                searchResults.add(searchResult);
            }
            else
            {
                SearchResult existing = searchResults.get(0);
                if (existing.getPrimaryKey() != null && existing.getPrimaryKey().equals(superColumnNameStr))
                {
                    searchResults.add(searchResult);
                }
                else
                {
                    searchResults.remove(0);
                }
            }
        }
        else
        {
            // Search results in the form of thrift super columns
            List<SuperColumn> thriftSuperColumns = new ArrayList<SuperColumn>();

            switch (condition)
            {
            // EQUAL Operator
            case EQ:
                SuperColumn thriftSuperColumn = getSuperColumnForRow(consistencyLevel, columnFamilyName, rowKey,
                        superColumnName, persistenceUnit);

                if (thriftSuperColumn != null)
                    thriftSuperColumns.add(thriftSuperColumn);
                break;

            // LIKE operation not available
            // Greater than operator
            case GT:
                searchSuperColumnsInRange(columnFamilyName, consistencyLevel, persistenceUnit, rowKey, superColumnName,
                        thriftSuperColumns, superColumnName, new byte[0]);
                break;
            // Less than Operator
            case LT:
                searchSuperColumnsInRange(columnFamilyName, consistencyLevel, persistenceUnit, rowKey, superColumnName,
                        thriftSuperColumns, new byte[0], superColumnName);
                break;
            // Greater than-equals to operator
            case GTE:
                searchSuperColumnsInRange(columnFamilyName, consistencyLevel, persistenceUnit, rowKey, superColumnName,
                        thriftSuperColumns, superColumnName, new byte[0]);
                break;
            // Less than equal to operator
            case LTE:
                searchSuperColumnsInRange(columnFamilyName, consistencyLevel, persistenceUnit, rowKey, superColumnName,
                        thriftSuperColumns, new byte[0], superColumnName);
                break;

            default:
                throw new QueryHandlerException(condition
                        + " comparison operator not supported currently for Cassandra Inverted Index.");
            }

            // Construct search results out of these thrift columns
            for (SuperColumn thriftSuperColumn : thriftSuperColumns)
            {

                for (Column column : thriftSuperColumn.getColumns())
                {
                    byte[] columnName = column.getName();
                    searchResult.setPrimaryKey(PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(),
                            columnName));
                    byte[] columnValue = column.getValue();
                    String ecValue = UTF8Type.instance.compose(ByteBuffer.wrap(columnValue));

                    if (ecValue != null && !"".equals(ecValue.trim()))
                    {
                        searchResult.setEmbeddedColumnName(rowKey.substring(0,
                                rowKey.indexOf(Constants.INDEX_TABLE_ROW_KEY_DELIMITER)));
                        searchResult.addEmbeddedColumnValue(ecValue);
                    }
                }

                if (searchResults.isEmpty())
                {
                    searchResults.add(searchResult);
                }
                else
                {
                    SearchResult existing = searchResults.get(0);
                    if (existing.getPrimaryKey() != null
                            && existing.getPrimaryKey().equals(searchResult.getPrimaryKey()))
                    {
                        searchResults.add(searchResult);
                    }
                    else
                    {
                        searchResults.remove(0);
                    }
                }

            }
        }
    }
63704
function isSearchable() {
    if (ctrl.loading && !hasMatches()) {
      // No query when query is in progress.
      return false;
    } else if (hasSelection()) {
      // No query if there is already a selection
      return false;
    }
    else if (!hasFocus) {
      // No query if the input does not have focus
      return false;
    }
    return true;
  }
1022858
function (query) {
        var fieldList = ['name', 'owner', 'description', 'keyword'];
        var parsedField = _.find(fieldList, function (field) {
          return query.indexOf(field + ':') === 0;
        });
        var parsedQuery = parsedField ? query.replace(new RegExp('^' + parsedField + ':'), '') : query;
        return {query: parsedQuery, field: parsedField};
      }
129746
def SearchList(items, message="Select an item:", title='FontParts'):
    
    return dispatcher["SearchList"](items=items, message=message, title=title)
182621
private String logAndGetQueryText(FieldSearchQuery query,
                                      String[] resultFields) //2004.05.02 wdn5e
            throws SQLException, QueryParseException {
        StringBuffer queryText = new StringBuffer("SELECT");
        if (query.getType() == FieldSearchQuery.TERMS_TYPE) {
            queryText.append(" doFields.pid FROM doFields"
                    + getWhereClause(query.getTerms()));
        } else {
            StringBuffer resultFieldsString = new StringBuffer();
            if (resultFields.length > 0) {
                String delimiter = " ";
                for (String element : resultFields) {
                    String dbColumn = "doFields." + dcFixup(element);
                    resultFieldsString.append(delimiter + dbColumn);
                    delimiter = ", ";
                }
            }
            queryText.append(resultFieldsString);
            queryText.append(" FROM doFields");
            queryText.append(getWhereClause(query.getConditions()));
            // disabled sorting: see bug 78
            //            queryText.append(" ORDER BY");
            //            queryText.append(resultFieldsString);

        }
        String qt = queryText.toString();
        logger.debug(qt);
        return qt;
    }
492044
function valueFilteredByFields(fieldName, item, options) {
	if (!inFields(fieldName, options)) return null;
	return item.dataValues[fieldName];
}