Comments (5)
Hi,
I'm struggling a bit with your index notation. What database backend are you using?
On 28 Jul 2013, at 10:25, Michal Novotný [email protected] wrote:
There is an interesting difference in produced indexes in a situation where I would expect them to be the same.
Unicode function of my class Crag returns attribute name.
def unicode(self):
return self.name
watson.register(Crag) produces index 'ceus':3 'céüse':1A,2Now If I register Crag just with the field name I would expect the index to be the same. but it is not.
watson.register(Crag, ('name',)) produces index 'céüse':1A,2
I'd like always the first variant to apply because it provides provides case insensitive search.
—
Reply to this email directly or view it on GitHub.
from django-watson.
It is postgresql.
from django-watson.
Hmm. That's really odd.
So, in your case, each watson search entry has three indexed fields: "title", "description" and "content. These are indexed with the following weightings:
title (defaults to unicode(obj)) - A
description (defaults to "") - B
content (defaults to " ".join(fields)) - C
If you register that model with no extra fields, then the index should contain:
"céüse" - A
"" - B
"" - C
If you register that model with a name field, then the index should contain:
"céüse" - A
"" - B
"céüse" - C
So I really have no idea how you're getting the index results you are. Raw postgres index notations don't mean a lot to me, I'm afraid.
On 30 Jul 2013, at 11:41, Michal Novotný [email protected] wrote:
It is postgresql.
—
Reply to this email directly or view it on GitHub.
from django-watson.
I am sorry for the confusion. To explain:
There is also field normalized_name on my Crag model which contains unaccented lower-cased name. That is where 'ceus' is coming from in 'ceus':3 'céüse':1A,2
. For some reason there is "e" being cut, not sure why but that is probably not important. These 1,2,3 numbers are probably order and A is a weight I guess. So it makes sense. I didn't realize that watson.register(Crag)
includes also the normalized_name column on its own.
So I guess the way to make search accent-insensitive is to register these columns with already unaccented text. Fair enough.
from django-watson.
Aha, yes! django-watson's default behaviour is to index all text and char fields.
Mystery solved. :D
On 1 Aug 2013, at 22:41, Michal Novotný [email protected] wrote:
I am sorry for the confusion. To explain:
There is also field normalized_name on my Crag model which contains unaccented lower-cased name. That is where 'ceus' is coming from in 'ceus':3 'céüse':1A,2. For some reason there is "e" being cut, not sure why but that is probably not important. These 1,2,3 numbers are probably order and A is a weight I guess. So it make sense. I didn't realize that watson.register(Crag) includes also the normalized_name column on its own.
So I guess the way to make search accent-insensitive is to register these columns with already unaccented text. Fair enough.
—
Reply to this email directly or view it on GitHub.
from django-watson.
Related Issues (20)
- Installation conflict with other watsons HOT 4
- AttributeError: module 'blog.admin' has no attribute 'site' HOT 2
- rebuilding index doesn't remove entries for deleted objects HOT 3
- No results for partial keywords HOT 1
- support extra fields to be indexed HOT 1
- expose metadata also in .filter() results HOT 3
- Registering Django FlatPage in apps.py or __init__.py Throws "Apps aren't loaded yet" Exception HOT 6
- Error after updating django to latest version HOT 2
- Possible to search with partial match? HOT 4
- Django 3.2 Warning in migration HOT 1
- psycopg2.errors.UndefinedTable: relation "watson_searchentry" does not exist HOT 3
- Search for a subset by filtering on related model fields HOT 2
- I ran python manage.py buildwatson and an error was returned... HOT 1
- 'QuerySet' object has no attribute 'strip' HOT 1
- Using non numeric primary keys HOT 1
- Issues with indexing with taggit HOT 2
- The search returns not only variants of the same word, but also words starting with the requested word HOT 3
- Doesn't pick up worded numbers in search terms HOT 1
- Searching for non-model related items (like views) HOT 1
- Support Multi-Database configuration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-watson.