def update(self): section = get_section_name() base_url = abs_url(getSite(), self.request) if not section: section = 'business' self.action = urljoin(base_url, section) + '/search'
def _searchresults(self): section = get_section_name() subqueries = [] type_filter = "" if IAlchemistContainer.providedBy(self.context): for t in ALLOWED_TYPES["business"]: iface = resolve.resolve("bungeni.models.interfaces.I%sContainer"%t) if iface.providedBy(self.context): type_filter = t break if type_filter: type_query = self.searcher.query_field('object_type', type_filter) else: # Filter items allowed in current section for tq in ALLOWED_TYPES[section]: subqueries.append(self.searcher.query_field('object_type', tq)) type_query = self.searcher.query_composite(self.searcher.OP_OR, subqueries) self.query = self.searcher.query_composite(self.searcher.OP_AND, (self.query, type_query,)) try: results = self.searcher.search(self.query, 0, self.searcher.get_doccount()) except: results = [] results = filter(self.authorized, results) return results
def _searchresults(self): section = get_section_name() subqueries = [] # Filter items allowed in current section for tq in ALLOWED_TYPES[section]: subqueries.append(self.searcher.query_field('object_type', tq)) type_query = self.searcher.query_composite(self.searcher.OP_OR, subqueries) self.query = self.searcher.query_composite(self.searcher.OP_AND, \ (self.query, type_query,)) try: results = self.searcher.search(self.query, 0, self.searcher.get_doccount()) except: results = [] results = filter(self.authorized, results) # in workspace section we are using different search filters based on states if section == 'workspace': extra = self.workspace_search() # if no results - use common search if extra: return extra return results
def update(self): section = get_section_name() base_url = abs_url(getSite(), self.request) subsection = "" if not section: section = "business" if section == "business": subsection = get_subsection_name(self.request) if subsection in ALLOWED_SEARCH_SUBSECTIONS: subsection = "/" + subsection else: subsection = "" self.action = urljoin(base_url, section) + subsection + "/search"
def _searchresults(self): section = get_section_name() subqueries = [] # Filter items allowed in current section for tq in ALLOWED_TYPES[section]: subqueries.append(self.searcher.query_field('object_type', tq)) type_query = self.searcher.query_composite(self.searcher.OP_OR, subqueries) self.query = self.searcher.query_composite(self.searcher.OP_AND, \ (self.query, type_query,)) try: results = self.searcher.search(self.query, 0, self.searcher.get_doccount()) except: results = [] results = filter(self.authorized, results) return results
def advanced_search_url(self): base_url = absoluteURL(getSite(), self.request) section = get_section_name() return urljoin(base_url, section) + "/advanced-search"