def search(self, q=None, history=None, search_comments=None, project=None, limit=None, page=0, **kw): c.search_results = W.search_results c.help_modal = W.help_modal search_params = kw search_params.update({ 'q': q or '', 'history': history, 'search_comments': search_comments, 'project': project, 'limit': limit, 'page': page, 'allowed_types': ['Blog Post', 'Blog Post Snapshot'], 'fq': ['state_s:published'] }) return search_app(**search_params)
def search(self, q=None, history=None, project=None, limit=None, page=0, **kw): c.search_results = self.W.search_results c.help_modal = self.W.search_help search_params = kw search_params.update({ 'q': q or '', 'history': history, 'project': project, 'limit': limit, 'page': page, 'allowed_types': ['Post', 'Post Snapshot', 'Discussion', 'Thread'], }) d = search_app(**search_params) d['search_comments_disable'] = True return d
def search(self, q=None, history=None, search_comments=None, project=None, limit=None, page=0, **kw): 'local wiki search' c.search_results = W.search_results c.help_modal = W.help_modal search_params = kw search_params.update({ 'q': q or '', 'history': history, 'search_comments': search_comments, 'project': project, 'limit': limit, 'page': page, 'allowed_types': ['WikiPage', 'WikiPage Snapshot'], }) return search_app(**search_params)
def index(self, q=None, history=False, **kw): c.search_results = W.search_results search_params = kw search_params.update({ 'q': q, 'history': history, 'app': False, }) d = search_app(**search_params) d['search_comments_disable'] = True d['hide_app_project_switcher'] = True return d
def index(self, q=None, history=None, **kw): c.search_results = SearchResults() c.help_modal = SearchHelp(comments=False) pids = [c.project._id] + [p._id for p in c.project.subprojects] project_match = " OR ".join("project_id_s:%s" % pid for pid in pids) search_params = kw search_params.update( {"q": q, "history": history, "app": False, "fq": ["project_id_s:(%s)" % project_match, "-deleted_b:true"]} ) d = search_app(**search_params) d["search_comments_disable"] = True d["hide_app_project_switcher"] = True return d
def search(self, q=None, project=None, limit=None, page=0, **kw): c.search_results = W.search_results c.help_modal = W.search_help search_params = kw search_params.update( {"q": q or "", "project": project, "limit": limit, "page": page, "allowed_types": ["ShortUrl"]} ) if not has_access(c.app, "view_private"): search_params["fq"] = ["private_b:False"] d = search_app(**search_params) d["search_comments_disable"] = True d["search_history_disable"] = True d["url_len"] = len(ShortUrl.build_short_url(c.app, short_name="")) return d
def test_escape_solr_text(self, req, url_fn, solr_search): req.GET = dict() req.path = '/test/wiki/search' url_fn.side_effect = ['the-score-url', 'the-date-url'] results = mock.Mock(hits=2, docs=[ {'id': 123, 'type_s': 'WikiPage Snapshot', 'url_s': '/test/wiki/Foo', 'version_i': 2}, {'id': 321, 'type_s': 'Post'}, ], highlighting={ 123: dict( title='some #ALLURA-HIGHLIGHT-START#Foo#ALLURA-HIGHLIGHT-END# stuff', text='scary <script>alert(1)</script> bar'), 321: dict(title='blah blah', text='less scary but still dangerous <script>alert(1)</script> ' 'blah #ALLURA-HIGHLIGHT-START#bar#ALLURA-HIGHLIGHT-END# foo foo'), }, ) results.__iter__ = lambda self: iter(results.docs) solr_search.return_value = results with h.push_context('test', 'wiki', neighborhood='Projects'): resp = search_app(q='foo bar') assert_equal(resp, dict( q='foo bar', history=None, count=2, limit=25, page=0, search_error=None, sort_score_url='the-score-url', sort_date_url='the-date-url', sort_field='score', results=[{ 'id': 123, 'type_s': 'WikiPage Snapshot', 'version_i': 2, 'url_s': '/test/wiki/Foo?version=2', # highlighting works 'title_match': Markup('some <strong>Foo</strong> stuff'), # HTML in the solr plaintext results get escaped 'text_match': Markup('scary <script>alert(1)</script> bar'), }, { 'id': 321, 'type_s': 'Post', 'title_match': Markup('blah blah'), # highlighting in text 'text_match': Markup('less scary but still dangerous &lt;script&gt;alert(1)&lt;/script&gt; blah <strong>bar</strong> foo foo'), }] ))
def search(self, q=None, project=None, limit=None, page=0, **kw): c.search_results = SearchResults() c.help_modal = SearchHelp(comments=False, history=False) search_params = kw search_params.update({ 'q': q or '', 'project': project, 'limit': limit, 'page': page, 'allowed_types': ['Chat Message'], }) d = search_app(**search_params) d['search_comments_disable'] = True d['search_history_disable'] = True return d
def search(self, q=None, project=None, limit=None, page=0, **kw): c.search_results = W.search_results c.help_modal = W.search_help search_params = kw search_params.update({ 'q': q or '', 'project': project, 'limit': limit, 'page': page, 'allowed_types': ['ShortUrl'], }) if not has_access(c.app, 'view_private'): search_params['fq'] = ['private_b:False'] d = search_app(**search_params) d['search_comments_disable'] = True d['search_history_disable'] = True return d
def search(self, q=None, history=None, search_comments=None, project=None, limit=None, page=0, **kw): c.search_results = W.search_results c.help_modal = W.help_modal search_params = kw search_params.update( { "q": q or "", "history": history, "search_comments": search_comments, "project": project, "limit": limit, "page": page, "allowed_types": ["Blog Post", "Blog Post Snapshot"], "fq": ["state_s:published"], } ) return search_app(**search_params)
def test_basic(self, req, url_fn): req.GET = dict() req.path = '/test/search' url_fn.side_effect = ['the-score-url', 'the-date-url'] with h.push_context('test', 'wiki', neighborhood='Projects'): resp = search_app(q='foo bar') assert_equal(resp, dict( q='foo bar', history=None, results=[], count=0, limit=25, page=0, search_error=None, sort_score_url='the-score-url', sort_date_url='the-date-url', sort_field='score', ))
def index(self, q=None, history=None, **kw): c.search_results = SearchResults() c.help_modal = SearchHelp(comments=False) pids = [c.project._id] + [ p._id for p in c.project.subprojects ] project_match = ' OR '.join( 'project_id_s:%s' % pid for pid in pids ) search_params = kw search_params.update({ 'q': q, 'history': history, 'app': False, 'fq': [ 'project_id_s:(%s)' % project_match, '-deleted_b:true', ], }) d = search_app(**search_params) d['search_comments_disable'] = True d['hide_app_project_switcher'] = True return d
def index(self, q=None, history=None, **kw): c.search_results = SearchResults() c.help_modal = SearchHelp(comments=False) pids = [c.project._id] + [p._id for p in c.project.subprojects] project_match = ' OR '.join(map(str, pids)) search_params = kw search_params.update({ 'q': q, 'history': history, 'app': False, 'fq': [ 'project_id_s:(%s)' % project_match, '-deleted_b:true', ], }) d = search_app(**search_params) d['search_comments_disable'] = True d['hide_app_project_switcher'] = True return d