Django-sphinx DOC ID, different column

2010-08-18 Thread Lukáš
Hey,

I use sphinx on regular basis with PHP and now I wanted to implement
it to my Django project. Everything went smoothly, but when I tried my
first search, I got an error.

Exception Value:'Product' object has no attribute 'id'
Exception Location: D:\dev\Python25\Lib\site-packages\djangosphinx
\__init__.py in _get_results, line 427
.
D:\dev\Python25\Lib\site-packages\djangosphinx\__init__.py in
_get_results
427. queryset = dict([(o.id, o) for o in qs])

As far I know it tries to use ID as DOC ID, but since I have built
this project on an existing database I use different columns as
primary keys. In this particular case product_id. And I have never run
into this problem with PHP and I used sphinx with multiple databases.
I didnt find anything closely related to this problem, since they all
use ID in all articles about it and I cant even find a proper
documentation to django-sphinx. I dont know... maybe I just dumb lol

So my question would be: How can I specify another column as DOC id in
django-sphinx?

Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx or haystack Xapian

2010-06-24 Thread euan.godd...@googlemail.com
We are in the process of switching from a custom Xapain installation
to Solr as we found Xapian quite limited in its ability to do
faceting, spelling suggestions, or highlighting. If you don't need any
of those things, I would recommend Xapian (although I've not used it
through Haystack). I have used Haystack with Whoosh and agree that
Whoosh needs a fair bit of work yet. That said I do like the haystack
idea.

Solr is really good for what we want and is really powerful, but we
have had to allocate it 1.5GB of memory for reindexing!

I have no experience of sphinx, but from what people have said above
it seems like a good solution.

Euan

On Jun 24, 9:15 am, Dmitry Dulepov  wrote:
> Hi!
>
> zweb wrote:
> > 2) Sphinx  has slow index update.  Updating index takes as much time
> > as building a new one.
>
> I have a Sphinx indexed form with 2 million posts. Indexing takes mess than
> 2 minutes. Is that considered slow? I use full rebuild of the index even 10
> minutes. Incremental reindexing is much faster but crashes from time to
> time. Still I do not consider 2 minutes to be slow. There are much slower
> insexing search engines around.
>
> I chose Sphinx exactly because of its indexing and search speed. Docs say
> that indexing is slow but I came from search engines that used hours to
> index my forums. 2 minutes of Sphinx indexing is just nothing compared to
> others.
>
> --
> Dmitry Dulepov
> Twitter:http://twitter.com/dmitryd/
> Web:http://dmitry-dulepov.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx or haystack Xapian

2010-06-24 Thread Dmitry Dulepov
Hi!

zweb wrote:
> 2) Sphinx  has slow index update.  Updating index takes as much time
> as building a new one.

I have a Sphinx indexed form with 2 million posts. Indexing takes mess than
2 minutes. Is that considered slow? I use full rebuild of the index even 10
minutes. Incremental reindexing is much faster but crashes from time to
time. Still I do not consider 2 minutes to be slow. There are much slower
insexing search engines around.

I chose Sphinx exactly because of its indexing and search speed. Docs say
that indexing is slow but I came from search engines that used hours to
index my forums. 2 minutes of Sphinx indexing is just nothing compared to
others.

-- 
Dmitry Dulepov
Twitter: http://twitter.com/dmitryd/
Web: http://dmitry-dulepov.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Real time search using Django Sphinx or haystack Xapian

2010-06-19 Thread zweb
" I'm storing a copy of the
searchable text in a MyISAM table and using the MySQL search on it."


I need to search results to be immediately available as soon as they
are updated in DB.
This will require me to update the index in real time which is not
very efficient.

Haystack does provide real time index update. Has anyone used it.

http://docs.haystacksearch.org/dev/searchindex_api.html#keeping-the-index-fresh

other than that I have two other options:
1) Search db for data updated after the last search index update date
and time and then show results from both Db and search engine. Risk is
search index result could return stale data or I might get duplicates.
2) Use an appoach like yours - " copy of the
searchable text in a MyISAM table and using the MySQL search on it."



On Jun 19, 10:54 am, Nick Arnett <nick.arn...@gmail.com> wrote:
> On Sat, Jun 19, 2010 at 9:21 AM, zweb <traderash...@gmail.com> wrote:
>
> > (Mysql text search will not work as I use INNODB. Solr is powerful but
> > I heard it is very memory hungry and it is in Java. Whoosh is not yet
> > as mature as others. So that leaves choice between Django Sphinx and
> > Haystack Xapian.)
>
> I meant to mention that although I'm using InnoDB, I'm storing a copy of the
> searchable text in a MyISAM table and using the MySQL search on it.  That's
> okay for now, but I'm looking for clustering, faceted search and other fancy
> stuff.
>
> I've worked in search-related technology for a long time and I should know
> that search performance always demands lots of memory...  So I may bite the
> bullet and use Solr, after all.  I just wish there were a way to trade off
> the memory for speed until I'm ready to deploy a real working version.
>
> Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx or haystack Xapian

2010-06-19 Thread zweb
 I am tilting towards Haystack Xapian solution over django sphinx
mainly for two reasons
1) Haystack supports  - Solr, Xapian and Whoosh. So in future I can
easily migrate  from Xapian to Solr as my need grows.
2) Sphinx  has slow index update.  Updating index takes as much time
as building a new one.


My views are based on quick reading of material and opinions on web
and not on my experience yet. Once I will try haystack xapian this
weekend and let you know.



On Jun 19, 10:54 am, Nick Arnett <nick.arn...@gmail.com> wrote:
> On Sat, Jun 19, 2010 at 9:21 AM, zweb <traderash...@gmail.com> wrote:
>
> > (Mysql text search will not work as I use INNODB. Solr is powerful but
> > I heard it is very memory hungry and it is in Java. Whoosh is not yet
> > as mature as others. So that leaves choice between Django Sphinx and
> > Haystack Xapian.)
>
> I meant to mention that although I'm using InnoDB, I'm storing a copy of the
> searchable text in a MyISAM table and using the MySQL search on it.  That's
> okay for now, but I'm looking for clustering, faceted search and other fancy
> stuff.
>
> I've worked in search-related technology for a long time and I should know
> that search performance always demands lots of memory...  So I may bite the
> bullet and use Solr, after all.  I just wish there were a way to trade off
> the memory for speed until I'm ready to deploy a real working version.
>
> Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx or haystack Xapian

2010-06-19 Thread Nick Arnett
On Sat, Jun 19, 2010 at 9:21 AM, zweb <traderash...@gmail.com> wrote:

>
> (Mysql text search will not work as I use INNODB. Solr is powerful but
> I heard it is very memory hungry and it is in Java. Whoosh is not yet
> as mature as others. So that leaves choice between Django Sphinx and
> Haystack Xapian.)


I meant to mention that although I'm using InnoDB, I'm storing a copy of the
searchable text in a MyISAM table and using the MySQL search on it.  That's
okay for now, but I'm looking for clustering, faceted search and other fancy
stuff.

I've worked in search-related technology for a long time and I should know
that search performance always demands lots of memory...  So I may bite the
bullet and use Solr, after all.  I just wish there were a way to trade off
the memory for speed until I'm ready to deploy a real working version.

Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx or haystack Xapian

2010-06-19 Thread Nick Arnett
On Sat, Jun 19, 2010 at 9:21 AM, zweb  wrote:

> I need to implement search solution over models in mysql.
>
> Anyone has experience with both or has gone through same decision
> making?
>
> What should I consider before choosing one or other?


I'm making a similar decision... as far as I can see, neither one does
search result clustering, which I'd like.  But the memory required to host
Solr means a big increase in hosting costs.  I'm using Webfaction, so to go
from their basic service to the one that offers 300 MB of memory is an
increase of about $25/month, which I'd rather not have to pay yet.

Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django Sphinx or haystack Xapian

2010-06-19 Thread zweb
I need to implement search solution over models in mysql.

Anyone has experience with both or has gone through same decision
making?

What should I consider before choosing one or other?

(Mysql text search will not work as I use INNODB. Solr is powerful but
I heard it is very memory hungry and it is in Java. Whoosh is not yet
as mature as others. So that leaves choice between Django Sphinx and
Haystack Xapian.)

thanks


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx Foreign key search

2010-06-18 Thread urukay

So, here is the solution that can help u. I will explain it using
these models:

class Model1(models.Model):
 text_field = 
 model_2 = models.ForeignKey('Model2')

class Model2(models.Model):
 model_3 = models.ForeignKey('Model3')

class Model3(models.Model):



Goal is to get only those objects of Model1 which have model_3
field ,in Model2, equal to number let's say 201 :-)

1. main point to do foreign key search is to edit sphinx.config int he
way Sphinx can find "it's way through our tables", to create the
appropriate relations
   - after creating sphinx.config file for Model1, you can see that
SQL_QUERY statement is:
 SELECT id, text_field, model_2_id from myApp.model1
   - we will edit this statement according the "columns logic"

2. let's edit sql_query in this way:
 SELECT myApp.model1.id as id, text_field, model_2_id,
myApp.model2.model_3_id as model_3_id from myApp.model1, myApp.model2
where myApp.model2.id = model_2_id
   - i've created relation between Model1 and Model2, so that Model2's
field model_2 is accessible through Model1

3. After creatin indexes you do searching Model2 through Model1:
Model1.search.all().filter(model_3_id=201)

I have tested this approach in my project and it works like a charm, i
can confirm that :-)
This way you can search multiple models in FK relation and to do
fulltext searching (not only id searching), just modify sql_query
accordingly.

Also great article can be found here:
http://www.marcofucci.com/tumblelog/31/aug/2009/django-sphinx-search-...
I've discussed this foreign key search with author of that article,
Marco Fucci, and he helped me really a lot to understand the way
Sphinx works.

Hope it helps.

Sorry for the delay, but i needed to finish adding google maps to my
project.

Radovan 

yafeng wu wrote:
> 
> Hi,
> 
> I got the same problem when building my website. Have you solved it?
> Please let me know.
> 
> Thanks,
> 
> On Apr 13, 4:04 am, urukay <radovan.be...@gmail.com> wrote:
>> Hi,
>>
>> I'm trying to create full text search on model, everything goes fine
>> when
>> searching TextFields but I have a problem with ForeignKey field.
>>
>> How can i do that? Can anyone point me to the right direction?
>>
>> Thanks
>>
>> Model example:
>>
>> class Model1(models.Model):
>>
>>      text_field =models.TextField(max_length=250)
>>      fek_field = models.ForeignKey('Model2')
>>
>> class Model2(models.Model):
>>      text_field = models.TextField(max_length=250)
>>
>> --
>> View this message in
>> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28219147p282...
>> Sent from the django-users mailing list archive at Nabble.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28228784p28931105.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Any Experiences with Sphinx Search and Django-sphinx?

2010-06-01 Thread zweb
I am looking to provide search. All content is in MYSQL DB in innodb
tables. That rules out Mysql full text search option, which would have
been my first choice.

Other option I am looking at it is Sphinx search with django-sphinx.
Any experiences with it good and bad?

Other thing I looked at is Haystack, but I do not want to run and
maintain Solr.  Xapien or Whoosh with Haystack is second choce after
Sphinx.

Any pros or cons I need to consider before making a decision?

I am looking for
1) Full Text search over MYSQL innodb tables ( which are all available
as Django Models)
2) Reasonably good performance
3) Low Maintenance
4) Low memory usage
5) Very reliable solution.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx Foreign key search

2010-05-22 Thread Allen Machary
search_string = req.REQUEST.get("search", "")

query = Model1.objects

if search_string == "":
query = query.all()
else:
query = query.filter(
   Q(text_field__icontains=search_string) |
   Q(fek_field__text_field__icontains=search_string))

the query variable will return the search results, searching the
text_field from model1 and then model2

On 5/22/10, urukay <radovan.be...@gmail.com> wrote:
>
> No that's not what i want..i want search model over another model.
>
>
>
> esatterwh...@wi.rr.com wrote:
>>
>> You probably want to use the indexer argument. It allows you to
>> specify which indexes you want sphinx to search over. Of course you
>> have to tell sphinx which indexes ( models ) you want it to search in.
>>
>> http://www.sphinxsearch.com/docs/current.html#ref-indexer
>>
>> On May 21, 8:47 am, urukay <radovan.be...@gmail.com> wrote:
>>> Well, still trying to solve it...maybe i found the right way to do it,
>>> but
>>> it's still in progress. If anything shows up, i'll keep you updated.
>>> Hopefully this during few days i'll solve it.
>>>
>>> Radovan
>>>
>>>
>>>
>>>
>>>
>>> yafeng wu wrote:
>>>
>>> > Hi,
>>>
>>> > I got the same problem when building my website. Have you solved it?
>>> > Please let me know.
>>>
>>> > Thanks,
>>>
>>> > On Apr 13, 4:04 am, urukay <radovan.be...@gmail.com> wrote:
>>> >> Hi,
>>>
>>> >> I'm trying to create full text search on model, everything goes fine
>>> >> when
>>> >> searching TextFields but I have a problem with ForeignKey field.
>>>
>>> >> How can i do that? Can anyone point me to the right direction?
>>>
>>> >> Thanks
>>>
>>> >> Model example:
>>>
>>> >> class Model1(models.Model):
>>>
>>> >>      text_field =models.TextField(max_length=250)
>>> >>      fek_field = models.ForeignKey('Model2')
>>>
>>> >> class Model2(models.Model):
>>> >>      text_field = models.TextField(max_length=250)
>>>
>>> >> --
>>> >> View this message in
>>> >>
>>> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28219147p282...
>>> >> Sent from the django-users mailing list archive at Nabble.com.
>>>
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Django users" group.
>>> > To post to this group, send email to django-us...@googlegroups.com.
>>> > To unsubscribe from this group, send email to
>>> > django-users+unsubscr...@googlegroups.com.
>>> > For more options, visit this group at
>>> >http://groups.google.com/group/django-users?hl=en.
>>>
>>> --
>>> View this message in
>>> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28228784p286...
>>> Sent from the django-users mailing list archive at Nabble.com.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group
>>> athttp://groups.google.com/group/django-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>>
>
> --
> View this message in context:
> http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28228784p28644474.html
> Sent from the django-users mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx Foreign key search

2010-05-22 Thread Allen Machary
search_string = req.REQUEST.get("search", "")

query = Model1.objects

if search_string == "":
query = query.all()
else:
query = query.filter(
   Q(text_field__icontains=search_string) |
   Q(fek_field__text_field__icontains=search_string))

the query variable will return the search results.

On 5/22/10, urukay <radovan.be...@gmail.com> wrote:
>
> No that's not what i want..i want search model over another model.
>
>
>
> esatterwh...@wi.rr.com wrote:
>>
>> You probably want to use the indexer argument. It allows you to
>> specify which indexes you want sphinx to search over. Of course you
>> have to tell sphinx which indexes ( models ) you want it to search in.
>>
>> http://www.sphinxsearch.com/docs/current.html#ref-indexer
>>
>> On May 21, 8:47 am, urukay <radovan.be...@gmail.com> wrote:
>>> Well, still trying to solve it...maybe i found the right way to do it,
>>> but
>>> it's still in progress. If anything shows up, i'll keep you updated.
>>> Hopefully this during few days i'll solve it.
>>>
>>> Radovan
>>>
>>>
>>>
>>>
>>>
>>> yafeng wu wrote:
>>>
>>> > Hi,
>>>
>>> > I got the same problem when building my website. Have you solved it?
>>> > Please let me know.
>>>
>>> > Thanks,
>>>
>>> > On Apr 13, 4:04 am, urukay <radovan.be...@gmail.com> wrote:
>>> >> Hi,
>>>
>>> >> I'm trying to create full text search on model, everything goes fine
>>> >> when
>>> >> searching TextFields but I have a problem with ForeignKey field.
>>>
>>> >> How can i do that? Can anyone point me to the right direction?
>>>
>>> >> Thanks
>>>
>>> >> Model example:
>>>
>>> >> class Model1(models.Model):
>>>
>>> >>      text_field =models.TextField(max_length=250)
>>> >>      fek_field = models.ForeignKey('Model2')
>>>
>>> >> class Model2(models.Model):
>>> >>      text_field = models.TextField(max_length=250)
>>>
>>> >> --
>>> >> View this message in
>>> >>
>>> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28219147p282...
>>> >> Sent from the django-users mailing list archive at Nabble.com.
>>>
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Django users" group.
>>> > To post to this group, send email to django-us...@googlegroups.com.
>>> > To unsubscribe from this group, send email to
>>> > django-users+unsubscr...@googlegroups.com.
>>> > For more options, visit this group at
>>> >http://groups.google.com/group/django-users?hl=en.
>>>
>>> --
>>> View this message in
>>> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28228784p286...
>>> Sent from the django-users mailing list archive at Nabble.com.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group
>>> athttp://groups.google.com/group/django-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>>
>
> --
> View this message in context:
> http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28228784p28644474.html
> Sent from the django-users mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx Foreign key search

2010-05-22 Thread urukay

No that's not what i want..i want search model over another model.



esatterwh...@wi.rr.com wrote:
> 
> You probably want to use the indexer argument. It allows you to
> specify which indexes you want sphinx to search over. Of course you
> have to tell sphinx which indexes ( models ) you want it to search in.
> 
> http://www.sphinxsearch.com/docs/current.html#ref-indexer
> 
> On May 21, 8:47 am, urukay <radovan.be...@gmail.com> wrote:
>> Well, still trying to solve it...maybe i found the right way to do it,
>> but
>> it's still in progress. If anything shows up, i'll keep you updated.
>> Hopefully this during few days i'll solve it.
>>
>> Radovan
>>
>>
>>
>>
>>
>> yafeng wu wrote:
>>
>> > Hi,
>>
>> > I got the same problem when building my website. Have you solved it?
>> > Please let me know.
>>
>> > Thanks,
>>
>> > On Apr 13, 4:04 am, urukay <radovan.be...@gmail.com> wrote:
>> >> Hi,
>>
>> >> I'm trying to create full text search on model, everything goes fine
>> >> when
>> >> searching TextFields but I have a problem with ForeignKey field.
>>
>> >> How can i do that? Can anyone point me to the right direction?
>>
>> >> Thanks
>>
>> >> Model example:
>>
>> >> class Model1(models.Model):
>>
>> >>      text_field =models.TextField(max_length=250)
>> >>      fek_field = models.ForeignKey('Model2')
>>
>> >> class Model2(models.Model):
>> >>      text_field = models.TextField(max_length=250)
>>
>> >> --
>> >> View this message in
>> >>
>> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28219147p282...
>> >> Sent from the django-users mailing list archive at Nabble.com.
>>
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> >http://groups.google.com/group/django-users?hl=en.
>>
>> --
>> View this message in
>> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28228784p286...
>> Sent from the django-users mailing list archive at Nabble.com.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group
>> athttp://groups.google.com/group/django-users?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28228784p28644474.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx Foreign key search

2010-05-22 Thread esatterwh...@wi.rr.com
You probably want to use the indexer argument. It allows you to
specify which indexes you want sphinx to search over. Of course you
have to tell sphinx which indexes ( models ) you want it to search in.

http://www.sphinxsearch.com/docs/current.html#ref-indexer

On May 21, 8:47 am, urukay <radovan.be...@gmail.com> wrote:
> Well, still trying to solve it...maybe i found the right way to do it, but
> it's still in progress. If anything shows up, i'll keep you updated.
> Hopefully this during few days i'll solve it.
>
> Radovan
>
>
>
>
>
> yafeng wu wrote:
>
> > Hi,
>
> > I got the same problem when building my website. Have you solved it?
> > Please let me know.
>
> > Thanks,
>
> > On Apr 13, 4:04 am, urukay <radovan.be...@gmail.com> wrote:
> >> Hi,
>
> >> I'm trying to create full text search on model, everything goes fine
> >> when
> >> searching TextFields but I have a problem with ForeignKey field.
>
> >> How can i do that? Can anyone point me to the right direction?
>
> >> Thanks
>
> >> Model example:
>
> >> class Model1(models.Model):
>
> >>      text_field =models.TextField(max_length=250)
> >>      fek_field = models.ForeignKey('Model2')
>
> >> class Model2(models.Model):
> >>      text_field = models.TextField(max_length=250)
>
> >> --
> >> View this message in
> >> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28219147p282...
> >> Sent from the django-users mailing list archive at Nabble.com.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> View this message in 
> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28228784p286...
> Sent from the django-users mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx Foreign key search

2010-05-21 Thread urukay

Well, still trying to solve it...maybe i found the right way to do it, but
it's still in progress. If anything shows up, i'll keep you updated.
Hopefully this during few days i'll solve it.

Radovan


yafeng wu wrote:
> 
> Hi,
> 
> I got the same problem when building my website. Have you solved it?
> Please let me know.
> 
> Thanks,
> 
> On Apr 13, 4:04 am, urukay <radovan.be...@gmail.com> wrote:
>> Hi,
>>
>> I'm trying to create full text search on model, everything goes fine
>> when
>> searching TextFields but I have a problem with ForeignKey field.
>>
>> How can i do that? Can anyone point me to the right direction?
>>
>> Thanks
>>
>> Model example:
>>
>> class Model1(models.Model):
>>
>>      text_field =models.TextField(max_length=250)
>>      fek_field = models.ForeignKey('Model2')
>>
>> class Model2(models.Model):
>>      text_field = models.TextField(max_length=250)
>>
>> --
>> View this message in
>> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28219147p282...
>> Sent from the django-users mailing list archive at Nabble.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28228784p28633986.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx Foreign key search

2010-05-21 Thread urukay

I need to search over Model1, but the query should "look" also in Model2 if
there is a match aand if there is, it returns Model1 which has relation with
Model2 which contains searched string.

But i'll take look at Haystack, maybe it'll be better for my needs.

Thanks a lot.



David De La Harpe Golden-3 wrote:
> 
> On 13/04/10 09:04, urukay wrote:
>> Hi,
>>
>> I'm trying to create full text search on model, everything goes fine
>> when
>> searching TextFields but I have a problem with ForeignKey field.
>>
>> How can i do that? Can anyone point me to the right direction?
>>
> 
> Do you mean you want the results for Model2 searches to include Model2 
> instances when when a search string matches text in any of the Model1 
> instances related to the Model2 instance?
> 
> If you're don't actually need sphinx in particular but rather you are 
> looking for the ability to full-text search django models, then 
> http://haystacksearch.org/ makes adding search facilities to django 
> projects extremely easy. With haystack and the handily-pure-python 
> whoosh, you can be up and running basic searches of your django models 
> in a matter of minutes.  In the case of the foreign key field, with 
> haystack, you could just include texts from related Model1s in the 
> search template for Model2.  That's of course a tad wasteful in some 
> ways, but OTOH might be exactly what you want.
> 
> I don't use django-sphinx so I'm not clear how to do it there, but
> a conceptually related approach does work with raw sphinx apparently: 
> you can use joins in sql_query in your source declarations. see this:
> http://stackoverflow.com/questions/1733816/sphinx-and-one-to-many-associations
> 
> [Obviously, you could also search multiple times for a given search 
> string submission and then do joins on the various results yourself, 
> though that could get painful fast.]
> 
> Full text search isn't appropriate for everything, so django-filters is 
> also handy to remember for filter query-building type stuff.
> 
> http://github.com/alex/django-filter
> 
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28228784p28633984.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx Foreign key search

2010-05-20 Thread David De La Harpe Golden

On 13/04/10 09:04, urukay wrote:

Hi,

I'm trying to create full text search on model, everything goes fine
when
searching TextFields but I have a problem with ForeignKey field.

How can i do that? Can anyone point me to the right direction?



Do you mean you want the results for Model2 searches to include Model2 
instances when when a search string matches text in any of the Model1 
instances related to the Model2 instance?


If you're don't actually need sphinx in particular but rather you are 
looking for the ability to full-text search django models, then 
http://haystacksearch.org/ makes adding search facilities to django 
projects extremely easy. With haystack and the handily-pure-python 
whoosh, you can be up and running basic searches of your django models 
in a matter of minutes.  In the case of the foreign key field, with 
haystack, you could just include texts from related Model1s in the 
search template for Model2.  That's of course a tad wasteful in some 
ways, but OTOH might be exactly what you want.


I don't use django-sphinx so I'm not clear how to do it there, but
a conceptually related approach does work with raw sphinx apparently: 
you can use joins in sql_query in your source declarations. see this:

http://stackoverflow.com/questions/1733816/sphinx-and-one-to-many-associations

[Obviously, you could also search multiple times for a given search 
string submission and then do joins on the various results yourself, 
though that could get painful fast.]


Full text search isn't appropriate for everything, so django-filters is 
also handy to remember for filter query-building type stuff.


http://github.com/alex/django-filter

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Sphinx Foreign key search

2010-05-19 Thread yafeng wu
Hi,

I got the same problem when building my website. Have you solved it?
Please let me know.

Thanks,

On Apr 13, 4:04 am, urukay <radovan.be...@gmail.com> wrote:
> Hi,
>
> I'm trying to create full text search on model, everything goes fine
> when
> searching TextFields but I have a problem with ForeignKey field.
>
> How can i do that? Can anyone point me to the right direction?
>
> Thanks
>
> Model example:
>
> class Model1(models.Model):
>
>      text_field =models.TextField(max_length=250)
>      fek_field = models.ForeignKey('Model2')
>
> class Model2(models.Model):
>      text_field = models.TextField(max_length=250)
>
> --
> View this message in 
> context:http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28219147p282...
> Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django Sphinx Foreign key search

2010-04-13 Thread urukay
Hi,

I'm trying to create full text search on model, everything goes fine
when
searching TextFields but I have a problem with ForeignKey field.

How can i do that? Can anyone point me to the right direction?

Thanks

Model example:

class Model1(models.Model):

 text_field =models.TextField(max_length=250)
 fek_field = models.ForeignKey('Model2')

class Model2(models.Model):
 text_field = models.TextField(max_length=250)

--
View this message in context: 
http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28219147p282...
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django Sphinx Foreign key search

2010-04-12 Thread urukay

Hi,

I'm trying to create full text search on model, everything goes fine when
searching TextFields but I have a problem with ForeignKey field.

How can i do that? Can anyone point me to the right direction?

Thanks

Model example:

class Model1(models.Model):

 text_field =models.TextField(max_length=250)
 fek_field = models.ForeignKey('Model2')

class Model2(models.Model):
 text_field = models.TextField(max_length=250)

-- 
View this message in context: 
http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28219147p28219147.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Date Filtering in Django-Sphinx

2009-03-30 Thread Brian Neal

On Mar 30, 6:11 am, Alfonso  wrote:
>
> And in my search view I have a simple filter (which is where I think
> the problem lies):
>
> if date == "next30":
>        results = queryset.filter(date_time>=(datetime.datetime.now))
>
> (Attempting to pull future dates just to see something happen)
>
> Where am I going wrong?

Assuming date_time is a field on your model:

results = queryset.filter(date_time__gte=datetime.datetime.now())

See the docs on field lookups:
http://docs.djangoproject.com/en/dev/topics/db/queries/#field-lookups

Also, you want to construct a datetime object that is equal to now,
not compare your field to the datetime.datetime.now function.

-BN
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Date Filtering in Django-Sphinx

2009-03-30 Thread Alfonso

Using sphinx for search in my django app and whilst it's great I can't
seem to get any date filtering happening. Sphinx conf is fairly
unremarkable:

source event_event_en : base
{
# main document fetch query
# mandatory, integer document ID field MUST be the first selected
column
sql_query   = \
 SELECT yadda ya..., UNIX_TIMESTAMP(date_time) as date_time, yaddy
ya... FROM event_event
sql_query_info  = SELECT * FROM event_event WHERE id=$id
# ForeignKeys
sql_attr_uint= category_id
sql_attr_uint= venue_id
sql_attr_uint= event_type
sql_attr_uint= artist_id
sql_attr_uint= delivery_days
sql_attr_uint= region
sql_attr_uint= event_status

# DateFields
sql_attr_timestamp   = date_time
}


And in my search view I have a simple filter (which is where I think
the problem lies):

if date == "next30":
   results = queryset.filter(date_time>=(datetime.datetime.now))

(Attempting to pull future dates just to see something happen)

Where am I going wrong?

Thanks

A
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django-sphinx Passages Help

2009-02-27 Thread fortunatestar

me too,  "BuildExcerpts"

I wanto to the reslut highligting

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django-sphinx Passages Help

2009-02-18 Thread Worldreptiles

I asked this question on the django-sphinx group a few days ago but so
far havent recievied any replies so i thought i would ask here. I'm
trying to use the passages function "BuildExcerpts" feature of sphinx
and have been unable to get it to work. Im not new to sphinx but i am
to django. So if anyone with experience using the django-sphinx app
could give me a basic usage example for views.py and the template i
would appericate it.

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Sphinx

2009-01-20 Thread Alfonso

All fixed - anyone who stumbles across this error - update to the
latest trunk of django-sphinx and works fine!

On Jan 20, 1:23 pm, Alfonso <allanhender...@gmail.com> wrote:
> Hello,
>
> I've used django-sphinx/sphinx engine in the past and found it a
> fantasic solution but now running into a problem in a new build I
> haven't seen before:
>
> So sphinx is all set up and working and in the appropriate view I
> have:
>
> def search(request):
>         search_query = request.GET.get('q','')
>         if search_query:
>                 queryset1 = Books.search.query(search_query)
>                 results1 = queryset1.order_by(@id)
>         else:
>                 results1 = []
>         return render_to_response("search.html", {"results1": results1,
> "query": search_query })
>
> Which should work... in the template I have a very simple block:
>
>   {% if query %}
>     Your results for "{{ query|escape }}":
>     {% if results1 %}
>       {% for result in results1 %}
>                 
>                                 {{ result.name }}
>                 
>       {% endfor %}
>       {% else %}
>           No Results
>                         {% endif %}
>                 {% endif %}
>
> But that's where I'm getting the following error:
>
> TemplateSyntaxError at /search/
> Caught an exception while rendering: maximum recursion depth exceeded
> in cmp
>
> It happens when I do a generic query with 1000 results returned or
> specific yielding just 1 result.
>
> Anyone got any idea where the problem might lie?  Interestingly if I
> just send the result count to the template it is displayed just fine
> with {{ result1 }}.
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Sphinx

2009-01-20 Thread Alfonso

Hello,

I've used django-sphinx/sphinx engine in the past and found it a
fantasic solution but now running into a problem in a new build I
haven't seen before:

So sphinx is all set up and working and in the appropriate view I
have:

def search(request):
search_query = request.GET.get('q','')
if search_query:
queryset1 = Books.search.query(search_query)
results1 = queryset1.order_by(@id)
else:
results1 = []
return render_to_response("search.html", {"results1": results1,
"query": search_query })

Which should work... in the template I have a very simple block:

  {% if query %}
Your results for "{{ query|escape }}":
{% if results1 %}
  {% for result in results1 %}

{{ result.name }}

  {% endfor %}
  {% else %}
  No Results
{% endif %}
{% endif %}


But that's where I'm getting the following error:

TemplateSyntaxError at /search/
Caught an exception while rendering: maximum recursion depth exceeded
in cmp

It happens when I do a generic query with 1000 results returned or
specific yielding just 1 result.

Anyone got any idea where the problem might lie?  Interestingly if I
just send the result count to the template it is displayed just fine
with {{ result1 }}.

Thanks!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django-sphinx with postgresql

2008-10-09 Thread Anderson Santos

Hello Rob

We are using Sphinx and Postgresql and it improved our searches with
less resources. We have over 300k records in one table and a usual
search takes only few milisecons.

I believe it's being maintained but with current code it's working
very well without any update.

Hope it helps


Anderson


On Oct 8, 2:37 pm, "Rob Sutherland" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm working on setting up the sphinx search tool with django-sphinx
> and I have a few questions for any
> current users out there. First, while googling I see a lot of links 
> tohttp://www.davidcramer.net/which don't
> resolve and I see that David Cramer is listed as the package
> maintainer. Is this package still being
> actively maintained? Second, is anyone currently using it to index and
> search a 100K record postgresql
> table?
>
> Thanks in advance,
>
> Rob
>
> --http://www.oscl.ca
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~--~~~~--~~--~--~---



Django-sphinx with postgresql

2008-10-08 Thread Rob Sutherland

Hi,

I'm working on setting up the sphinx search tool with django-sphinx
and I have a few questions for any
current users out there. First, while googling I see a lot of links to
http://www.davidcramer.net/ which don't
resolve and I see that David Cramer is listed as the package
maintainer. Is this package still being
actively maintained? Second, is anyone currently using it to index and
search a 100K record postgresql
table?

Thanks in advance,

Rob

-- 
http://www.oscl.ca

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~--~~~~--~~--~--~---