djangosnippets.org: Latest snippets tagged with 'search'http://djangosnippets.org/tags/search/2013-11-24T14:47:30.132742-06:00regex search in admin forms
2013-11-24T14:47:30.132742-06:00mbeehttp://djangosnippets.org/snippets/3005/<p>Despite warning coming from django developers, I'm still using admin classes to quickly get into reverse engineering databases.</p>
<p>One feature is missing: searching into fields thanks to a regex.</p>
<p>One dirty solution I found is to overwrite get_search_results. But most of the code comes from django itself.</p>
<p>If anyone has …</p>
Freely redistributableSearchableManager
2010-03-07T08:30:59.342047-06:00stephen_mcdhttp://djangosnippets.org/snippets/1953/<p>A drop-in chainable manager for providing models with basic search features such as +/- modifiers, quoted exact phrases and ordering by relevance.
</p>
Freely redistributableFormat Haystack's result with a sprat template
2009-06-23T16:19:39.097976-05:00myleshttp://djangosnippets.org/snippets/1589/Freely redistributableFull-Text Searchable Models
2009-02-18T22:32:18.532358-06:00dcwatsonhttp://djangosnippets.org/snippets/1328/<p>A drop-in module to allow for full-text searchable models with very little effort. Tested with PostgreSQL 8.3, but should work on earlier versions with the tsearch2 module installed.</p>
Freely redistributablePing All Search Engines
2009-02-04T01:15:19.201384-06:00amccloudhttp://djangosnippets.org/snippets/1308/<p>Nothing much to see here. Needed this little puppy for work and figured I and others will need it for other projects. Enjoy!</p>
Freely redistributabledjango simple search
2008-11-22T20:36:32.126748-06:00mkearlhttp://djangosnippets.org/snippets/1211/<p>simple search with Q object you just pass a list of fields and the search string then it will come up with a object to use in a filter. This snippet is thanks to Julien Phalip
at <a href="http://www.julienphalip.com/blog/2008/08/16/adding-search-django-site-snap/">julienphalip.com</a></p>
Freely redistributableSearch Docs with Shortwave
2008-07-08T11:00:03.698681-05:00baumer1122http://djangosnippets.org/snippets/862/<p>.</p>
<p>.</p>
<p>For use with <a href="http://shortwaveapp.com/">Shortwave</a>. Add this to your hosted <code>wave.txt</code> for a search of the current Django docs.</p>
Freely redistributableoracle 10g fulltext search & patch nclob field limitations
2008-04-05T02:59:10.828795-05:00ageldamahttp://djangosnippets.org/snippets/685/<p>save as some module,
import then, call 'patch()' in somewhere suchs urls.py...</p>
Freely redistributableTags & filters for rendering search results
2008-03-23T22:42:20.823044-05:00exogenhttp://djangosnippets.org/snippets/661/<p>Use these tags and filter when you're rolling your own search results. This is intended to be a whole templatetags module. I keep it in my apps as <code>templatetags/search.py</code>. These should not be used to perform search queries, but rather render the results.</p>
<h3>Basics</h3>
<p>There are three functions, each …</p>
Freely redistributableSearchable Media
2008-03-21T15:51:14.459346-05:00nikolajhttp://djangosnippets.org/snippets/652/<p>This app allows you to utilize mysql's fulltext searching over multiple models and multiple apps, letting the site search seem more intuitive, yet still allow your content to be very structured. Essentially, it creates an entire new model that associates objects to a chunk of text to search efficiently over …</p>
Freely redistributableSearch djangosnippets.org
2008-02-20T09:17:41.111005-06:00henninghttp://djangosnippets.org/snippets/608/<p>I was tired browsing via tag to find snippets I saw a while ago. So I created a custom search engine with Google. </p>
<p>To try it out go to <a href="http://henning.cco-ev.de/django/djangosnippets.html">http://henning.cco-ev.de/django/djangosnippets.html</a></p>
Freely redistributablefilter/search a newforms select widget
2007-09-18T16:47:27.821182-05:00miracle2khttp://djangosnippets.org/snippets/422/<p>Adds a filter input above a select widget that allows live-filtering on the client-side (no ajax) in Firefox.</p>
<p>Example:</p>
<p>make_fields_searchable(ModelItemForm, {
'publisher': {'set_size': 8}, 'developer': {'set_size': 8}, 'genre': {}, 'platform': {}
})</p>
Freely redistributableSphinx Search ORM / Revised
2007-08-06T17:27:23.297747-05:00ludohttp://djangosnippets.org/snippets/357/<p>A revised version of <a href="http://www.djangosnippets.org/snippets/231/">zeeg's Sphinx Search ORM</a>, using my Sphinx client and adding support for Sphinx's excerpt generator. It's still missing support for search modes/order_by/filter/exclude, but it should be easy and I will add the relevant methods soon as I need them.</p>
<p>Usage is the same as zeeg's …</p>
Freely redistributableSphinx Search ORM
2007-05-11T18:05:10.520888-05:00zeeghttp://djangosnippets.org/snippets/231/<p>An ORM model for the Sphinx full-text search engine.</p>
<p>See http://www.sphinxsearch.com/ for more information.</p>
<p>It currently supports the following:</p>
<pre><code>class MyModel(models.Model):
search = SphinxSearch()
MyModel.search.query('query')
MyModel.search.query('query').order_by('@weight', '@id', 'my_attribute')
MyModel.search.query('query').filter(my_attribute=5)
MyModel.search.query('query').filter(my_other_attribute=[5, 3,4])
MyModel.search.query('query').exclude(my_attribute=5)[0:10]
MyModel.search.query('query').count()
SphinxSearch().query('hello').on_index('model_myapp model_myotherapp')
</code></pre>
<p>Returns an ordered list of the objects in your database.</p>
<p>-- Update:</p>
<p>New Methods:</p>
<ul>
<li>count() …</li></ul>
Freely redistributableSearch results pagination
2007-03-31T10:34:28.977703-05:00polarbearhttp://djangosnippets.org/snippets/149/<p><strong>Problem</strong>:
</p>
<p>You search by firing POST and paginate by firing GET, so search results disappear on GET. I want to preserve searching results, so user can paginate them.
</p>
<p>First I try to use some static class to keep search results, but this solution has bug (thanks to svetlyak). In …</p>
Freely redistributable