<commit_before>package com.juls.rest.services;

import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import org.springframework.stereotype.Service;

import com.juls.model.Good;
import com.juls.persist.GoodDAOImpl;

@Service
public class GoodsService {
	
	public Set<Good> getSearchResult(String query){
		Set<String> subqueries = new LinkedHashSet<String>();
		for(String s : query.split(" ")){
			subqueries.add(s);
		}
		
		Set<Good> result = new LinkedHashSet<Good>(20);
		for(String s : subqueries){
			for(Good g : new GoodDAOImpl().getAll()){
				if (g.getName().toLowerCase().contains(s)){
					result.add(g);
				}
			}
		}
		return result;
	}
	
	public Set<Good> doSort(String searchQuery, String parameter, String way){
		Set<Good> result = new LinkedHashSet<Good>(20);
		Set<String> subqueries = new LinkedHashSet<String>();
		if (!searchQuery.equals("null")){
			for(String s : searchQuery.split(" ")){
				subqueries.add(s);<commit_msg>Search repaired<commit_after>package com.juls.rest.services;

import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import org.springframework.stereotype.Service;

import com.juls.model.Good;
import com.juls.persist.GoodDAOImpl;

@Service
public class GoodsService {
	
	public Set<Good> getSearchResult(String query){
		Set<String> subqueries = new LinkedHashSet<String>();
		for(String s : query.split(" ")){
			subqueries.add(s);
		}
		
		Set<Good> result = new LinkedHashSet<Good>(20);
		List<Good> allGoods = new GoodDAOImpl().getAll();
		for(String s : subqueries){
			for(Good g : allGoods){
				if (g.getName().toLowerCase().contains(s)){
					result.add(g);
				}
			}
		}
		return result;
	}
	
	public Set<Good> doSort(String searchQuery, String parameter, String way){
		Set<Good> result = new LinkedHashSet<Good>(20);
		Set<String> subqueries = new LinkedHashSet<String>();
		if (!searchQuery.equals("null")){
			for(String s : searchQuery.split(" ")){
				subqueries.add(s);
{'fraction_non_alphanumeric': 0.14607843137254903, 'fraction_numerical': 0.00392156862745098, 'mean_word_length': 4.607142857142857, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5938701', 'n_tokens_mistral': 767, 'n_tokens_neox': 688, 'n_words': 143}