On Fri, Aug 10, 2012 at 12:38:46PM -0400, Jack Krupansky wrote: > "Doc1 has the pattern "AB%CD%" associated with it (somehow?!)." > > You need to clarify what you mean by that.
I'm not the OP, but I think (s)he means the patterns are in the database and the string to match is given in the query. Perhaps this inversion is a bit unusual, and most optimizers aren't prepared for that, but still reasonable, IMHO. > To be clear, Solr support for wildcards is a superset of the SQL > LIKE operator, and the patterns used in the LIKE operator are NOT > stored in the table data, but used at query time I don't know about others, but PostgreSQL copes just fine: | tomas@rasputin:~$ psql template1 | psql (9.1.2) | Type "help" for help. | | template1=# create database test; | CREATE DATABASE | template1=# create table foo ( | template1(# pattern VARCHAR | template1(# ); | CREATE TABLE | template1=# insert into foo values('%blah'); | INSERT 0 1 | template1=# insert into foo values('blah%'); | INSERT 0 1 | template1=# insert into foo values('%bloh%'); | INSERT 0 1 | template1=# select * from foo where 'blahblah' like pattern; | pattern | --------- | %blah | blah% | (2 rows) Now don't ask whether the optimizer has a fair chance at this. Dunno what happens when we have, say, 10^7 patterns... but the OP's pattern set seems to be "reasonably small". > - same with Solr. > In SQL you do not "associate" patterns with table data, but rather > you query data using a pattern. I'd guess that the above trick might be doable in SOLR as well, as other posts in this thread seem to suggest. But I'm not that proficient in SOLR, that's why I'm lurking here ;-) tomás -- Tomás Zerolo Axel Springer AG Axel Springer media Systems BILD Produktionssysteme Axel-Springer-Straße 65 10888 Berlin Tel.: +49 (30) 2591-72875 tomas.zer...@axelspringer.de www.axelspringer.de Axel Springer AG, Sitz Berlin, Amtsgericht Charlottenburg, HRB 4998 Vorsitzender des Aufsichtsrats: Dr. Giuseppe Vita Vorstand: Dr. Mathias Döpfner (Vorsitzender) Jan Bayer, Ralph Büchi, Lothar Lanz, Dr. Andreas Wiele