Good luck with the project!

Has something been decided on using db backend full text search
facilities as a convenient start?

The point is that indexers are overkill for smaller projects and they
may not be available in constrained environments (e.g. shared
hosting). In this case it should be easy to get going with db-based
full text search backend and later migrate to a real indexer only by
modifying settings to activate a different backend, having zero impact
on the code otherwise.

Also, the API should be discussed. I haven't looked into the existing
djangosearch API (thus I have an untainted view on things :) ), but
I'd propose something in the lines of the following:

models.py:

from django.contrib import search

class Foo(models.Model)
    foo = models.TextField()
    bar = models.CharField()
    baz = models.TextField()
    def get_absolute_url(self):
        ...

class FooSearch(search.ModelSearch):
   fields = ('foo', 'bar')

search.register(Foo, FooSearch)
# or to index all text/char fields:
# search.register(Foo)

views.py:
from django.contrib.search import search_all, search_model
from models import Foo

# search for matches in all models that define searchable fields
def search_all(request):
   query = request.GET["q"]
   return render_to_response("search.html", { 'results' :
search_all(query) })

# search for matches in a particular model that defines
# searchable fields
def search_foo(request):
   query = request.GET["q"]
   return render_to_response("search.html", { 'results' :
search_model(Foo, query) })

search.html:
<ul>
{% for result in results %}
  <li><a href="{{ result.get_absolute_url }}">{{ result }}</a></li>
{% endfor %}
</ul>

Best,
Mart Sõmermaa

On May 4, 4:24 am, "Leo Soto M." <[EMAIL PROTECTED]> wrote:
> On Sat, May 3, 2008 at 5:33 PM, Ben Firshman <[EMAIL PROTECTED]> wrote:
>
> >  Hello all!
>
> >  A quick introduction: I have been accepted to the GSoC to work on
> >  Django. I will be working on the djangosearch app 
> > (http://code.google.com/p/djangosearch/
> >  ), in particular adding support for addition search backends, mentored
> >  by Joseph Kocherhans.
>
> >  I will spend time getting Lucene and Xapian working well, and I have
> >  an interest in getting Sphinx working too. The app is lacking
> >  particularly in documentation, something I hope I can work on too.
>
> Ben, that's pretty cool!
>
> I'm specially interested in your work with Lucene, because it should
> be easily adaptable to work on Jython, and Django on Jython is my SoC
> project :).
>
> Will you post status reports to this list once you get started? I'd
> like to follow your progress and try to coordinate something once I
> get the core Django working flawlessly on Jython.
>
> --
> Leo Soto M.http://blog.leosoto.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to