<commit_before># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt

from __future__ import unicode_literals

import frappe
import re
from frappe.utils import cint, strip_html_tags
from frappe.model.base_document import get_controller

def setup_global_search_table():
	'''Creates __global_seach table'''
	if not '__global_search' in frappe.db.get_tables():
		frappe.db.sql('''create table __global_search(
			doctype varchar(100),
			name varchar(140),
			title varchar(140),
			content text,
			fulltext(content),
			route varchar(140),
			published int(1) not null default 0,
			unique `doctype_name` (doctype, name))
			COLLATE=utf8mb4_unicode_ci
			ENGINE=MyISAM
			CHARACTER SET=utf8mb4''')

def reset():
	'''Deletes all data in __global_search'''
	frappe.db.sql('delete from __global_search')

def get_doctypes_with_global_search(with_child_tables=True):
	'''Return doctypes with global search fields'''
	def _get():
		global_search_doctypes = []
		filters = {}
		if not with_child_tables:
			filters = {"istable": ["!=", 1]}
		for d in frappe.get_all('DocType', fields=['name', 'module'], filters=filters):
			meta = frappe.get_meta(d.name)
			if len(meta.get_global_search_fields()) > 0:
				global_search_doctypes.append(d)<commit_msg>Ignore single doctypes for global search<commit_after># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt

from __future__ import unicode_literals

import frappe
import re
from frappe.utils import cint, strip_html_tags
from frappe.model.base_document import get_controller

def setup_global_search_table():
	'''Creates __global_seach table'''
	if not '__global_search' in frappe.db.get_tables():
		frappe.db.sql('''create table __global_search(
			doctype varchar(100),
			name varchar(140),
			title varchar(140),
			content text,
			fulltext(content),
			route varchar(140),
			published int(1) not null default 0,
			unique `doctype_name` (doctype, name))
			COLLATE=utf8mb4_unicode_ci
			ENGINE=MyISAM
			CHARACTER SET=utf8mb4''')

def reset():
	'''Deletes all data in __global_search'''
	frappe.db.sql('delete from __global_search')

def get_doctypes_with_global_search(with_child_tables=True):
	'''Return doctypes with global search fields'''
	def _get():
		global_search_doctypes = []
		filters = {}
		if not with_child_tables:
			filters = {"istable": ["!=", 1], "issingle": ["!=", 1]}
		for d in frappe.get_all('DocType', fields=['name', 'module'], filters=filters):
			meta = frappe.get_meta(d.name)
			if len(meta.get_global_search_fields()) > 0:
				global_search_doctypes.append(d)
{'fraction_non_alphanumeric': 0.1171875, 'fraction_numerical': 0.018973214285714284, 'mean_word_length': 5.356973995271868, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 5, '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': '7531342', 'n_tokens_mistral': 1026, 'n_tokens_neox': 922, 'n_words': 234}