Guyren,

No, I don't think you've misunderstood at all.  It's not a text search 
problem.  I'm trying to find the "closest" match to 16 integer values, 
close being defined as the overall distance between the vector components 
or Euclidean L^2 Norm.

Dan's suggestion for the query was what I was initially trying to do, and I 
hacked that together pretty quickly.  It seems pretty fast to compute, say, 
the 5 closest matches, but it feels wrong to not be using a precomputed 
index somehow.  

I'm also concerned how that would scale if we had millions of images 
against which to match combined with thousands of simultaneous queries. 
 Yeah, yeah, that will be a good problem to have but I'm trying to not 
start out hamstrung.

I tried the approach described here:  <
http://stackoverflow.com/questions/16676644/postgresql-k-nearest-neighbor-knn-on-multidimensional-cube
>

But Postgres does not appear to support the <-> distance operator between 
text values or integer arrays.  The code example in that SO post does not 
work, though the author doesn't claim that it does.

I also tried a 16-dimension cube, but the current Cube support also doesn't 
include <->.  There is an experimental patch floating around that adds that 
capability but that would require me to custom build Postgres and I'm not 
sure I want to go down that path just yet.

I scoured the Solr and Sunspot documentation looking for an example of 
searching on "closeness" to numeric values but didn't see anything.  I'm 
wondering if I simply declare the 16 vector components as "text" fields in 
the Rails model's searchable block if I'll get the results I'm after.  An 
experiment to try, no doubt.

Thanks again for all the great input, and especially that SO post!

Cheers,

Chris

On Friday, April 11, 2014 6:05:18 PM UTC-7, Gisborne wrote:
>
> On Apr 11, 2014, at 4:56 PM, Rob Kaufman <[email protected]> wrote:
>
> Solr and Sunspot (for Rails) has pretty powerful numeric search.  Worth 
> taking a look at if what you can get out of Postgres doesn't get you there 
> or if you're queries get too complex.  Solr wraps Lucene, making it much 
> easier to use.
>
>
> Doesn’t sound like a text search problem though, or did I misunderstand? 
> If you’re wanting to do clever things with 16-dimensional numeric vectors, 
> text is surely the last way to deal with it.
>
> Regards,
>
> Guyren G Howe
> Relevant Logic LLC
>
> guyren-at-relevantlogic.com ~ http://relevantlogic.com ~ +1 512 784 3178
>
> Ruby/Rails,  Xojo, PHP programming
> PostgreSQL, MySQL database design and consulting
> Technical writing and training
>
> Read my book, Real OOP with REALbasic: <
> http://relevantlogic.com/oop-book/about-the-oop-book.php>
>  
>

-- 
-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
--- 
You received this message because you are subscribed to the Google Groups "SD 
Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to