Re: django search query

2013-07-01 Thread Doug Ballance


On Saturday, June 29, 2013 11:32:19 PM UTC-5, Harjot Mann wrote:
>
> Is there any search query in django which can ignore vowels like I want to 
> make a query which displays all the clients name who writes their name as 
> 'amanjit' or 'amanjeet'. 
> It should take take ee=i or anything like this. Please help me I have to 
> finish my task asap. 
>

http://www.postgresql.org/docs/9.1/static/fuzzystrmatch.html 

You should be able to do it with the django .extra() method easy enough.  I 
believe you can also make a soundex index on columns to improve the 
performance.  

The python jellyfish library is nice for pre-calculating phonetic strings 
and storing them in the database to compare against, or for small data sets 
that you want to process in python.

A third option is something like 
https://github.com/niwibe/djorm-ext-pgfulltext  which uses postgres full 
text search.  The full text search uses tokens that are normalized.  I'm 
not sure it it would normalize amanjit to amanjeet with the default 
configuration, and may be overkill for what you want.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django search query

2013-07-01 Thread Amirouche Boubekki
2013/7/1 Harjot Mann 

> On Sun, Jun 30, 2013 at 11:18 PM, Amirouche Boubekki
>  wrote:
> > You can do this by creating an extra field in the model with the name
> > without vowels in it and doing a simple filter on it ? Is that what you
> need
> > ?
>
> I have a search function which is already working in views.py but I
> want to refine it.


Is this search function a query like
MyModel.objects.filter(usernamename=username, ...) or something more
specific ?


> How can I make a model without vowels??
>

the most performant solution would be to use re
subbut str.replace
will work too.


> And what is django-haystack application?


Haystack is a full text search application, it build an index specific for
full text search which means it's not suited for the search you are looking
to do (also it takes a lot of memory).


> Can I use it in my project for refining search or is it a normal searching
> application?
>

It depends... can you write a query in the form of
MyModel.objects.filter(foo=bar, spam=egg) where you document each fields so
that we can know better what your are trying to achieve ? Real data is not
significant, but full scope of the problem you are trying to solve is.



Amirouche

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django search query

2013-06-30 Thread Harjot Mann
On Sun, Jun 30, 2013 at 11:18 PM, Amirouche Boubekki
 wrote:
> You can do this by creating an extra field in the model with the name
> without vowels in it and doing a simple filter on it ? Is that what you need
> ?

I have a search function which is already working in views.py but I
want to refine it. How can I make a model without vowels??
And what is django-haystack application? Can I use it in my project
for fefinig search or is it a normal searching application?

--
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django search query

2013-06-30 Thread Amirouche Boubekki
You can do this by creating an extra field in the model with the name
without vowels in it and doing a simple filter on it ? Is that what you
need ?


2013/6/30 Harjot Mann 

> On Sun, Jun 30, 2013 at 10:18 PM, Scot Hacker 
> wrote:
> > This is really a question about regular expressions, not about Django.
> > Whether you implement simple or complex search in Django, whether you use
> > Django or some other platform, this is going to come down to using a
> fairly
> > complex regular expression. So I would search for "regex ignore vowels"
> and
> > similar. I would also expect performing a search like that to be
> extremely
> > expensive, computationally, since it will need to tear apart every single
> > word in the pool. That, in turn, means you'll want to use a search system
> > with very robust indexes. In fact, you might do best with a system that
> > pre-indexes all of your content without vowels.
>
>
> Yes this is exactly what I want, right now its a very simple search
> but I want it to be a very good search.Please help me.
>
> --
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django search query

2013-06-30 Thread Harjot Mann
On Sun, Jun 30, 2013 at 10:18 PM, Scot Hacker  wrote:
> This is really a question about regular expressions, not about Django.
> Whether you implement simple or complex search in Django, whether you use
> Django or some other platform, this is going to come down to using a fairly
> complex regular expression. So I would search for "regex ignore vowels" and
> similar. I would also expect performing a search like that to be extremely
> expensive, computationally, since it will need to tear apart every single
> word in the pool. That, in turn, means you'll want to use a search system
> with very robust indexes. In fact, you might do best with a system that
> pre-indexes all of your content without vowels.


Yes this is exactly what I want, right now its a very simple search
but I want it to be a very good search.Please help me.

--
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django search query

2013-06-30 Thread Scot Hacker

On Saturday, June 29, 2013 9:32:19 PM UTC-7, Harjot Mann wrote:
>
> Is there any search query in django which can ignore vowels like I want to 
> make a query which displays all the clients name who writes their name as 
> 'amanjit' or 'amanjeet'. 
> It should take take ee=i or anything like this. Please help me I have to 
> finish my task asap. 
>

This is really a question about regular expressions, not about Django. 
Whether you implement simple or complex search in Django, whether you use 
Django or some other platform, this is going to come down to using a fairly 
complex regular expression. So I would search for "regex ignore vowels" and 
similar. I would also expect performing a search like that to be extremely 
expensive, computationally, since it will need to tear apart every single 
word in the pool. That, in turn, means you'll want to use a search system 
with very robust indexes. In fact, you might do best with a system that 
pre-indexes all of your content without vowels. 

./s

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django search query

2013-06-30 Thread Harjot Mann
Reply waited.


--
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.