Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-17 Thread Jay Levitt
Alexander Korotkov wrote: On Fri, Feb 17, 2012 at 11:32 PM, Jay Levitt Ah, yes, exactly the same problem. So what led you to add a flag instead of using the range NULL..NULL? I'm on the fence about choosing. At first, range bounds can't be NULL :) At second, if we have range (a;b)+"c

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-17 Thread Alexander Korotkov
On Fri, Feb 17, 2012 at 11:32 PM, Jay Levitt wrote: > Alexander Korotkov wrote: > >> On Fri, Feb 17, 2012 at 11:00 PM, Jay Levitt > > wrote: >> >> At first I thought this posed a challenge for union; if I have these > points: > >> >>(1,2) >>(2,1) >>(1,

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-17 Thread Jay Levitt
Alexander Korotkov wrote: On Fri, Feb 17, 2012 at 11:00 PM, Jay Levitt mailto:jay.lev...@gmail.com>> wrote: At first I thought this posed a challenge for union; if I have these points: (1,2) (2,1) (1,NULL) what's the union? I think the answer is to treat NULL box coordina

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-17 Thread Alexander Korotkov
On Fri, Feb 17, 2012 at 11:00 PM, Jay Levitt wrote: > Tom Lane wrote: > >> Jay Levitt writes: >> >>> - Does KNN-GiST run into problems when<-> returns values that don't >>> "make >>> >>> sense" in the physical world? >>> >> >> If the indexed entities are records, it would be >> entirely your ow

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-17 Thread Jay Levitt
Tom Lane wrote: Jay Levitt writes: - Does KNN-GiST run into problems when<-> returns values that don't "make sense" in the physical world? If the indexed entities are records, it would be entirely your own business how you handled individual fields being NULL. This turns out to be a bit ch

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-16 Thread Tom Lane
Jay Levitt writes: > Tom Lane wrote: >>> - Can domains have operators, or are operators defined on types? >> >> I think the current state of play is that you can have such things but >> the system will only consider them for exact type matches, so you might >> need more explicit casts than you or

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-16 Thread Jay Levitt
Tom Lane wrote: - Can domains have operators, or are operators defined on types? I think the current state of play is that you can have such things but the system will only consider them for exact type matches, so you might need more explicit casts than you ordinarily would. Turns out it's ev

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-16 Thread Tom Lane
Jay Levitt writes: > Perfect. Composite types are exactly what I need here; the application can > declare its composite type and provide distance functions for each member, > and the extension can use those to calculate similarity. How do I introspect > the composite type's pg_class to see what

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-16 Thread Jay Levitt
Tom Lane wrote: Jay Levitt writes: - I'm not sure how to represent arbitrary column-like features without reinventing the wheel and putting a database in the database. ISTM you could define a composite type and then create operators and an operator class over that type. If you were trying to

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-16 Thread Jay Levitt
Alexander Korotkov wrote: On Thu, Feb 16, 2012 at 12:34 AM, Jay Levitt mailto:jay.lev...@gmail.com>> wrote: - But a dimension might be in any domain, not just floats - The distance along each dimension is a domain-specific function What exact domains do you expect? Some domains could ap

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-16 Thread Alexander Korotkov
On Thu, Feb 16, 2012 at 12:34 AM, Jay Levitt wrote: > - But a dimension might be in any domain, not just floats > - The distance along each dimension is a domain-specific function > What exact domains do you expect? Some domains could appear to be quite hard for index-based similarity search usi

Re: [HACKERS] Designing an extension for feature-space similarity search

2012-02-15 Thread Tom Lane
Jay Levitt writes: > - I'm not sure how to represent arbitrary column-like features without > reinventing the wheel and putting a database in the database. ISTM you could define a composite type and then create operators and an operator class over that type. If you were trying to make a btree o

[HACKERS] Designing an extension for feature-space similarity search

2012-02-15 Thread Jay Levitt
[Preamble: I've been told that the hackers list is appropriate for extension-related topics like this, even if it's not about contributing to core. If I'm misappropriating, please let me know.] Goal: Personalized, context-relevant query results We are building a deeply personalized site; think