<commit_before># Search
import webnotes

# this is called when a new doctype is setup for search - to set the filters
def getsearchfields():

	sf = webnotes.conn.sql("select search_fields from tabDocType where name=%s", webnotes.form.getvalue("doctype"))
	sf = sf and sf[0][0] or ''
	sf = [s.strip() for s in sf.split(',')]
	if sf and sf[0]:
		res =  webnotes.conn.sql("select fieldname, label, fieldtype, options from tabDocField where parent='%s' and fieldname in (%s)" % (webnotes.form.getvalue("doctype","_NA"), '"'+'","'.join(sf)+'"'))
	else:
		res = []<commit_msg>Fix: Search Field customization via customize form view<commit_after># Search
import webnotes

# this is called when a new doctype is setup for search - to set the filters
def getsearchfields():
	sf = webnotes.conn.sql("""\
		SELECT value FROM `tabProperty Setter`
		WHERE doc_type=%s AND doc_name=%s AND property='search_fields'""", \
		(webnotes.form.getvalue("doctype"), webnotes.form.getvalue("doctype")))
	if not (sf and len(sf)>0 and sf[0][0]):
		sf = webnotes.conn.sql("select search_fields from tabDocType where name=%s", webnotes.form.getvalue("doctype"))
	sf = sf and sf[0][0] or ''
	sf = [s.strip() for s in sf.split(',')]
	if sf and sf[0]:
		res =  webnotes.conn.sql("select fieldname, label, fieldtype, options from tabDocField where parent='%s' and fieldname in (%s)" % (webnotes.form.getvalue("doctype","_NA"), '"'+'","'.join(sf)+'"'))
	else:
		res = []
{'fraction_non_alphanumeric': 0.1689847009735744, 'fraction_numerical': 0.006258692628650904, 'mean_word_length': 5.046218487394958, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4096200', 'n_tokens_mistral': 507, 'n_tokens_neox': 488, 'n_words': 153}