What's the best Django search app? [closed]

I'm building a Django project that needs search functionality, and until there's a django.contrib.search, I have to choose a search app. So, which is the best? By "best" I mean...

  • easy to install / set up
  • has a Django- or at least Python-friendly API
  • can perform reasonably complex searches

Here are some apps I've heard of, please suggest others if you know of any:

I'd also like to avoid using a third-party search engine (like Google SiteSearch), because some of the data I'd like to index is for site members only and should not be public.

Asked by: Chelsea422 | Posted: 28-01-2022

Answer 1

Check out Haystack Search - a new model based search abstraction layer that currently supports Xapian, Solr and Whoosh. Looks like it's well supported and documented.

Answered by: Emma964 | Posted: 01-03-2022

Answer 2

Justin, I'd try djangosearch first: Jacob Kaplan-Moss (Django's lead developer) is working on it.

Potential hazards:

  • The home page warns the API might not be entirely stable

Potential benefits:

  • β€œThe long term goal is for this to become django.contrib.search.”

Answered by: Marcus592 | Posted: 01-03-2022

Answer 3

I am searching for the same thing, as are a lot of other people. Let's hope that django.contrib.search will be added soon.

In the meantime, this is what I found:

To me, most look quite complicated and, frankly, a little daunting to implement. I'd be interested to learn what you think of these.

Answered by: Fiona388 | Posted: 01-03-2022

Answer 4

The google code page for djangosearch indicates that it is no longer under active development, and suggests haystack or solango.

Answered by: Brooke195 | Posted: 01-03-2022

Answer 5

I'd recommend Sphinx for full-text search and aggregation, and django-sphinx is good enough for production use. We found that Sphinx was the least resource-intensive and fastest way to index and search our documents and that django-sphinx was a nice wrapper on top of the sphinx client.

The group by aggregation is particularly nice, if for example you want to display how many documents with a certain tag or by a certain author (or both) matched a search. In memory attribute updates were convenient too, especially for removing deleted articles immediately.

Answered by: Blake892 | Posted: 01-03-2022

Answer 6

Thanks Garth. I had seen that djangosearch wanted to become the official Django search, but I was hesitant to use it because I couldn't find any documentation! Luckily, there's a README in subversion that I hadn't seen before, and it makes the API look very cool:

# set up the model
class Event(models.Model):
    title = models.CharField(max_length=255)
    date = models.DateField()
    is_outdoors = models.BooleanField()

    index = djangosearch.ModelIndex(text=['title'], 
                                    additional=['date', 'is_outdoors'])

# run a search
results = Event.index.search("django conference")

Answered by: Fiona321 | Posted: 01-03-2022

Answer 7

I just needed a very quick solution that was no-fuss for an internal app.

I found the article Adding search to Django in a snap, and that worked splendid for me!

Obviously it lacks the speed, scalability and features of the real projects like Haystack, but this one is easier to set up, and I don't really need anything else than keyword AND-search.

Answered by: Wilson168 | Posted: 01-03-2022

Answer 8

You might want to consider letting Yahoo do all the hard work with their Build your own Search Service (BOSS). Here is a great blog post that walks you through the process: http://www.peterkrantz.com/2008/yahoo-search-in-django/

Answered by: Emily834 | Posted: 01-03-2022

Answer 9

It looks like everyone here missed django-xappy

After quick evaluation of all existing search addons for Django, I found this one as most flexible and easiest to use. It's rough on the edges in few places, but it's still the best way to use power of Xapian search engine inside Django projects.

Answered by: Blake836 | Posted: 01-03-2022

Answer 10

You might want to look at Django Solr search (aka "Solango") which comes with some nice documentation to get you started...

Answered by: Owen664 | Posted: 01-03-2022

Answer 11

If you have large amount of data to be indexed or you expect high traffic, I'd suggest using some external search engine, like Solr. This way, you'll keep shared-nothing approach and be able to scale your site components independently.

Answered by: William113 | Posted: 01-03-2022

Answer 12

I think I am going to have to give a shout out to Djapian.

It is rock-solid...just pull down a source distribution and peek inside. Top notch code, not very many comments tho..

It's still a young software project, but I think the django community should throw it's weight behind this one.

Answered by: Audrey758 | Posted: 01-03-2022

Answer 13

Thanks Joe,

We decided to go with Tsearch2 and a custom postgres adaptor. Tsearch2 does not need an extra process to run, which was convenient since we are on a WebFaction hosting with limited memory... It's not completely done yet, but seems to be a good solution...

Answered by: Kelvin864 | Posted: 01-03-2022

Answer 14

I found Djoosh which relies on the pure-python external search engine Whoosh to work well with my 'Python' brain.

Answered by: Alfred782 | Posted: 01-03-2022

Answer 15

If you are willing to use a 3rd party search engine I can recommend Yahoo BOSS and django-bosssearch.

Yahoo BOSS is a paid service, but it saves you setting up and maintaining other search software on your server.

Answered by: Maria565 | Posted: 01-03-2022

Similar questions

python - What's the best django way to do a query that spans several tables?

I have a reviews/ratings web application, a la Digg. My django app content has the following model: class Content(models.Model): title = models.CharField(max_length=128) url = models.URLField(max_length=2048) description = models.TextField(blank=True) class Recommendation(models.Model): user = models.ForeignKey(User) content = models.ForeignKey(Content) review = models....

python - What's wrong with my django URL?

line from urls.py: url(r'^(?P<customer_profile_id>\d+)/case/(?P<account_type>\w+)/$', view='case', name='case'), line from html: <form method="POST" action="{% url 'case/cash/' %}" id="create_collection_case" target="_blank"> error: NoReverseMatch at /admin/customers/1/ Reverse for 'case/cash/' with arguments '()' and ke...

Python Eval: What's wrong with this code?

I'm trying to write a very simple Python utility for personal use that counts the number of lines in a text file for which a predicate specified at the command line is true. Here's the code: import sys pred = sys.argv[2] if sys.argv[1] == "stdin" : handle = sys.stdin else : handle = open(sys.argv[1]) result = 0 for line in handle : eval('result += 1 if ' + pred + ' else 0') print result

python - How do I know what's the realm and uri of a site

I want to use python's urllib2 with authentication and I need the realm and uri of a url. How do I get it? thanks

python - What's the best tool to parse log files?

Closed. This question does not meet Stack Overflow guid...

python - What's the best django way to do a query that spans several tables?

I have a reviews/ratings web application, a la Digg. My django app content has the following model: class Content(models.Model): title = models.CharField(max_length=128) url = models.URLField(max_length=2048) description = models.TextField(blank=True) class Recommendation(models.Model): user = models.ForeignKey(User) content = models.ForeignKey(Content) review = models....

python - What's the best way to dump a MYSQL table to CSV?

This question already has answers here:

python - What's wrong with this code?

python - What's a good name for this kind of object?

I have an associative array of element IDs to counts of each element. e.g. (in python): myObject = { 'a': 5, 'b': 3 } It should support addition and subtraction. For example: myObject - { 'a': 3 } Should evaluate to: { 'a': 2, 'b': 3 } For context, this is supporting a costs system. Each element is a resource type, and the...

python - What's wrong with my PCA?

My code: from numpy import * def pca(orig_data): data = array(orig_data) data = (data - data.mean(axis=0)) / data.std(axis=0) u, s, v = linalg.svd(data) print s #should be s**2 instead! print v def load_iris(path): lines = [] with open(path) as input_file: lines = input_file.readlines() data = [] for line in lines: cur_line = line.rstrip().split(',') ...

python - What's better to use for Django?

python - What's wrong with this url?

I have a root urls.py and an app urls.py. In my root I have this: from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^$', include('realestate.properties.urls')), (r'^admin/', include(admin.site.urls)), ) In my app urls I have the following from django.conf.urls.defaults import * urlpatterns ...

How can I use a DLL file from Python?

What is the easiest way to use a DLL file from within Python? Specifically, how can this be done without writing any additional wrapper C++ code to expose the functionality to Python? Native Python functionality is strongly preferred over using a third-party library.

python - PubSub lib for c#

Is there a c# library which provides similar functionality to the Python PubSub library? I think it's kind of an Observer Pattern which allows me to subscribe for messages of a given topic instead of using events.

python - What is the best way to copy a list?

This question already has answers here:

python - Possible Google Riddle?

My friend was given this free google website optimizer tshirt and came to me to try and figure out what the front logo meant. t-shirt So, I have a couple of guesses as to what it means, but I was just wondering if there is something more. My first guess is that eac...

How do you check whether a python method is bound or not?

Given a reference to a method, is there a way to check whether the method is bound to an object or not? Can you also access the instance that it's bound to?

ssh - How to scp in Python?

What's the most pythonic way to scp a file in Python? The only route I'm aware of is os.system('scp "%s" "%s:%s"' % (localfile, remotehost, remotefile) ) which is a hack, and which doesn't work outside Linux-like systems, and which needs help from the Pexpect module to avoid password prompts unless you already have passwordless SSH set up to the remote host. I'm aware of Twisted'...

python - How do I create a new signal in pygtk

I've created a python object, but I want to send signals on it. I made it inherit from gobject.GObject, but there doesn't seem to be any way to create a new signal on my object.

python - What do I need to import to gain access to my models?

I'd like to run a script to populate my database. I'd like to access it through the Django database API. The only problem is that I don't know what I would need to import to gain access to this. How can this be achieved?

python - How do I edit and delete data in Django?

I am using django 1.0 and I have created my models using the example in the Django book. I am able to perform the basic function of adding data; now I need a way of retrieving that data, loading it into a form (change_form?! or something), EDIT it and save it back to the DB. Secondly how do I DELETE the data that's in the DB? i.e. search, select and then delete! Please show me an example of the code ...

python - How do I turn an RSS feed back into RSS?

According to the feedparser documentation, I can turn an RSS feed into a parsed object like this: import feedparser d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml') but I can't find anything showing how to go the other way; I'd like to be able do manipulate 'd' and then output the result as XM...

Still can't find your answer? Check out these communities...

PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python